+7
Under review

Custom Particles Shader / Vertex Lighting

Tyler Owen 11 years ago updated by Conor O'Kane 9 years ago 14
I've nearly got a custom particle shader setup the way I need it to be, but currently the lighting on the particles gets really screwy. For example, pointing a spot light from the first person camera (effectively a flashlight) causes strange errors with the spotlight cookie when pointed at the particles. In this screenshot you can see the outline of the cookie texture overlaid onto the particles. Would a vertex lighting option fix this? Is Shader Forge unable to currently create replacement particle shaders?
How does your node tree look?
Having the Vertex Color node linked in allowed the shader to work correctly with the color options in Shuriken, but the lighting just isn't right.
Just checking to see if this is something you've had a chance to investigate or not. I'm sure you've got plenty of other features higher on your priority list, but this one's pretty important to me.
Seems like particles have a very different way of calculating its position, the light positions seem to be in an entirely different space. 
Yeah, the only default shader for particles that seems to accept lighting is the Particles/VertexLit shader. Perhaps you could point me in the right direction on how to recreate the vertex lighting seen in that default shader?
+1
Just checking in here to see if anything has been uncovered about custom particle shaders. Having a vertex lit particle shader with depth blending would be extremely valuable to my project.
+1
I also have an issue with custom particle shaders being unaffected by the distance/object position/world position nodes. I think this may be related to what you mentioned earlier with the difference in calculating position.
Same problem here as Robert. Distance and postion don't work correctly on particles.
Bumped. I have some particle shading code bookmarked and I will post the link here tomorrow.
I made a shader like Smokes in The Division Trailer ! It's Nice in Object but not works on Particles !
As promised (sorry, took me a little longer):
https://gist.github.com/Farfarer/158b23f694c2c995f...

This is some code from Farfarer who claims to have lit particles going.
Originates from this thread:
http://forum.unity3d.com/threads/175273-deferred-r...

I didn't have the time to take a closer look at this stuff - but maybe it points in the right direction for integrating a "make this a particle shader - switch" inside SF.
+1
This script and shader requires Shader.SetGlobalMatrix on the camera - however ShaderForge doesn't currently support Matrices as an input type. Can you please add a matrix input type, and matrix multiplication so that Shader.SetGlobalMatrix can be used with ShaderForge.

It would be really great to have a ShaderForge solution to particle lighting.