How to use the caustics shader
by To-mos · in Torque 3D Professional · 08/17/2013 (7:15 pm) · 17 replies
As dumb of a question as this sounds, I actually don't know how to get the caustics shader working on water surfaces. I have a river and don't really know how to apply the shader to it, then I tried a water plane and didn't see anything to apply caustics. I have Torque 3.0 MIT and see the caustics shaders in the folders but don't actually know how to use them. I'm sure this is a very simple thing but I don't see any resources or answers to applying a caustic effect to a water surface. Any help or links would be great :)
About the author
#2
08/18/2013 (2:19 am)
Yeah it is weird considering that doesn't work... I can see turbulence but no caustics and this is a fresh build straight from the site.
#3
08/18/2013 (2:31 am)
Here is what I see on the MIT version straight from the site with Advanced lighting postFX running a Geforce GTX570
#4
go into core/scripts/client/postFx/caustics.cs and change
08/18/2013 (3:45 am)
Found it finally after some digging through files and source code.go into core/scripts/client/postFx/caustics.cs and change
singleton PostEffect( CausticsPFX )
{
requirements = "None";
isEnabled = false;
renderTime = "PFXBeforeBin";
renderBin = "ObjTranslucentBin";
//renderPriority = 0.1;
...tosingleton PostEffect( CausticsPFX )
{
requirements = "None";
isEnabled = true;
renderTime = "PFXBeforeBin";
renderBin = "ObjTranslucentBin";
//renderPriority = 0.1;
...
#5
08/18/2013 (6:19 am)
Oh right. So instead of doing that, you could open up the console and type CausticsPFX.enable();For actual production you'd want to put that somewhere in your game scripts, and maybe make it optional.
#6
08/18/2013 (9:27 am)
Hmmm... My card (gts250) is older and crappier and still has it on by default. At least you got it sorted.
#7
I purchased Ron Kapaun's Tropical Rainforest pack and noticed that after putting that in, the caustics PFX show up automatically.
08/18/2013 (2:49 pm)
Vanilla MIT build you have to call CausticsPFX.enable().I purchased Ron Kapaun's Tropical Rainforest pack and noticed that after putting that in, the caustics PFX show up automatically.
#8
08/18/2013 (3:18 pm)
Thanks a bunch! I knew we could do it after getting some smart alecky remarks out of our system :D Hope this page helps postFX noobs like me later on down the road.
#9
@Dan: do you think the GTX 570 isn't in one of the profile lists or isn't recognized by the engine and maybe that's why it didn't work? I'm just wondering myself now actually.
08/18/2013 (3:21 pm)
Seriously though thanks a lot for the help, doing it this way fixed a strange bug with the caustics not updating when you move a water plane and having to restart the engine heh. @Dan: do you think the GTX 570 isn't in one of the profile lists or isn't recognized by the engine and maybe that's why it didn't work? I'm just wondering myself now actually.
#10
Really, I just move my camera under the water and it's updated. I never have to call CausticsPFX.enable();
08/18/2013 (3:24 pm)
Quote:"doing it this way fixed a strange bug with the caustics not updating when you move a water plane"
Really, I just move my camera under the water and it's updated. I never have to call CausticsPFX.enable();
#11
core/scripts/client/postFx/turbulance.cs
08/18/2013 (3:28 pm)
Ok so a better update from the help of the awesome community :D here is what I changed.core/scripts/client/postFx/turbulance.cs
function UnderwaterFogPostFx::onEnabled( %this )
{
TurbulenceFx.enable();
return true;
}
function UnderwaterFogPostFx::onDisabled( %this )
{
TurbulenceFx.disable();
return false;
}tofunction UnderwaterFogPostFx::onEnabled( %this )
{
TurbulenceFx.enable();
CausticsPFX.enable();
return true;
}
function UnderwaterFogPostFx::onDisabled( %this )
{
TurbulenceFx.disable();
CausticsPFX.disable();
return false;
}does this seem a little bit more reasonable?
#12
08/18/2013 (3:30 pm)
@Dan: yeah it does this now after i do CausticsPFX.enabled() once and updates after i move the camera under the table. I was referring before to my dumb way of forcing the effect on. That's the one that broke it :)
#13
08/18/2013 (11:22 pm)
Should the Caustics effect only happen when the camera is underwater? In real life can you see it when you're above the water surface?
#14
08/18/2013 (11:48 pm)
im not sure I've noticed it turns on when you go under but stays on even after you leave.
#15

As you can see, it's visible out of the water too. That it doesn't automatically update I would call a bug, but I haven't tested to see if it updates after closing the editor and opening it again. As I say, I just dip the camera below the surface to refresh it, and that works.
What I have noticed, is that if you have caustics enabled and you're just using a waterblock, the caustics treats it as a waterplane; adding it to any surface below the waterblock plane, even if those surfaces aren't under water.
08/19/2013 (1:40 am)

As you can see, it's visible out of the water too. That it doesn't automatically update I would call a bug, but I haven't tested to see if it updates after closing the editor and opening it again. As I say, I just dip the camera below the surface to refresh it, and that works.
What I have noticed, is that if you have caustics enabled and you're just using a waterblock, the caustics treats it as a waterplane; adding it to any surface below the waterblock plane, even if those surfaces aren't under water.
#16
08/19/2013 (1:48 am)
Yeah I don't think they have the effect localized to an object it just treats it as a plane. I had a river at a location and the caustics were everywhere at the average height of the river.
#17
"* Merge pull request #378 from DavidWyand-GG/UnderwaterShadersDisable
Underwater caustics default to off"
on 5/8/2013 7:00 PM
08/23/2013 (10:26 pm)
I just realized in the github log it says "* Merge pull request #378 from DavidWyand-GG/UnderwaterShadersDisable
Underwater caustics default to off"
on 5/8/2013 7:00 PM
Torque Owner Dan Webb
PsyCandy Games