PDA

View Full Version : Isometric "Diablo-Style" semi-transparency on meshes



vvolynine
04-17-2012, 09:06 PM
I have a question whether anyone has a suggestion on what is the best way to create an effect say... You go behind a wall (isometric-camera) and half the wall or the whole wall will go transparent so you are able to see your character. Something to the likes of that, basically. Thank you.

Acecutter69
04-17-2012, 09:55 PM
class TransWall extends actor;

var MaterialInstanceConstant Mat;

event postbeginplay()
{
Mat = mesh.getandcreatematerialinstance(0);
}

function SetTransparant(bool bTransparant)
{
if(bTransparant)
Mat.SetMaterialConstant(0.5);
else
Mat.SetMaterialConstant(1.0);
}

its all seudocode but its a jist of it. you would create a skeletalmesh for the wall, one bone is enough, create a material with a float parameter, link that to the opacity. You can use a physcis asset, or a copy of the mesh as a static mesh for collision. then do a trace beween the character and the cam, if it hits a transparant wall actor, use the function to set the proper opacity. Or you could just use 2 materials and swap between them but if you have 30 types of walls then it may be tedious, so making a material with the proper parameter can save you time, and the skeletal mesh is the only one that supports createing an instance of the matinstanceconstant as far as i know.

rquester
04-18-2012, 06:38 AM
vvolynine
You need a trace function (from camera position to the player's pawn) and if there is something on the way SetHidden it. You must have an array of the hidden elements to restore (unhidden) it too...

MonsOlympus
04-19-2012, 07:47 AM
If you want a special material modifier not just transparency I do suggest looking into material functions and making use of those to add your effect to all of your materials in a modular way :cool:

Acecutter69
04-20-2012, 11:42 AM
Set hidden will not render the object, transparant mode with 1 as your opacity renders it as opaque but 0.5 will get you something semi transparant while 0 will do full transparant, i was suggesting creating a material unstance to be able to change the material during runtime :D