hi there,
i would just like to show the shader i am working on right now which is a terrain shader that will allow you to add decals to the built in terrain without adding any geometry nor forcing any additional draw call nor shader pass: it is just a single pass shader which will allow you to use 4 detail splats + 4 detail normal splats and 4 (or even 9) additional detail decals (normal mapped) blended in according to height.
the shader will cost only 3 additional textures being passed to it: 1 diffuse map atlas, 1 normal map atlas, 1 splatmap, so it works well within the sm 3.0 boundaries (which is 16 texture samplers – currently used like: 1 splatmap, 4 diffuse texures, 4 normal maps, 2 lightmaps).
i am not sure whether it will support perfectly tiling detail decals as the only way i have found to incorporate these is using the “tex2Dlod” command – it gives you perfectly tiling textures but does not support anisotropic filtering.
so i am thinking about not supporting continuous tiling textures but just single decals using the standard “tex2D” command.
this is what i have right now:
image 01: comparision of using tex2dlod and tex2d
in a still image even using “tex2Dlod” looks good, but moving around the terrain will produce some rather strange artifacts.
image 02: texture atlas used for the decals
image 03: texture atlas anisotropic filtered but not allowing to use continuously tiling textures in order to hide seams. well – of course this is not what i wanted to archive but in the other hand: hey, those are just decals! just think of some smaller stones here and there, some dry twigs or blossoms…
performance
my first tests look quite promising:
– using the standard terrain shader with the given terrain (size: 1000 x 200 x 1000 m, heightmap resolution: 1025, pixel error: 5) which does not support any bump mapping at all, using 4 splat maps will cost 0,31 ms in deferred rendering.
– using the standard terrain shader with the given terrain, which does not support any bumpmapping at all, using 8 splat maps will cost 0,4 ms in deferred rendering.
– using the modified terrain shader with the given terrain (4 detail splats + 4 normal maps + 4 terrain decals icliding their normal maps) will cost 0,31 ms in deferred rendering.
(mac book pro, nvidia geforce 9400M)
and now?
well – i would really like to get some feedback: is a decal shader interesting to you – even if it does not support seamlessly tiling textures?
do you have any other idea?
lars