Blillboard shader: error in normals

Hello,
I am doing a billboard shader graph, and I got it to work… mostly.


The geometry part is working perfectly, but the light is not. The intended behaviour is that the light continues to behave as normal, taking the scene lights settings and transforms.


I am assuming that the “Vertex Normal” and “Vertex Tangent” options need the same transform as the “Vertex Position” (since in previous versions of the Shader Graph only had one “Position” output)

What I am doing wrong here?

Hi! Yes, you are right that the Vertex Normal and Vertex Tangent need to be transformed since you have modified where the Vertex Position is. The good news is that you have already done most of the heavy lifting. Since this is on a quad, we know the vertex normal easily - the quad is facing directly towards the camera, so the normal is the calculated camera view direction negation. That just leaves the tangent vector, which is again easy since this is a quad and you already calculated it as part of the rotation matrix construction - its the x axis.
So I believe plugging in your z axis as the normal and x axis as the tangent should fix the lighting issue, but I would need to sit down and verify my flu-ridden head math to be sure

I works! Thank you very much.
I still wonder why connecting the same ouput for the Normal and Tanget doesn’t work, if the transform they suffer is equal to the Position, but for now, It works for me.

They do use the same transform, but they dont use the same values. You apply the matrix transform to the position and plug it into the graph as the new position - similarly, you would have to transform the normal and tangent vectors as the new normal and tangents. Plugging in a position as a normal is going to give wacky results.

Oh, sure, looks really obvious right now

Happens to the best of us :wink: