I’ve finally got simple Phong Directional lighting working with the Superformula 2D-3D shader.
Not sure what I was doing wrong last time I tried this. The best approach seems to be to ignore the HLSL lighting code, and write that stuff from scratch in GLSL. The normal calculation code seems to work in this shader, which leads me to suspect maybe I was going wrong somewhere else when I tried this last time.
I’m not entirely convinced this particular shader looks better ‘lit’ than with the fake lighting code I was using before. Certainly, the places where the mesh cuts through itself look much glitchier (and not in a nice way) once directional lighting has been applied. Some of the simpler surfaces may look better though.
Next task is maybe to try and get lighting working in one of the Maths Surfaces shaders. Then I can decide if it’s worth converting the whole set (a long and tedious job, I suspect, given there are 50+ of them).