- Home /
Terrain surfaceshader, or terrain shader supporting multiple lights - need example
mirror of https://forum.unity.com/threads/terrain-shader-surface-shader.615889/
I'm having trouble figuring out how to get a surface shader with access to the splatmaps and supporting multiple lights. Does anyone know of relevant documentation or examples?
The only examples I've seen so far require:
-My current situation of not using a surface shader, manually copypasting from the terraincommon include, and only supporting 1 light
-Manually making a whole separate pass for ForwardAdd, which due to the length of my shader is quite prohibitive, since afaik it would require copypasting my light and noise functions, doubling the length of the shader, and making it horrible to maintain.
I would like a way to either:
-Access multiple pixel-light uniforms within a single pass. Since the cost of my lighting functions is minor compared to the noise calculations I'm doing.
-Access terrain splatmap values from a surface shader, since that takes care of all the hassle of multiple lights/passes.
Heres the source if it helps, my failed attempt at getting a surfaceshader, but this is more of a general issue of how to use a surfaceshader with terrain. https://gist.github.com/khlorghaal/e4d3aaa1d07232d3f67f2e938edd4ec7
Your answer
![](https://koobas.hobune.stream/wayback/20220612190201im_/https://answers.unity.com/themes/thub/images/avi.jpg)