Infinite Procedural Terrain Engine

Here is an example GC shader:
https://github.com/Craig-Macomber/Panda3D-Terrain-System/blob/master/geoClip.sha
A bit more complex on is here:
https://github.com/Craig-Macomber/Panda3D-Terrain-System/blob/master/geoClipGrass.sha

Those pass heights and normals from the vshader to the fshader.

You should only use standard semantics, and for uniforms that are given names via set shader input methods don’t need them.

Also, you don’t want to use if statements if you can avoid it. Conditionals are generally slow for shaders.

You might find the lerp function handy. I don’t see you using it anywhere, its the common way to smoothly interpolate between different colors/positions etc. http://http.developer.nvidia.com/CgTutorial/cg_tutorial_appendix_e.html )

I’ve never worked with structs in shaders. I never needed them, so I don’t really know how they work. Seemed like needless complexity to me.

I learned shaders mostly by guess and check. I know pretty much only one way to do them with a minimal feature set.