- Home /
the input value for geometryshader
I'm trying to write a shader to get the wireframe without diagonal of model . I use lineadj as the value for input and hope to get four point to check it is a diagonal or not. However the point p[3](the fourth point) is always zero and when i draw it in my screen ,it stays at the center of my screen. Is the point data is right or I get some wrong code in my shader [maxvertexcount(12)] void geom(lineadj v2g p[4], inout LineStream<g2f> lineStream) { // float4x4 vp = UnityObjectToClipPos(unity_WorldToObject); float4 pos0 = mul(unity_ObjectToWorld, p[0].pos); float4 pos1 = mul(unity_ObjectToWorld, p[1].pos); float4 pos2 = mul(unity_ObjectToWorld ,p[2].pos); float4 pos3 = mul(unity_ObjectToWorld ,p[3].pos); g2f pIn0; pIn0.pos =mul(UNITY_MATRIX_VP, pos0); pIn0.col = float4(0,0,0,1); g2f pIn1; pIn1.pos = mul(UNITY_MATRIX_VP, pos1); pIn1.col = float4(1,0,0,1); g2f pIn2; pIn2.pos = mul(UNITY_MATRIX_VP, pos2)}; pIn2.col = float4(0,1,0,1); g2f pIn3; pIn3.pos = mul(UNITY_MATRIX_VP, pos3); pIn3.col = float4(0,0,1,1); lineStream.Append(pIn0); lineStream.Append(pIn2); lineStream.RestartStrip(); lineStream.Append(pIn1); lineStream.Append(pIn2); lineStream.RestartStrip(); lineStream.Append(pIn0); lineStream.Append(pIn3); lineStream.RestartStrip(); }
Answer by The-White-Guardian · Apr 23, 2021 at 02:58 PM
Four years late, might as well add an answer. The problem isn't really your code, I'm getting the same issue, lineadj isn't working properly.
And that's because the team at Unity never implemented functionality for it. We're sadly not the only people getting this issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220612131728im_/https://answers.unity.com/themes/thub/images/avi.jpg)