Game Development Community

Screenspace lightning, Wetness and precipitation

by Kory Imaginism · in Torque 3D Professional · 06/02/2013 (10:08 am) · 21 replies

I would like to start a thread covering these two issues. With screenspace lightning and; wetness and precipitation. Both are going to be a big part of the project I'm working on and I would like to see what the community thoughts are on these. Should they be a part of T3D?

Neither one has been in T3D but both have been done before.

Alfio a few years ago developed a screenspace lightning shader for T3D:




I believe Marcus L created a wetness shader for T3D 1.1 beta 3:


Both I feel would be a great addition to the POSTFX in T3D. I would just like to see what everyone else thinks about these two.


Currently the wetness can be downloaded from here:
themxg.webs.com/torque/Wetness_Shader_1.1b3.zip

I have the screenspace lightning shader (awaiting approval to share with the community). The lightning shader was done for 1.2 and doesn't need much work to get operational in 3.0. The wetness may need a little more work. If anyone is up to it lets try to get these feature added to the main branch as a part of T3D.
Page «Previous 1 2
#1
06/02/2013 (1:10 pm)
The problem with the wetness shader indicated is that it has no concept of inside or outside... so once the postFX is enabled everything is "wet" -- not so good for general inclusion. A better solution would be to have wetness as a special material rather than a fullscreen effect.
#2
06/02/2013 (1:19 pm)
another issue wetness is that as a postFX, there is no real way to track X,Y,Z coordinates accurately..... so you get oddball effects like water flowing up a wall and in odd directions... something like this will need to be handled as a custom material, not a postFx.

#3
06/02/2013 (1:38 pm)
indeed wetness shouldnt be a postfx
as the results end up totally screwed

it might just be easier to create a animated shader material
that could be expanded further
so effects like weather accumulation could be achieved
aswell
and we all know that this can be done

Sahara is the best example

has anyone something done in the way of sahara?
i do know/ remember that Konrad Kiss posted some kind of hint resource regarding the shadertech behind Sahara

it might be the right place to start?! or not

sure we could just say who wants such a effect/effects should go on and buy sahara

However since T3D is MIT
it should be in the interest for all to implement such thing
those are just my toughts

edit:
www.garagegames.com/community/resources/view/15675
thats the link to the mentioned resource
and i was wrong its not from sahara, its from cliffs
but well cliffs was Saharas beginning

maybe someone who has some actual knowledge about shaders can look into this?
#4
06/02/2013 (2:36 pm)
Yes I agree, maybe as a POSTFX it's not the better solution. Originally I was thinking a custom shader would be the best idea.
If my memory serves me right, like Michael said it pretty much rendered on everything including the player(s). So interiors would have an animated scrolling effect that looked really bad.
I just like the idea of selecting the precipitation block and then the wetness part is automatically taken care of. I remember the convo that was going when Marcus developed the shader, maybe there is some useful info in that thread.
www.garagegames.com/community/forums/viewthread/98745
Also I still talk to the guy (Gerhard) behind the original wetness and precipitation off and on.

Maybe he'll have an idea of what could/should be done. I think the guys behind "The Trench" had a good solution for wetness as well, but it seems as if a custom shader approach may be the best.

EDIT: JOlinar, I agree that would be a better solution!
#5
06/02/2013 (2:47 pm)
Once I hear back back from Alfio would you think that the lightning PostFX would be a good addition to the main branch?
#6
06/02/2013 (4:08 pm)
ye that actually would be a nice adittion
i do remember from reading that Alfio did some more work regarding shaders maybe he has something useful

anyways then there is this whitepaper by nvidia
it deals with Gravity - a so called Gravity Blood Shader
it might just be another punch in the right direction

Link:
http.download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/Direct3D9/src/HL...
#7
06/03/2013 (6:04 am)
@Kory
I realise this is off topic, but I was wondering if you could share how you did that over the shoulder camera in the second video? I've been looking for that type of camera for a long time.
#8
06/03/2013 (6:19 am)
Paul, I'll post the code I have.

edit: HERE IS THE LINK
www.garagegames.com/community/resources/view/22296
#9
06/03/2013 (6:29 am)
Thank you Kory, looking forward to trying it out.
#11
06/03/2013 (9:14 am)
Also, while I don't know about the postfx aspect of it, I think my favorite implementation of a wetness shader in how to actually USE it was the CryEngine.

