Quantcast
Channel: Answers for "Changing the vertex color by script"
Viewing all articles
Browse latest Browse all 4

Answer by whydoidoit

$
0
0
The shader you posted does not read a vertex colour or pass a colour from the vertex to the fragment... struct vertexInput { half4 vertex : POSITION; half3 normal : NORMAL; half4 texcoord : TEXCOORD0; half4 tangent : TANGENT; half4 color : COLOR; //Add this }; struct vertexOutput { half4 pos : SV_POSITION; half4 tex : TEXCOORD0; half4 color : TEXCOORD6; //Add this fixed4 lightDirection : TEXCOORD1; fixed3 viewDirection : TEXCOORD2; fixed3 normalWorld : TEXCOORD3; fixed3 tangentWorld : TEXCOORD4; fixed3 binormalWorld : TEXCOORD5; }; Then you need to assign the colour to the output in the Vertex shader: o.color = v.color; And return it multiplied by your calculations in the Fragment shader: return fixed4( lightFinal * _Color.rgb * i.color.rgb, 1.0 );

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>