What is the nature of the Fractal warp shader ?

Started by russe166, January 30, 2014, 10:50:13 AM

Previous topic - Next topic

russe166

Hallo!

Is the effect of the "Fractal warp shader" somehow connected to the slope angle from the Input terrain?

Michael

Matt

With all shaders in Terragen, the "shading and lighting" stage happens after all displacement has been done. If you move your Surface Layers to the end, after the Compute Terrain, you'll find that the render looks the same. The Surface Layers are using the slope of the individual micropolygons after all displacement has been done by all the shaders plugged into the planet. Because of that, the Compute Normal that you've added doesn't do anything useful here.

There is a way to change this. On the "Slope Constraints" tab of each Surface Layer you can set the "Slope key" to "Terrain Normal". This causes it to use the normal calculated by the last Compute Terrain or Compute Normal node. But it will always use the last Compute Terrain or Compute Normal node in the entire chain, even if it's after your Surface Layers, because normals are computed during the displacement pipeline and only one normal is remembered for each point being shaded.

Now, having said that I tried changing all the Surface Layers in your project to use "Terrain Normal" and I disabled the Compute Terrain at the end. I was expecting this to render normals from the unwarped terrain, ignoring the Fractal Warp Shader, but it didn't work that way. The Fractal Warp Shader affects the normals. I'm not exactly sure why - the Fractal Warp Shader simply distorts the texture coordinates that are seen by shaders above it. It's probably some subtlety of the way Compute Normal and Compute Terrain work that I'm not appreciating at the moment  :-[ It might not be a bug, just a consequence of the way these shaders work.

In general, having more than one Compute Terrain or Compute Normal in the network can cause things to happen that you might not expect.

There's a lot more detailed explanation here, although it doesn't necessarily explain the mystery with the Fractal Warp Shader:

http://www.planetside.co.uk/forums/index.php/topic,1249.msg12539.html#msg12539

Matt
Just because milk is white doesn't mean that clouds are made of milk.

russe166

Hi Matt

Thank you for the quick and detailed answer.

Now I understand that the displacement from the fractal warp shader is applied
first and then the color from the surface layers.


Michael