Matt's water table

Started by bigben, January 19, 2008, 08:43:34 PM

Previous topic - Next topic

bigben

Hi All

Had to have another go at improving my river setup and thought I'd give Matt's suggestion as it seemed to be the most suitable (not really a surprise there though)

Quote from: Matt on December 05, 2007, 10:03:13 AM
The Lake object should do the trick. This is a separate object, so when transparency is supported you will get the results you want. You can use the Lake object as a water table because you can displace its surface however you want. (I even considered calling the Lake object "Water Table".) If you input a heightfield shader to the water shader then you will get the topography you need.

I think that to make it more intuitive we might want to add a separate shader channel to the Lake object which can be used for defining the water table (rather than chaining the heightfield with the water surface shader as we do now).

EDIT: it would also be good if this can be done without the node network.

Matt


The tricky part was going to be fitting it in with my tiled terrains and image maps. Testing with a single terrain first.

To create the river bed I added a displacement shader after the terrain using the river image map as the displacement function, dropping the terrain 3m. Antialiasing should make the slope of the bed reasonably smooth.

For the water table I created another heightfield node using the existing load terrain node, and inserted a heightfield adjust vertical node in between to drop the heightfield 0.75m  This will create a more realistic river bank where the image map doesn't exactly follow the path of the real river (e.g. if the terrain is flat)

To avoid negative displacements in other parts of the terrain showing water I masked the water table heightfield using an adjusted version of the river image map (white level = 0.05). This drops the terrain that is not river down to 0, and ensures that the river extends beneath the displaced river bank leaving no gaps. The heightfield node is then connected to the water shader of the lake, with a surface shader added after the water shader to change the water colour.

For my tiled terrains it's going to mean a parallel set of heightfield nodes with blending shaders consisting of each heightfield's blending mask (retain the tiling) multiplied by the river mask.

Works a hell of a lot better than my previous river masking and has a lot of other advantages like having a rocky river bed with partly submerged rocks.

dhavalmistry

good to have you back with all kinda crazy tests!
"His blood-terragen level is 99.99%...he is definitely drunk on Terragen!"

bigben

#2
thanks... I think  ;)

Another thing I just twigged to.... having a duplicate set of heightfield shaders means that I can turn off fractal displacement for the water table heightfields to provide a smoother surface. This was one of the biggest headaches I had with my previous methods. I'll try and stop thinking for long enough to let a render complete  ;)

Here's a partial render showing the river on one side and the river bed on the other (the river's just starting to render at the bottom)

[edit] and finally, the finished render.  I'm not sure what caused the glitch in the water. The mask did have some glitches in it (made in a hurry) but since the river bed worked it should have worked for the river too.  I didn't have a compute terrain node after the duplicate heightfield... will try a Tex coords from xyz first since I don't really need normals calculated for this

... and it's not the river "terrain" Screengrab 3 shows the river terrain on its own

Turning all terrains off, just leaving the lake object shows that it is a gap in the object, but I can't figure out where it's coming from as the heightfield looks fine.

bigben

#3
Moving the camera back got rid of that glitch but displayed another (near the bottom of the image, either side of the island)  Something to revisit after the update then Apart from this glitch, everything else about this method seems to address issues I had with my other methods and it's a relatively simple node setup.

The final screengrab shows that it is partly dependent on render quality.

First image: detail 0.5, AA3
Second image: detail 1, AA6

Seth


rcallicotte

BigBen, this is awesome.  Thanks for your efforts and sharing.  Cool work!   ;D
So this is Disney World.  Can we live here?