Change color of particles by distance from emitter


I am trying to create a static grass area with particles and I’ve been researching how to change the color of the particles depending how far are from the emitter, but I had no luck. Because I need the grass to look yellow in the far edges of the grass area.

If you can point me in the right direction or have some similar shaders I will really appreciate it.


PD: why I am doing grass with particles? Great question, I am experimenting in ways to make great performance grass area for Augmented Reality in mobile. If you know any other way, let me know!

not sure if this helps: Color of vertex based on player distance - Questions & Answers - Unity Discussions

also there is a way to fake these things. Amplify Impostors | Utilities Tools | Unity Asset Store allows hardware instancing which might help.

The only way to do this efficiently is to do it in the shader.
You would need to write a custom shader to do it. Then you take the distance from each vertex to the Transform center, remap it to 0-1, and use that to blend the color towards your yellow color.