Help with glass color in ViewportFrame

I made something to test highlighting player’s behind walls using ViewportFrame Masking, but found that the color of the glass required for the effect to work always used the background color of the ViewportFrame at low transparency. At high transparency the part color is used, but the player’s highlight is barely visible. At ~0.5 transparency the highlight still gets obscured by the part color, albeit not by much.

I found this post that was last replied to a year ago but it doesn’t seem like it was ever resolved:

0.1 Transparency Glass:
image

0.9 Transparency Glass (part color visible but highlight barely visible):
image

Putting another part over the glass in viewportframe blocks the highlight altogether:
image

I can’t use a different material since the glass is required for the ViewportFrame Masking to work. Is there anything I could do to work around the glass showing ViewportFrame background color instead of its own? I’ll attempt to work with the 0.5 transparency for the moment but I’d like to know if there’s a solution.

Thank you.

2 Likes

Why don’t you use the highlight instance ?

1 Like

The highlight highlights the whole part, even if some of the part isn’t fully behind a wall. I wanted to try to make a more accurate one. Its not very practical though and a highlight would definitely be better for actual use.

Sadly there’s really no way to bypass that annoying side effect of using glass to reveal the mask meshes.


There’s another way to achieve similar highlights by using actual Highlights. Not sure if its been documented before but here’s a quick explanation of how to do it:

First create an AlwaysOnTop Highlight for the [Blue] object you want to be highlighted over walls.
Then create a clone of the [Blue] object with glass material and 1 transparency. Scale the cloned [Red] object towards the camera so that it appears the same size from the camera’s perspective while always remaining in front of the other highlighted [Blue] object.
Lastly give the [Red] object an Occluded Highlight with 1 FillTransparency and 0.9999999 OutlineTransparency so that it’ll mask out the Highlight of the [Blue] object while remaining nearly invisible:

image

Now when the player is behind a wall, the Occluded Highlight gets blocked by the wall, while the AlwaysOnTop Highlight appears over it:

image

Note: you can get rid of the specular highlights on the glass meshes by giving them a TextureID. Also the glass meshes can’t be fully invisible (has to be at 0.9999999 transparency) when they have a WrapTarget and the parent character has a Humanoid.


Here’s a video showing the effect:

Here’s the place file: Behind_Wall_Highlight1.rbxl (93.6 KB)

1 Like

Thanks for showing that! I never knew you could still get that effect with regular highlights since, when I’d searched for it previously, I hadn’t found many posts about it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.