0
Wird überprüft

Vertex Offset Particles Issue

Graham Bailey vor 10 Jahren aktualisiert vor 9 Jahren 3
While using the spherical world technique I encountered a problem. Everything works as expected up until I try using the shader with a particle system. In the example I use the same material and shader on both the scene objects and the particle system.

As you can see, the particle system should follow the curvature and keep a proper position in world space as it does in the hand written coded version. When using the Shader Forge version, the particle system is nowhere near where it should be, if I were to zoom in the particles would completely disappear into the distance. Any idea what is going wrong in this shader tree?

Note: The code example image is not from SF, it is the hand coded version in which particles follow correctly.
Wird überprüft
I've never actually looked into doing proper particle shaders. What's the main difference? You do the model/view matrix transformation, and then not do the projection matrix transformation until after the vertex offset?
Unfortunately I don't know what the difference is when doing particle shaders, I presumed they wouldn't be very different when I started. The code sample is something I found on the unity forums, I don't know exactly how it works. I have been fiddling with this tree for a while now and still no luck.
So since SF has been updated with the Matrix node, I've tried a few more things. The changes I've made in the image show a much closer result to what I'm looking for, however something is still off. Maybe you can see how I could change this?

I put the following script on my camera to get the particle's "camera space" back into world space:


And then I reference that "_Camera2World" Matrix in the shader: