Nov 13, 2017

Custom data computed per-vertex - Unity Shader Bug fix

On Unity's web site (https://docs.unity3d.com/2017.3/Documentation/Manual/SL-SurfaceShaderExamples.html), Custom data computed per-vertex Shader has a bug, when I try the shader I get correct result in Scene view but not int Game view.


The fix is normalizing the normals.Just add normalize.

void vert (inout appdata_full v, out Input o) {
            UNITY_INITIALIZE_OUTPUT(Input,o);
            o.customColor = normalize(abs(v.normal));

}

Then correct result is:

 

No comments:

Post a Comment

Visual Studio Keyboard Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using the mouse again and again while programming with visu...