Dynamically making static meshes semi-transparent

I’m creating a third-person camera game where the camera is freely rotatable by the player, and it’s quite zoomed out. My game is set in a city landscape with many tall buildings. I want the static mesh(es) that are blocking the player from view to become partially transparent such that the player can still see themselves.

My questions are mainly around the approach to making meshes transparent. I know that I can make the materials of the mesh use Translucent as the Blend Mode, and assign the Opacity value. Is this the high-level approach I should go for? Should I create a MaterialInstance that accepts opacity as a parameter, and dynamically update that parameter via code?

I’ve also read that blend mode: translucent affects performance - so it doesn’t seem like a good idea to have all of the static meshes in my scene render with blend mode translucent materials. Is it possible to dynamically change the blend mode of a material to make it translucent only when it needs to be? Failing that, can I dynamically swap the material for a mesh from an opaque blend mode to translucent when required? Can this be done without causing noticeable frame drops?

Alternatively, are there other (more performant) approaches to achieve what I desire, rather than using translucent materials?

Swapping the material is an option.

Another option is using a masked material

1 Like