Flickering visibility through glass

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
I am having a visibility issue in one of my maps that I can't get my head around. Basically certain items in the map appear to flicker when viewed, but only from a particular location. I recorded this to help demonstrate:

The spinning item you see is a func_rotating, and wall around it that is flickering is a func_breakable. Most of everything else you see is actually a func_detail.

This is the same view in Hammer with the visleaves enabled:
cZZ93EI.png

It may not be clear from this screenshot, but I'm not crossing any visleaves when I move.

I'm not sure if it's the location that's the issue or the glass it's being viewed through as it is a custom made texture. It's a simple white layer set to 20% opacity (created in GIMP, base layer 100% transparent, 2nd layer white with the opacity reduced).

I mention this even though I've had this issue with stock textures (previously I was using 'glass/glasswindow001a') but I had heard a rumor that I might be able to fix this issue with a certain parameter in the .vmt file, except I have no idea which parameter is supposed to be the magic one! Because of that. I've added various ones and experimented a bit, but so far I've not had any luck.

Here's the .vmt file in question:
Code:
LightmappedGeneric

{
    "$basetexture" "custom/tf2_general/glass_no_sound_002"
    "$surfaceprop" "Default_Silent"

    "$reflectivity" "[0.10 0.10 0.10]"

    "$alpha" "0.2"
    "$alphatest" "1"
    "$alphatestreference" "0.5"

    "$selfillum" "1"

    "$nodecal" "1"
    "$nofog" "1"

    "$color" "[0.53 0.53 0.53]"

    "%keywords" "tf,glass"
}

Therefore my question is this - Does anyone know how to fix/prevent this flickering?
 

ficool2

L4: Comfortable Member
Oct 28, 2017
161
232
"$alpha" "0.2"
"$alphatest" "1"
"$alphatestreference" "0.5"

$alpha and $alphatest are not compatible together, thats the first issue (you should be using only $alpha)

If that still doesn't work, make the glass a func_brush
If that doesn't work, fire the AlternativeSorting 1 input onto the glass brush (you may need a custom FGD for this to show up)
Also try firing the AlternativeSorting 1 on the func_breakable
And if that doesn't work, make the glass into a prop_static using Propper
... And if that doesn't work, make the glass into a prop_dynamic
And finally if its still broke, try fire the AlternativeSorting 1 onto the prop_dynamic

I ran into this issue myself on dr_blackmesa, and one of those combinations fixed it
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
$alpha and $alphatest are not compatible together, thats the first issue (you should be using only $alpha)
I took out the $alphatest and $alphatestreference, and it appears to be working fine now, all except for this overlay:

MY1tZLf.jpg

It's just the stock 'overlays/logo_blue_white' overlay. I dug out it's .vmf file though GCFScape:
Code:
LightmappedGeneric

{
    "$basetexture" "overlays/logo_blue_white"
    "$translucent" "1"
    "$decal" "1"

    "$vertexcolor" "1"
    "$vertexalpha" "1"

    "%keywords" "tf"
    
"$decalscale" ".25"
}
Is there a recommended change I could make to the overlay to either the .vmf or the 'info_overlay' in hammer?
 

ficool2

L4: Comfortable Member
Oct 28, 2017
161
232
I took out the $alphatest and $alphatestreference, and it appears to be working fine now, all except for this overlay:

MY1tZLf.jpg

It's just the stock 'overlays/logo_blue_white' overlay. I dug out it's .vmf file though GCFScape:
Code:
LightmappedGeneric

{
    "$basetexture" "overlays/logo_blue_white"
    "$translucent" "1"
    "$decal" "1"

    "$vertexcolor" "1"
    "$vertexalpha" "1"

    "%keywords" "tf"
   
"$decalscale" ".25"
}
Is there a recommended change I could make to the overlay to either the .vmf or the 'info_overlay' in hammer?

Remove $translucent and replace it with $alpha 0.7
 

ficool2

L4: Comfortable Member
Oct 28, 2017
161
232
Nope. It's visible but still getting the same bug.
Try this:

Remove "$decalscale" ".25" and $decal from the vmt, and instead make a brush which is the size of the overlay, and then apply the texture ontop and use the Fit button to stretch it across

After that, make the brush a func_illusionary and submerge it into the floor, and then use Ctrl + M and move it up by 0.1 units (put 0.0 in X and Y)
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
Try this:

Remove "$decalscale" ".25" and $decal from the vmt, and instead make a brush which is the size of the overlay, and then apply the texture ontop and use the Fit button to stretch it across

After that, make the brush a func_illusionary and submerge it into the floor, and then use Ctrl + M and move it up by 0.1 units (put 0.0 in X and Y)
Not the solution I was expecting but it worked, thank you.