Download

Changing Materials to transparent and back again

Hi,

I am trying to set up a system where an actor becomes translucent when selected in “move mode”, then is restored to the previous state when the move is completed.
I have figured out how to get the actor and tell it to “go translucent” (happens in C++). The base blueprint that handles all the “thingys” in the game then walks it’s component tree, grabs the meshes, and gets/sets the material and changes everything to a translucent material. The problem is that restoring the original materials is not so clean since the Actor is composed of multiple sub parts and I need to restore them all to potentially different materials. And physics materials are in play as well (not sure if setting a material clears the physics material or not). I thought about writing the materials to an array, but can’t guarantee the order, etc… Is there a general approach that is used for this sort of thing? Am I coming at this the wrong way? I’d be happy taking the existing material and making it transparent, but it is not a Translucent material.
It’s a pretty common thing in games to make something see through while placing and then pop them solid when finished - that’s all I am trying to do.
Currently I am doing this in a blueprint as they seem to be easier to get to the component tree, but I can push it down into the base C++ class if that is easier. This is handled in a base blueprint so it handles this for all the derived objects (works fine for highlighting, etc.). It’s just the materials caching that is getting me stuck.
If it matters, the hierarchy is:
ThingyBluePrint->BaseThingyBlueprint->BaseThingyC++ → AActor → …Turtles here on out…

Any help would be appreciated,
Thanks

John

Could you create a boolean parameter called “transparent” that turns that part transparent or not, then create a instance, then make that instance dynamic and switch the boolean when you want to?

Thanks for the reply. The problem I have now is that the Materials are not Transparent, so I cannot adjust that. As for instanced, I think I need to explore that more as perhaps material instances might provide a solution but I am very unfamiliar with them.

You could create a different transparent material, and switch to it when appropriate. You’d probably need some particle effect to fire off at the right time, to hide the transition…

Perhaps the new Dithered Opacity Mask (introduced in 4.11) (see Release Announcement) can let you make a fake transparent material that you can activate as parameter of the same Opaque material.