Help using r_screenoverlay without textures stretching?

Discussion in 'Mapping Questions & Discussion' started by Werewolf, Jan 27, 2017.

  1. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    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.
     
  2. Nixon

    aa Nixon

    Messages:
    85
    Positive Ratings:
    47
    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..
     
  3. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    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
     
  4. Micnax

    aa Micnax I maek map

    Messages:
    2,057
    Positive Ratings:
    1,387
    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.
     
  5. iiboharz

    aa iiboharz Meme Queen

    Messages:
    715
    Positive Ratings:
    1,037
    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.
     
  6. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    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.
     
  7. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    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?
     
  8. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    And I solved it myself. Simply removed the two Vertex commands ("$vertexcolor" and "$vertexalpha")
     
  9. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    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.
     
  10. hutty

    aa hutty

    Messages:
    471
    Positive Ratings:
    373
    have you looked up the vmt for the sniper's scope, overlay? or the jarate overlay?
     
  11. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    No I didn't think of that. I shall give that a try
     
  12. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    779
    Positive Ratings:
    226
    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....
     
    • Like Like x 1
    • Funny Funny x 1