Quantcast
Channel: Questions in topic: "hlsl"
Viewing all articles
Browse latest Browse all 206

fragment shader different color for every vertex?

$
0
0
can i make different colors fore every instance of this shader? do i have to send instance to o.output or something? how can i do it? StructuredBuffer buf_Points; StructuredBuffer buf_Positions; struct ps_input { float4 pos : SV_POSITION; }; ps_input vert (uint id : SV_VertexID, uint inst : SV_InstanceID) { ps_input o; float3 worldPos = buf_Points[id] + buf_Positions[inst]; o.pos = mul (UNITY_MATRIX_VP, float4(worldPos,1.0f)); return o; } float4 frag (ps_input i) : COLOR { return float4(1,0.5f,0.0f,1); } ENDCG

Viewing all articles
Browse latest Browse all 206

Trending Articles



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