Fix particle system with unlit mesh emitter
Currently, mesh particle emitters with lighting: false will not render in either WebGL2 or WebGPU. For a repro, look at https://playcanvas.vercel.app/#/graphics/particles-mesh and toggle the lighting option.
I think the main issue is that we are using the NORMAL define as a proxy for whether to use lighting, but in the case of an unlit mesh we do want mesh normals, we just don't want that mesh to be shaded.
This PR restores rendering for unlit mesh emitters by:
- Setting NORMAL=VERTEX if the emitter is a mesh and no normalMap is provided (otherwise, NORMAL=NONE).
- Passing in LIGHTING as a separate define, and disabling the shading if it's not defined.
Try the latest preview deployment on this PR and you will see that now, on the particles-mesh example, particles are still rendered when lighting is off. We can also see that the shading on those particles is flat. If you reduce the directional light intensity to 0.01 in this scene, you will see that the particles are not affected by the light when lighting is off.
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.
but in the case of an unlit mesh we do want mesh normals, we just don't want that mesh to be shaded
I have not checked in detail, but is particle shader using normals for any other reason?
Anything left preventing this from being merged?