- Home /
Understanding normals in surface shaders.
I have some billboards (spherical) on a terrain (not using Unity terrain) that I would like to be able to set a value for the normal in world space on in the shader.
To start with I'd like my billboards to be lit using the world up vector. The following works ok as long as the billboard doesn't pitch (like a cylindrical billboard):
void surf (Input IN, inout SurfaceOutput o) {
o.Normal = half3(0.0, 1.0, 0.0);
o.Albedo = o.Normal; // debug visualization
}
However when you get close to the billboard it will pitch and then it will no longer be lit with the normal pointing up. It seemed like the solution would be set the normal in object space so that when the rotation is applied it be pointing up again. I've tried multiplying by _World2Object to no avail.
My questions:
How can I force the normal to always use world space up?
What space is SurfaceOutput.Normal supposed to be in?
Did you ever work this out? I'm trying to do something similar for foilage and can't find any solutions
Your answer
Follow this Question
Related Questions
What does it require in Unity to create a simplistic and stylized art style? 1 Answer
Implement Physically Based Shading into CGProgram 0 Answers
Semitransparent shader not visible in front of objects 1 Answer
Implementing Custom Vertex Lighting Shader 1 Answer
transparent/cutout/soft edge not changing to the directional light. How do i do that? 1 Answer