No announcement yet.

How to check if mesh is transparent

  • Filter
  • Time
  • Show
Clear All
new posts

    How to check if mesh is transparent

    Hello everyone!

    I'm making a Top Down game with Fog of War in blueprints. I just got the FoW working with a plugin, as you can see in the image below. A Render Target contains visibility data (top right corner), which is projected to the map via post process material.

    I've made it so that the material of the enemies checks the same visibility texture and uses the pixel corresponding to their location as the opacity value of the material, which is why enemy 2 is visible and enemy 1 isn't (the material is transparent). The axe is not using the same material, hence it is visible.

    The problem I now face is that I'm trying to make the health bar (a widget component of the actors) also invisible if the mesh is transparent. Linetracing a transparent mesh returns a hit, and getting opacity from a material doesn't seem easily achievable, so I'm out of ideas.

    Does anyone have an idea of how to accomplish this? How do I check if a material is transparent or not? Or how would you go about this? Thanks!

    Click image for larger version

Name:	fogofwar.png
Views:	29
Size:	722.8 KB
ID:	1795859