#Game Object with multiple meshes -> fade out

1 messages · Page 1 of 1 (latest)

timber vault
#

peepoG
I have a Rocket Tank game object that consists of 4 children game objects.

I need to fade out the entire tank when it's too close to camera.
All the logic has been implemented and works fine.

The problem is the Rendering Modes

If I set it to Opaque, I cannot modify Alpha channel to make it transparent.
If I set it to Transparent, I have each individual mesh trying to overlap each other even at Alpha = 255, see screenshot. **Fade **mode gives a similar outcome.
Changing render order/queue only changes the order in which they inevitably overlap each other. Joining meshes is not an option.

I figured I could change the Rendering Mode in real-time to Transparency and back to Opaque using Shader Graph and a bit of code.
Is it ever a good idea though? Hmmmge

Or should I have two separate materials and switch between them?

UPD: looking at Material Variants peepoG

wide sparrow
#

You could keep you shaders opaque and use a dither texture to alpha clip as you get closer.

subtle field
#

Opaque dithered indeed is probably the easiest (and most performant), and can be smoothed out with TAA but in both cases it will have an unique look to it

subtle field
# timber vault <:peepoG:1171254688428064858> I have a Rocket Tank game object that consists of...

This always happens with transparent geometry because they sorted by object position relative to each other, and by vertex index relative to themselves
There's the empty pass #archived-shaders message method that can be used to clear any transparent geometry before rendering the current one
Or alternatively you'd look into some implementation of Order Independent Transparency
https://github.com/happy-turtle/oit-unity

timber vault
#

I went for the dithering option. thanks! I can now see what Elden Ring did there which is kinda funny. (and many other games)
I'll save that Order Independent Transparency solution for later though peepoG