Updated the procedural rock and awesome shader to create bumps on the rock and now finally it looks great.
The inspiration for this all was the opengl shader fromÂ Cave3d, a very inspirational google project that shows some fantastic graphics.
The porting to HLSL and the triplanar blending went well but the lighting and specularity were wrong (Due to wrong normals and blending problems).
Then I looked at theÂ Cascades sampleÂ and looked at the triplanar texturing part. After that I had some specular artifacts (extreme white dots and flickering) and it looked just plain horrible.
But finally the last piece of the puzzle was found onÂ Petrocket blogÂ that used 6 texture samples to create the bump vector.
The shader onÂ PetrocketÂ calculates the normals in world-space but while that is good for static objects, this is not good for moving rocks (world transformed).
So I calculate the UV’s in object space and also the normals!!! With the increased sampling the normal vector is now reliable enough to give correct lighting and specularity.
I switched back to Lambert shading because this gives the best results (this was also used in theÂ Cave3dÂ shader.
Here are some pictures that speak for themselves:
You can see the triplanar blending if I render with RED, GREEN and BLUE components: