Particles receiving shadows?

Does anyone know if it’s possible for vertex lit particles to be affected by shadows generated by geometry? I made a small demo testing the functionality of vertex lit particles

Unfortunately while I could get the particles to project shadows onto the two surfaces the opposite was not true.


Vertex lighting does not support receiving shadows; you need per-pixel lighting for that.

Give this a try?

Thanks! :stuck_out_tongue: I’ll use this as soon as I can read through it and figure out how it works :wink:

It’s a bit flakey (which is why it’s a secret, rather than public gist). But it should help.

This looks really interesting Farfarer (sorry it’s been so long since you posted) but how could I get it working with multi_compile_fwdadd_fullshadows in the ForwardAdd pass for spotlight shadows?
It says: “Custom/Lit Particle Additive’: Program ‘vert’, unable to find compatible overloaded function “mul(float4x4[4], float4)” at line 116”
but still renders ok. That line is TRANSFER_VERTEX_TO_FRAGMENT_PARTICLE(o); which expands to
#define TRANSFER_VERTEX_TO_FRAGMENT_PARTICLE(a) a._LightCoord = mul(_LightMatrix0, posW); TRANSFER_SHADOW_PARTICLE(a)

Currently the particles seem to be evaluating the shadow map in camera space or something - I have to zoom out and rotate around for any light to show up - certainly they don’t respond as if they are in world space. I’d really appreciate some help, you’ve done a lot for my shader education already!

Never mind, I got it working (using my own shadow maps rather than Unity’s) - I didn’t realise the shuriken particles were in camera space, so you can multiply them by the camera to world matrix to get them in world space. Thanks!