Hi, I’m having some difficulties with the shader graph integration in the VFX graph while using the Universal Render Pipeline.
I have a shader graph with a vertex and fragment shader. The shader is set to target Universal, with “Support VFX Graph” toggled. From the documentation, this means I should have support for vertex shaders. There is an example in the VFX graph samples that has a working vertex shader in the VFX graph, though this is in HDRP, not URP.
In the VFX graph, I’m using this with a ‘render particle URP lit mesh’ node. When I add the shader graph to this node, the text at the top changes to ‘Output Particle Unlit Mesh’.
I’ve encountered a number of problems.
Firstly, although the shader is opaque, I must have alpha and alpha clip threshold alpha outputs, or the particle output does not compile. This is annoying but can be worked around.
Secondly, the vertex shader stage, which is applying a displacement effect, does not seem to be working at all. Particles are rendered as if they do not have a vertex shader.
Thirdly, while the fragment shader appears to run, the particle appears to have diffuse Lambertian lighting applied to it, even though the shader is supposed to be unlit. It is as if the output of the shader is treated as a URP base colour, and not the overall shader output.
(I also tried starting with ‘Output Particle Mesh’. This results in neither the fragment shader or vertex shader working, which is not surprising since I assume this output is for non-URP rendering.)
Here is an example. On the left is a regular GameObject with the shader graph applied, with vertex displacement and cel shading. On the right is a single particle with the same model output by the VFX graph.
The model on the right has additional lighting and no vertex shader.
Curiously, when I use the Output Mesh node, both the fragment and vertex shader appear to work correctly. Sadly, this output can’t be used to render particles, which is what I need.
I have experimented with various combinations of settings. For example, turning GPU instancing on or off. I have not yet found any combination of settings that gets the vertex shader to work, or the lighting to render unlit.
I believe this is a Unity bug, but if anyone has seen this behaviour before and knows a combination of settings that will make the particles render properly, I would be very grateful to know about it! Otherwise I’ll file a bug report.