Fading room walls in a 2.5D perspective when player enters the room

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Deith

I’m trying to achieve an effect where after player enters a building/room, the front wall fades away so we can see what’s inside. It seems like a pretty easy solution for distance fade but it fades based on current camera (already tried attaching fake camera on top of the player to fake distance). The main issue is that the perspective is always from the side like in a 2.5D platformer, except player can also move a bit in Z-axis.

So far I have a collider that checks if we entered the room and switches distance fade on when player is in it so it doesn’t fade when we’re outside the building. But since it’s based on camera distance, when player gets to close to the front wall, camera moves away and the wall appears again. I could just lock the camera on Z axis and keep the collider, but it means that when player activates it, the wall just disappears since it would be 0 or 1, since camera doesn’t actually close in so it doesn’t distance fade.

I recorded what it looks like right now which is not much, but you can see the distance-fade suddenly popping when entering from the side. And the wall appearing when getting to close to the wall. The problem I’m trying to solve is just fading away the front of the building so we can see inside but I don’t know enough about shaders or 3D in godot to even know where to start looking for solution.

:bust_in_silhouette: Reply From: Deith

It was actually really simple. I just didn’t notice the transparent flag in material options. Without it on, the alpha change on material doesn’t do anything. So now with the flag enabled on elements I want to fade, I just change the alpha if player enters collider box inside the room which makes things fade while inside it.