Honestly, it was a light with a special mode that instead of applying the light buffer info, it used it to apply the wetness effect. This means you could localize it for areas with no ceiling and leave the rest alone, or apply it to a sun object and have it affect the whole level. And because it used the light pass, it'd treat the 'shadows' as occluded areas that wouldn't have the wetness effect applied.

You'd still need to sort out making sure that the water flows right and whatnot, but this seems to be the most practical solution to the other issues like making sure it isn't wet where it shouldn't be, etc.
#12
06/04/2013 (4:56 am)
Guys,
you don't need a gravity map to achieve the wet effect.
Creating screen space specular mapping, sampling and shifting specularity using a normal map at the y coord would produce a great looking wet walls.
For the horizontal floor use a separate buffer, render some reflections.Sample them the same way with the normal map. Unwrap a mask for puddles and a mask to distinguish the wet places.
#13
06/04/2013 (5:03 am)
Ivan
That sounds like it may work. That would be awesome if you did a wetness pack, similar to your liman3D shader pack. I would definitely pick it up ;)
#14
06/04/2013 (1:30 pm)
I'm with Kory. I would buy that pack, as well!
Wetness would give diversity to levels. It would make some levels look that much cooler!
Ivan what do you say? Can you do it?
#15
06/05/2013 (11:00 am)
Ivan is a machine, he can do everything :), but I am afraid he doesn't have any spare time...
#16
07/05/2013 (6:27 pm)
Ivan, I agree... y coor would produce the proper result. Problem is, y is arbitrary at this time and appears to based on the artist choice as to how they map items. I have tried multiple solutions to this issue (including a basic material shader addition) and I have not nailed it yet. Oh yeah, please everyone! Stop showing that crap video where the water is rolling down the walls and steps... that is TGEA NOT T3D.

Near as I can tell thus far, this is why a postFx solution does not work properly. By the way, Chrome 5 engine suffers from the same problem but, I guess they did not really care. Check out the wetness shader stuff in Dead Island Riptide.... its REALLY bad.

Ron
#17
07/07/2013 (8:32 am)
Actually the video was a hybrid of TGEA and T3D. It was the build the original developers of T3D were working with. The guy that original created the code and I still talk sometimes :)
As for the chrome 5 engine I'll have to check that out. Maybe the same method they did would be good for us until we can develop a better method?
According to the guy that did the original code (Gerhard). The method in which T3D does for the deferred rendering is the issue why the wetness and precipitation wouldn't work right. He told me it has to do with the way T3D handles transparencies. So for getting the feature into T3D maybe someone could take a look at this. Maybe there is a way around this or maybe a rewrite of the deferred rendering system is in order to fix the problem.
#18
07/07/2013 (10:26 am)
Just looked at a video of Dead Island riptide with the wetness effect and I seen what you mean... www.youtube.com/watch?v=Afwbnd70C54
It's kind of similar to the shader that was done for T3D. Honestly that maybe the best that can be done with the current renderer, not for sure about that one.
If what Gerhard told me is true about the method T3D uses, then in the current state I believe that's the best method. He told me the deferred rendering method is similar to some of the other engines like EDIT: the X-Ray Engine (not id 5), just to name one. Not for sure if they have the wetness or not but what should be done is to take a close look at some of the engines that use the same or a similar method that was used by T3D, and try to do the same for T3D. One thing that he told me is that not every engine uses the same method for deferred rendering, so the method that was used in lets say unity may not work for T3D. I guess we need to find out the type/method that T3D uses first. Find out if any other engine is using the same or a similar method, find out how that engine did it, and then try implementing a similar method for T3D.

Another way is rewriting the renderer to a renderer even more closer to the cry engine, and do the exact same method they did. Or maybe adding of a weather system.
sdk.crydev.net/display/SDKDOC21/Setting+Up+Weather+Effects#SettingUpWeatherEffec...

#19
07/08/2013 (1:22 am)
Hey Ron,
the y coord in screen space is always the same.
This is not a post effect, you provide a screen space sample in the material feature.
#20
07/09/2013 (4:21 pm)
Well, I guess I am going to have to revisit this, it's been a little while since I looked at it. Thanks Ivan, I will dig a bit and see what I can come up with (I probably screwed up somewhere)

Kory... just a quick note, (by the way you are NOT the only person to get this incorrect). What T3D uses is NOT deferred rendering, it uses deferred lighting, you are correct though. Deferred lighting can cause issues with transparency (as we have all probably noticed at times). The main problem with the 'old post' of the wetness shader is that in certain instances the water flow is all wrong. Once I get a bit of time, I will dig into it and see if I can find a solution.

Ron
Page «Previous 1 2