I’m attempting to create a particle system for a sphere of stars, similar to the one found in this tutorial here:
The main difference is that I’m using VFX Graph instead of a simple particle system. I’m outputting quads with a custom transparent unlit shader graph.
In the tutorial, to get the stars to render behind everything else, he gets the ParticleSystemRenderer and sets the renderQueue of the sharedMaterial to RenderQueue.Background (at around 4:35). What’s the analog for VFX Graph? Simply put, how do I make a VFX graph render before (and thus behind) everything else?
So I didn’t take the time to fully dig into this , but from what I quickly get I’m not sure that you can render “Transparent” before opaque with SRP projects.
I will ask my colleague who knows better about SRP on this subject.
But you can “Trick” the depth of your Transparents particles in “Shader Graph”.
I’m not sure that it’s the ideal approach and I will try to come up with the most “performant”
way later on.
So:
Create a VFXGraph , make sure its transforms are reset (0,0,0) and attach it to the Camera.
In VFXGraph, set a Position with an ‘ArcSphere Block” to set the position on the surface of a Sphere.
Change the Spawn to “Single Burst” and choose your number of Stars.
Make sure that your “Capacity” is coherent with your Spawn Number.
Get rid of the Lifetime so that the Particles never die.
Add a “Set Size” and Randomize your “Stars” size
You should now see Particles on a Sphere:
Create a Shader Graph and turn on “support VFX graph” in the Graph Settings
Still in the “Graph Settings”-> “Surface Options” turn on the “Depth Offset”.
Now Set up your Shader Graph and “Expose” the needed property.
Apply you “Shader Graph” to your VFXGraph system.
You should now have Particles on a Sphere with a custom “Shader Graph” apply on them:
To finish you can Now play with the “Depth Offset” float to fake the “Depth” of your Particles.
By doing so you should have the effect you’re looking for.
Hello. I am using the latest avaliable LTS version of Unity (2021.3.13), and the Output Particle Quad node of VFXGraph has no “Shader Graph” field. Where I cna read some documentation about this version of Unity? When I check the docs on Google they all show things that are not available (the seems to be for Unity 2022.)