Transparency of the wall

Hello. In my third-person game, I want to implement transparent walls when the character is blocked by a wall. The option with the transparency of the material is not suitable, because the material is the same for the entire level, and the entire level becomes transparent. I think there should be an option to make a small transparent piece of the wall, cut by mask. Are there any examples of such implementations?

Hi @sergey_ch,

To use a texture mask to mark certain parts of your level as transparent is doable, but you will need to write a custom shader. I don’t have a recent example in mind sadly, only this older tutorial of mine, it uses masks for a similar purpose:

Another, simpler way, would be to update your model to use a separate material for your transparent surfaces.

4 Likes

Judging from your post, you have an atlas map for the entire map.
This could be an issue because even if you detect the tileable pieces of the wall with collision/trigger, and try to apply the mask with a custom shader on them if all walls share the same part of UV, all walls would be transparent.

You gave us little data, but this could be done when you detect which walls need to be changed, apply a different material to the objects, with opacity already applied on.
I think it’s going to be a performance problem if you have a large atlas map, but if the image is square you can use the Play canvas compression tool which is great, in order to reduce the size

These links could be helpful to your project :

https://developer.playcanvas.com/en/tutorials/switching-materials-at-runtime/
https://developer.playcanvas.com/en/tutorials/fading-objects-in-and-out/

I wonder if you can do a cheat with the rendering layers :thinking:

Do you have an image or video of a similar effect that we can use as a base?

1 Like