So I’m trying to created weapon enchantment glows with a particle system but when I render these out it renders the mesh over the particle system. However in the editor it renders them just fine. Any ideas how I can get it to render as appears in the editor?
[I’m still learning from tutorials and am relatively new to the world of FX so critiques and tips on how I can do this better would be highly appreciated too. The reason this isn’t in WIP section is because I have issues with the rendering.]
It looks like the links you’ve pasted are links to the full giphy browser, as opposed to the individual gif. If you right click on the gif and choose “Copy Image Adddress” then past that in, it should work (Chrome)
How are you getting them to render over the weapons to begin with? Unity’s particle shaders don’t by default have any offset in them, so what you see in the game view is more what I would expect to see, so I would need to know more about the shaders and particle systems you’re using.
I’ve just created a new particle system and dragged the textures created onto them. I then used shuriken to tweak the parameters. So I haven’t created any new materials / shaders. Just using the default particle additive shader and material that’s created when I drag my texture onto the particle system. Any way I can see this in more detail so I can give you more info?
Could be a script is changing the render queue of the weapons at runtime to render in front of the particles.
Less likely is a shader difference, for example shader variant, at runtime.
Try putting a default cube in place of the weapons with a default shader to test if the problem is the weapon shader.
Tried using default cube with default standard shader (turned it green because easier to see than default white, that’s the only change I made). Same result. Cube renders ahead of said particles in render but works fine inside of editor.
Is it because I’m using 2D sprites and the meshes are non sprite 3D meshes? Within the sprites themselves I’m able to apply different levels of sorting (which renders above which) but is there a way I can do that render queue you mentioned for these? Somebody suggested I try using Flare on shader that would always put it above the mesh but that gave me really weird results on render.
Hey man in my last university project I had same problem but I’m trying to remeber how I solved it. Before I hop in unity I would like to ask you, do you place your emmiter inside your 3d mesh? Might be that, if you place the emmiter before between the mesh and cammera it would work . the second i look in unity i will Update you!
Under the renderer tab of the particle system, you will see a drop down for sorting layer. Click on that and choose new layer. Make a new sorting layer, call it foreground or similar. Open the particle system again and choose your new foreground layer.
Thank Ryan. I used sorting layers and they’re helpful for getting different components of the particles system render in order like glow, vs smoke vs aura vs sparks vs lightning. I can adjust each one’s rendering order what overlaps the other, however since my 3D mesh isn’t a sprite the sorting layers have no effects on it at all. The mesh always renders over my particles.
Here’s an example of sorting layers I’ve used renders the correct things in order but the moment I apply a mesh it renders the mesh over it.
well if you use FBX file , my best guess is that your object use the “standard” material (with all the applied textures).
since the unity engine doesn’t recognize any other materials but its own
so, if that is the actual case (and let say you don’t have ShaderForge).
so small guide:
when you select the material you will see in the Inspector the small “chain wheel icon”, click it and go to “edit shader”
the “render queue” will say 2000.
if you do the same with Particle/Additive you will see 3000.
so based on the link I posted before, you can learn that your particles will always be rendered first and be hidden behind your standard material, Therefore you need to change that settings in side the “Compile and show code”.
*follow the instruction in the link and you will be fine. don’t be scared to try many times until it gives you the result.
I would be happy to read if there another approach
EDIT: in ShaderForge you don’t need to mess with the code, you need to of course replicate your standard shader (not should be hard) and on the left side under the rendering order settings you can change manually the number (put in mind that the higher number means → further → renders first)
Awesome, so this kind of worked but at the same time didn’t. 2 steps ahead one step back.
I used a combination of Ohadgfx and RyanB’s methods. Thanks guys.
So I went ahead and remade the shader right, like plugged in my texture2d node into diffuse and made it an additive blend mode I used shader forge to make my mesh render queue to 2000 and my particle render queue to 3000 and that seemed to solve the problem of render overlay but… it messed up my particle emitter. Did I do something wrong? Maybe my shader is incorrect? Or do I have to redo my particle emitter again?
Never used materials this way, I always work with plain textures dragged in default what unity creates and have never had issues with rendering order.
So I seemed to have “solved” the issue after spending hours trying to code, render queue, z order, shaderforge and everything else I could possibly imagine breaking my head around it. And finally it came down to something extremely simple. All I needed to do was change the particle shader type from Particles>Additive to Mobile>Particles>Additive.
I have no idea how or why this worked and would be glad to know if someone more skilled could explain this to me ( unity forums say its something to do with soften particles not working in small scale so you should use mobile for smaller particle FX?? ), but I’ve left this as a solution if people in the future face the same issue as I did.
New renders with correct rendering orders:
Thanks to all who helped me! I’m really thrilled that this community exists!!!
Well I thought I had solved it haha, but I guess I haven’t yet. Still a beginner at this so I’d definitely like help if you’ve got the time I’ll send you a PM soon. Thanks for the clarification Ohadgfx and RyanB. I’ll leave this topic marked solved though I don’t continue spamming it and will post the solution once I’ve figured it out. I bet its something simple. But you live and you learn lol.