Help using r_screenoverlay without textures stretching?

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
I've been experimenting with using r_screenoverlay to display textures to specific players. So far I have found that no mater what texture you use, it stretched the texture to fill the screen, resulting in them looking warped.

What I'd like to know, is there any way to prevent this? For example I have been using the overlays/no_entry_nocull texture, which is 256x256. I'd like it to stay square (1:1 ratio) and not fill my 16:9 ratio screen. Additionally I'd like it not enlarged to fit in the middle of the screen. Or in other words, that 256x256 texture isn't blown up to 1080x1080.
 

Nixon

L3: Member
Jan 10, 2017
114
76
You could import a custom texture that is already at the screen aspect ratio?
Most people use the same screen res but there are some good exceptions..
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
You could import a custom texture that is already at the screen aspect ratio?
Most people use the same screen res but there are some good exceptions..
All textures need to be power of 2 dimensions. Any 4:3, 16:9 or 16:10 ratio image is not to a power of 2 (32x32, 64x64x 128x64, etc
 

Micnax

Back from the dead (again)
aa
Apr 25, 2009
2,109
1,585
You could always draw it how you want in the right ratio, squash it to 1:1 ratio, then it'll un-squash itself when it's displayed in-game in the ratio you drew it in.

Of course, it'll look different on a 4:3 monitor if you squashed it from 16:9... but I think that's a problem you're gonna have to have.

Additionally you can make the texture with lots of space around it if you need the actual 'object' to be smaller. So having a 256x256 image in the centre but making the whole image 1024x1024 still fill the screen and have the object you want at a smaller size instead of being full size.
 

iiboharz

eternally tired
aa
Nov 5, 2014
858
1,292
Yeah - make the texture at whatever ratio it's supposed to be, then when importing it with VTFedit or whatever, use the clamping options to clamp it to a 1:1 power of 2 size. This is what Valve does for basically all the menu backgrounds.
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
OK It's not the answer I was hoping for, but it will have to do for now. Yes it looks fine on a 16:9 ratio monitor, but squashed on a 4:3 monitor.

The reason I was hoping we could disable it filling the screen and have it placed on screen at it's default size, was because I was hoping to create some custom overlays that would have text on them. Having the text potentially get warped would mess up its spacing/kerning which could make it unreadable. Thankfully I can use game_text instead.
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
OK a sort of follow up question though It might be better on its own thread.... any how

When I compile my map with lighting, the overlay appears to flicker as if it's Z-fighting with something else. At first I thought it was because I was using the wrong shader ("LightMappedGeneric") so swapped it for "UnlitGeneric". I also tried adding $selfillum as well, but it still flickers. I can only assume it has something to do with the lighting as it doesn't happen at all when compiling without lights

Here is my .vmt as it is right now:
Code:
"UnlitGeneric"
{
   "$basetexture" "custom/test_map/no_entry_overlay"
   "$translucent" "1"
   "$surfaceprop" "no_decal"
   "$selfillum" "1"
   "$vertexcolor" "1"
   "$vertexalpha" "1"
}

Any one got any ideas what it could be?
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
OK a sort of follow up question though It might be better on its own thread.... any how

When I compile my map with lighting, the overlay appears to flicker as if it's Z-fighting with something else. At first I thought it was because I was using the wrong shader ("LightMappedGeneric") so swapped it for "UnlitGeneric". I also tried adding $selfillum as well, but it still flickers. I can only assume it has something to do with the lighting as it doesn't happen at all when compiling without lights.
And I solved it myself. Simply removed the two Vertex commands ("$vertexcolor" and "$vertexalpha")
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
Another follow up question!

When I run TF2 in DirectX 8 any transparent parts of the overlay appear completely black. I've tested it against the Texture Detail settings (mat_picmip 2 - -1) and the issue persists. I only get this problem with TF2 runs in DirectX8.

Here is my .vmt settings:
Code:
"UnlitGeneric"
{
   "$basetexture" "custom/test_map/overlay_no_entry"
   "$translucent" "1"
   "$surfaceprop" "no_decal"
   "$selfillum" "1"
}
Anyone got any idea how to fix this? I'm fairly sure I will need to add something to the .vmt file, though I have gone though various pages on the VDC and tried adding various parameters but none of them work.
 

hutty

aa
Mar 30, 2014
547
446
have you looked up the vmt for the sniper's scope, overlay? or the jarate overlay?
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
After a couple hours of trying different parameters and such, I eventually found the only thing I had to do was remove the $selfillum.

Oh and I wasted 2 hours doing this because I was editing the wrong .vmt! I have two textures I'm using in my map, one of which I had setup to run OnMapSpawn so that it would automatically appear on screen when I loaded the map. But clever old me was making edits to the other textures .vmt file, so every time I compiled and ran TF2 it didn't show any changes....