Yet another mediocre shader programmer trying out shader graph and getting confused so apologies if this is mistaken.
I think it’s impossible to regenerate normals in the current (2019.2.8f1) version of Shader Graph (6.9.1) at least in LWRP.

I’m doing the usual low-poly water (which I’ve done using surface shaders with vertex code before). I’m using some time-based noise in the graph (executed in the vertex code) to push the vertices along their normals (or Y-up). I’m going for ‘lit low-poly’ so I then want to regenerate the normals (rather than colouring myself). I use the usual normalize(cross(ddx(posWorld),ddy(posWorld))) in the graph (executed in the fragment shader) and, since PBR shader requires tangent-space normals, I use a Transform` node to convert it. (for curiousity, here’s the project I’m trying to convert while it’s still using legacy shader – you see the aesthetic difference here!)
All sound fair?
The problem is that I can see no observable change in the normals in the Game View.
I checked the generated code and found that the generated vertex code calculates the WorldSpace(Position|Normal|Tangent|BiTangent|ViewDirection) which it passes to the graph logic (in a function called PopulateVertexData()) then copies the returned Position into the GraphVertexInput but copies the original WorldSpacePosition etc to the GraphVertexOutput – the thing the fragment shader part of the graph/code gets to use. I even tried using Object space (rather than World space) in the normal calculation but the generated code is actually still using the same World space value but converting it back into Object space!
What does this mean? Well, since those values ignore the graph’s changes to the position, the fragment shader sees the original values of the position so generates the original normal = (0,1,0)!
My next step to confirm this is copying the generated code and seeing if I can correct it and have it work correctly. Of course I recognise that I might need to do the same things to the Transform matrix since it is also using the unmodified position. What I’m not sure is whether it’ll matter if I use the unmofidied tangent, bitangent etc – my maths starts getting mighty rusty at this level!
If you see any problems with my analysis, conclusions or plan, … well, anything really, I’d love to hear. Hopefully someone will point me to a simple “oh you need to tick this box and it’ll all work” feature I’ve missed
I’ve read several posts from @bgolus explaining things around this subject including one that shows it working making me think this might be a regression?
Thanks in advance for any thoughts / hints !
p.s. graph attached as .txt since Forum doesn’t allow .shadergraph yet!
5053265–495854–Water-LowPoly-Simple-LWRP-Graph.shadergraph.txt (72.6 KB)







