I want to recreate these rings circling around the ray core.
I was told that it is somehow possible to access the remaining lifetime of a spawned particle through the shader. Which is what I am trying to do now. But I can’t find any clues to start.
The worst thing is that it seems so basic that it should be easily doable.
One post I found said that it’s not possible to do that within Shader forge but I can’t imagine that to be the case.
In summary, I need a way to tell the shader to animate according to the lifetime it has left.
So that every instance of the particle would behave differently based on its individual lifetime given by the system.
Anyone got a clue?
You will need to make sure that the info you want (particle life, normalised I assume) is part of the particle data stream that you select for this material / shader / particle effect.
You can add data to those using custom data streams or select from existing ones.
Usually that in turns connect to variables in the shader code.
Here’s the info about datat streams : Unity - Manual: Particle System vertex streams and Standard Shader support
I am not sure how shader forge get that support but I have a feeling that if the variable names match you may be able to connect them.
You need to turn on custom vertex streams in the particle systems renderer section, that will expand a list that shows you the default streams. Click the little plus button at the bottom right of the list and, in your case, choose Lifetime > Age Percent to add it it to the list of streams.
Look at the entry in the list and you’ll see it says Age Percent (TEXCOORD0.z). That value will be readable in shaderforge via the z value of a UV Coords node, make sure it’s looking at UV 0 ( I think that will be the default ). It’ll output a value in the 0-1 range.
I use Amplify Shader Editor and have to increase theUV Coords Coord Size to float3 from the default float2 to access the z property, there might be something similar in Shaderforge but it’s been a long time since I’ve used it…
There’s loads of cool stuff you can do with custom stream, so play around with some different ones. Hope that helped!
This right here.
That was it.
Add Lifetime to Custom Vertex Streams and add it to the panner node.
This will sadly slow down the panner. You will have to manually create a panner and add adjustable scrolling speed to balance out the slow down. Don’t know if thats the ideal way but it works.