Terragen 2
Water Caustics Tutorial
By dandelO.
This is a reasonably easy way I've found to fake water caustics directly inside Terragen 2 Technology Preview. This tutorial assumes that you already know the water transparency workaround by Sonshine777. I'll go through it roughly here though.
I’m including everything for the project scene in the screenshot above.
PART 1 - The Groundwork.
1. Open T2TP and go straight to your objects tab, I'm working on a plane object for this scene as the ground so, make a new plane. Set the size and call it 'groundplane', here mines is 100x150metres. The translation co-ordinates are x = 5 y = 0 z = 5.
2. click on 'planet 1' and uncheck 'render surface'. This will greatly decrease render time when working on a plane as the terrain beneath won't render first before your plane object does when you come to render your image. Now go to your 'planet1 input node' and take out the 'base colours' input, put it into your groundplane. T2 now thinks that this plane is the floor so everything you build on top of it will be exactly like your laying surfaces on a planet in a normal landscape scene(I'm just using a plane for quickness and it is all that's needed here, this is the same way I made my Rockpool image
3. The grounds 'rock base' layer is a normal surface layer with the 'colour function' of 3 different powerfractal shaders for colour, they are saved in the internal network of the group 'RB Shaders'. (a little trick I learned from Volker Haroons Power Fractal tutorial on Planetside forums.)
4. Add a fakestones layer(size-3 density 0.7 for this tutorial) after the 'rock base' and texture them too. Here mines are textured the same as above but with 4 PF shaders saved inside the 'FS shaders' group. Plug 'rock base' into it.
5. Create another new 'surface layer' and call it 'Caustics ground function', set to 0.5 coverage and uncheck 'apply colour', then leave this alone for now, we'll come back to it later. You can delete the 'fractal breakup shader' that came free with this layer, for this project it is 'junkmail'. ;) Plug 'fake stones shader' into this new surface layer.
6. Finaly for the ground section, plug your 'caustics ground function' into your groundplane input node.
That's the floor done for this quick tutorial!
PART 2 - The Water Work 1.
1. Go to the water group. Create a new 'plane object' there. Set the size to cover the area you want your water to appear on, here it is just smaller than my groundplane for demonstration purposes. The y value is 0.4 (40 cm above the groundplane)
Call it 'Water Plane' and put it down at the bottom of your water group.
2. Create a new 'water shader'.
Then, a new 'surface layer'(again, delete the fractal breakup shader), call it 'water surface displacement'.
Create a new 'imagemap shader' and a new 'merge shader' aswell.
Se my ‘NODE NETWORK SCREENSHOT DRY RENDER SETTINGS’ for the wiring of these nodes.
The 'water shader' is a child of the 'waters surface displacement' layer. The displacement layer goes into the input node of the 'merge shader' and then, that goes into the 'waterplane'.
Imagemap shader goes into 'shader A' of the merge shader. We'll soon have an image to use in there, leave it blank for now...
3. Disable your 'waterplane' object for now, we don't want to see it yet. PART 4 deals with this area.
Node Network dry render settings
Click for fullsize.
PART 3. - The Caustics Work.
1. Create a new camera, my default secondary one is called 'directors camera' so I'll refer to it as that here.
Set the translation to x = 5 y = 100 z = 5. Now it's 100 metres directly above the centre of your groundplane, set the x rotation to -90. Leave it there.
2. Back inside the water group, create a new 'Group'. Call it 'caustics'. Make a new imagemap shader inside it, call it 'caustics image map'. Select your greyscale caustics image for this shader(I've included mine in the .tgd project download) and set the projection to 'through camera', select 'directors camera' as the projection camera and check both 'repeat x' and 'repeat y' in the flip/repeat tab. That's it in here for now.
3. Go to your 'Shaders' group and open the settings for 'caustics ground function'. Visit the 'luminosity' tab at the top and select 'caustics image map' as the 'luminosity function'. Set it to: Luminous = 1.2 Luminosity tint = 1(white).
4. You should now see your caustics image being projected from directly overhead onto the groundplane! J
5. Render your image like this, with the 'waterplane' disabled, a lower quality setting will do for this, 0.5 is good I find. This will be your subsurface image for your blank imagemap shader, made earlier on in the water group.
Once it's rendered, save it and use it in your imagemap shader, with 'through camera' projection and 'render camera' as the projector this time.

We could stop right here and still it would look like a pretty convincing caustics pattern with the default watershader settings... We'll go just that little further here though and make those caustics actually true projections of the waters surface...
PART 4 - Water Work 2.
1. Back in the water group, take a second line from the
output of the caustics image map shader and plug it into the 'displacement
function' of the water surface displacement layer, UNPLUG the caustics image map from the 'caustics ground function' luminosity input now! We only want the caustics underwater.
2. uncheck 'apply colour' in the waters surface displacement shader then, visit the 'displacement' tab.
3. You'll see your caustics image is being used here because you've just plugged it in in step 1. Set the displacement to 0.25(25cm), displacement offset to 2.(The 2m offset is just to raise the surface above the stones without moving the plane up)
4. Re- enable your 'waterplane' that you placed at the very bottom of the group earlier. Now in the preview window, you'll see your subsurface image 'merged' exactly half in half with the water shader. And the 'caustics image map' is now the displacement of the waves on the surface, just as in life!
To make the water less transparent, slide 'Mix to A' left in the merge shader, slide it right to make it more transparent.
The waters surface is also closer to the projection camera than the ground is so, the size difference between the caustics and the waves is relative to depth, i.e. larger on the ground / smaller on the waves! J
There is still no real water magnification or actual refraction performed but it's a decent workaround anyway with the tools we have to go with.(setting the horizontal FOV slightly wider for the caustics on the 'dry' render would add to the magnification issue but I've not done that here).
For wide, longer shots, you will want to move the caustics projection camera nearer to the angle and direction of your sunlight, for the 'dry' render only, to make it seem as if the caustic light is being cast at the correct angle, rather than from the straight above position that is all this reasonably close-up tutorial requires.
That's it! Caustics in Terragen 2, well, as close as nearly anyway... Please let me know of any improvements that could be made or any renders that you make yourself with the help of this little tutorial, I'd love to hear any input and see your finished renders when they're done!
dandelO.



