Everything is working perfectly… until… fog is enabled.
Window/Rendering/Lighting/Environment:
Now transparency starts to look a little wonky…
I tried messing around with many different settings in the Lighting dialog, the ForwardRenderer scriptable object, the URP scriptable objects, Graphics settings, Player settings, the shader settings in the Inspector, and even swapping shaders. I guess I haven’t hit upon the right combination yet.
The closest I’ve come is when the particle systems had the same problem (semi-transparent squares when fog is enabled), and I was able to fix those by changing their shader from URP/Unlit to URP/Particles/Unlit. Naturally, I tried changing the muzzle flash shader to URP/Particles/Unlit as well, but the result is that the muzzle flash disappears from the scene.
I’m not sure if it’s relevant, but I’m using Hybrid Renderer V2.
I did some googling, and it seemed like a few people were having the problem in shaders that they were writing. I’m crossing my fingers and hoping that this can be solved without writing a custom shader…
It’s probably something obvious… What am I missing?
I might have run into this as well for my billboards (and I use hybrid too) I seem to remember solving it by enabling both alpha and alpha clip, and setting alpha clip to 0.1. That worked for me, might not work for you.
I tried alpha clipping before, but it seemed like not matter what value I use it doesn’t affect anything. I tested with an alpha clip of 0.1 just now, but that didn’t do anything. I tried setting “Blending Mode” to “Alpha” but that removes the transparency and produces a black background.
I think the Alpha Clipping is bugged. If I drag the slider back and forth a few times and let go of the slider after each drag, the mesh just disappears completely from view. Even in play mode - it’s just gone. The only way to get it back is to switch to a different shader and then back again.
you need to enable the alpha channel on the texture and you need fade it on the edges of the flash
otherwise fog will be rendererd on the black texture
I wasn’t sure what you meant by “fade it on the edges of the flash”. However, your post inspired me to play around with some settings and I found something that works!
The trick was… I selected the tga file in the Project tab.
.
Then in the inspector I set “Alpha Source” to “From Gray Scale”
That From-Gray-Scale settings was the “secret sauce” that made it all work! Before I did that, changing the alpha clipping did nothing. So with that done, we can now tweak the alpha-clipping by selecting the material and setting the alpha clipping via the inspector window.
As the slider is dragged, we can see it adjust the red outline around the object in the scene view.
And now…transparent objects working with fog in URP!!
What I meant is you don’t actually need to set alpha clipping, alpha from gray scale is a quick fix but not the real fix.
I don’t know if this is a bug with blending, I would imagine that if I set blending to additive I don’t need the alpha channel which is probably used by the fog.
I’ve definitely been setting “Blending Mode” to “Additive” the whole time, but the only thing that has worked so far is the “From Gray Scale” solution I posted above.
Maybe it’s a setting in the Lighting or Scene or Environment window?? Here’s what I have: