Terragen 2 Water Caustics Tutorial

September 30, 2007 8:07 pm

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 at TerraNuts. I'll go through it roughly here, though.

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, mine is 100 x 150 metres. 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 'planet 1 input node', take out the 'base colours' input, and 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 you're 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).


Rockpool v.3.0 - Final © dandelO


3. The ground's '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 in the Planetside forums).

4. Add a 'fake stones' layer (size -3, density 0.7 for this tutorial) after the 'rock base', and texture them too. Mine 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 it 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. Finally, for the ground section, plug your 'caustics ground function' into your groundplane input node.

That's the floor 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.

Node Network - Dry Render (click image for larger view)
2. Create a new 'water shader', and 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' as well. See my ‘Node Network screenshot - dry render settings’ (at right) 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'. The 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.

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 and call it 'caustics'. Make a new imagemap shader inside it, and 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! :)

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 water's 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.

2. Uncheck 'apply colour' in the water's surface displacement shader, then visit the 'displacement' tab.

3. You'll see that your caustics image is being used here because you've just plugged it in in step 1. Set the displacement to 0.25(25cm), and 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. 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' to the left in the merge shader, or slide it right to make it more transparent.

Node Network - Final (click image for larger view)
The water's 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! :)). 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. This is 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, 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!

Get the .tgd project file for this tutorial, here.

All supporting images are copyright, and cannot be
copied, printed, or reproduced in any manner without written permission.

Special thanks to Renderosity artist, dandelO. Be sure to visit:
dandelO's Renderosity Home Page 
dandelO's Renderosity Gallery 
dandelO's Web Site

October 1 , 2007

Please note: If you find the color of the text hard to read, please click on "Printer-friendly" and black text will appear on a white background.


Create your masterpieces with products from the Renderosity MarketPlace

Touchable Hr-097

Fairy Delights Backgrounds

PM - Velvets

Sweetness Poses for GF3 and V7

Check out What's on Sale and see the Hot New Products for more items!

Article Comments

No article comments have been posted. Sign In or Register to share your thoughts.

Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.