Quote from: njeneb on August 05, 2011, 03:09:47 AM
Dune is correct. I use distribution shaders all the time. I have found that the altitude settings interfere with displacement nodes in the Terrain node area. I don't know why. The slope settings work fine.
I hope this gives you some insight on how this stuff works more or less.
What's your usual workflow? Do you perform all displacements before compute terrain or also some after?
Compute terrain builds/updates the normals + texture coordinates. Normals for slope, texture coordinates for altitude.
These coordinates are slightly smoothed internally to allow for intersect underlying for instance, so the smoothing already can cause slight discrepancies, but I think only at small scale you may notice this. More on this later.
Surface Layers use "position in texture/terrain" (texture coordinates) for altitude.
The reason for this is that colour and displacement will be based on the same altitude constraints and displacements will not use the final displaced position and can only be based on the texture/terrain coordinates. This would allow the surface layer and displacement to be aligned.
Likely you're also displacing after the compute terrain which creates discrepancies when you use a surface layer for altitude restrictions as this only uses the texture coordinates provided by the preceding compute terrain. For accuracy the terrain would need te be recalculated again by a compute terrain and you would need to add your surface layer after that last compute terrain.
If you're not displacing after the compute terrain then you could have a too large patch size of the compute terrain, because the patch size provides a "resolution" for the calculation of coordinates (and also has this slight smoothing).
Lowering patch size may increase accuray, but would increase rendertimes.
If you use a distribution shader then instead and set altitude key to final position (the position at the end of the shader network) then you circumvent this issue as the final altitude key is calculated separately for this shader. I don't know how costly it is to use this.
Distribution shaders use position in texture as well, but also allows for "final position" which are the final displaced coordinates.
This would allow you to use an altitude setting according to the altitude coordinates at the end of your shader network.
These don't necessarily need to align with the displacements and is the reason why you often think a distribution shader works better.
Basically over larger areas the altitude key in a surface layer are correct, but dependant on compute terrain patch size.
At smaller scale the altitude key in a surface layer may not provide enough accuracy and distribution shaders might help because they recalculate Y at a different point.
However, if you stick at the "usual" workflow you wouldn't need this quickly except when you're working far from the origin or with waterbodies, because then "Y" and altitude can differ because of planet curvature.
So if you ever have troubles aligning altitude settings with your water level then use a distribution shader (as blendshader).
Cheers,
Martin