Menu

#59 Graphical artifacts with scaled UI

1.5.x
closed-fixed
nobody
None
5
2021-03-07
2016-04-05
No

Scaling the UI on any resolution to any extent results in noticable artifatcs on the HUD that looks like splitting lines

Discussion

  • MilkeyWilkey

    MilkeyWilkey - 2016-04-09

    notice a lines on "heads" on the HUD and in the middle of inventory screen

     

    Last edit: MilkeyWilkey 2016-04-09
  • Ozkan Sezer

    Ozkan Sezer - 2016-04-09

    Known issue for quite some time. The status bar is made of multiple pictures
    drawn together, and with scaling the borders may become visible.

    Unless you have a tested patch for it, this one will remain as a non-priority
    issue.

     
  • MilkeyWilkey

    MilkeyWilkey - 2016-04-10

    well, that was just too easy to fix, so I wonder, why this was not fixed already.
    I just put the pieces of hud together and it worked
    here is the edited hud. I didn't glued top and bottom parts, but you can, if you will.

    changes in sbar.c
    for top part make

    Sbar_DrawTransPic(0, -23, Draw_CachePic("gfx/topbarfull.lmp"));
        //Sbar_DrawPic(0, 0, Draw_CachePic("gfx/topbar1.lmp"));
        //Sbar_DrawPic(160, 0, Draw_CachePic("gfx/topbar2.lmp"));
        //Sbar_DrawTransPic(0, -23, Draw_CachePic("gfx/topbumpl.lmp"));
        //Sbar_DrawTransPic(138, -8, Draw_CachePic("gfx/topbumpm.lmp"));
        //Sbar_DrawTransPic(269, -23, Draw_CachePic("gfx/topbumpr.lmp"));
    

    for bottom part

    // Backdrop
        Sbar_DrawPic(0, 46, Draw_CachePic("gfx/btmbarfull.lmp"));
        //Sbar_DrawPic(0, 46, Draw_CachePic("gfx/btmbar2.lmp"));
        //Sbar_DrawPic(160, 46, Draw_CachePic("gfx/btmbar2.lmp"));
    
     
  • MilkeyWilkey

    MilkeyWilkey - 2016-04-10

    note: tested only on glh2 since I still can't compile h2

     
  • Ozkan Sezer

    Ozkan Sezer - 2016-04-10

    Redistributing game's assets in modified form is not something we can do.

     
    • MilkeyWilkey

      MilkeyWilkey - 2016-04-10

      this content is from shareware version anyway

       
  • MilkeyWilkey

    MilkeyWilkey - 2016-04-10

    if you don't want to redistribute it, well, it's easy to make a script that will do everything on end-user machines

     
  • Ozkan Sezer

    Ozkan Sezer - 2016-04-10

    A proper fix would be playing with opengl stuff to draw it better. So no, I won't do it this way.

     
  • MilkeyWilkey

    MilkeyWilkey - 2016-04-10

    Yeah, that would be a proper fix, but honestly, I don't see a point why not make this as a temporary solution at least. if it works - it works, years may pass until proper fix will be done

     
  • Feels Ranger Man

    This issue is caused by the status bar being scaled with the GL_LINEAR filter, it is sampled incorrectly and when it is upscaled the seam appears. I solved this by forcing the status bar to be filtered using nearest neighbor and the seam no longer appears.

    https://i.imgur.com/c231yqq.png

    Changes to gl_draw.c:

    1646:  glTexParameterf_fp(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 
    1647:  glTexParameterf_fp(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    

    I'd submit the fix but I think the proper way to do this is to scale it using nearest neighbor and then redraw it to the user selected texture filter (i.e. GL_NEAREST_MIPMAP_NEAREST).

     

    Last edit: Feels Ranger Man 2021-03-05
    • Ozkan Sezer

      Ozkan Sezer - 2021-03-05

      1646: glTexParameterf_fp(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
      1647: glTexParameterf_fp(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

      That looks like a wrong fix: That would apply NEAREST filter to textures which are specifically requested LINEAR filter.

      The correct place might be GL_LoadPicTexture() in gl_draw.c where you should change TEX_LINEAR to TEX_NEAREST. That function is used for a lot of pictures though, so I don't know how that would affect other pictures.

       
      • Feels Ranger Man

        Yes this is why I didn't submit a commit. I merely found the issue that was happening and agree it should be done properly, I'm not very familiar with the code base to do so nor have a lot of free time. Personally I prefer nearest on all objects in the game so it works for my own personal needs.

         
  • MilkeyWilkey

    MilkeyWilkey - 2021-03-05

    I like the fix. Looks just like I wanted it too, thanks. Funny, how accurate was my prediction - years indeed have passed.

     
  • Feels Ranger Man

    Yea, this issue also shed light on the fact that the user selected 'GL_TEXTUREMODE' cvar was not applying to the main menu and status bar, I feel this should be changed and the texturemode should apply to these objects.

     
  • MilkeyWilkey

    MilkeyWilkey - 2021-03-05

    I'd say, it would be better if one could choose to assign different texture modes since 3D viewport is vector and many would prefer it filtered but statusbar and menus are 2D raster and it arguably looks better unfiltered

     
  • Feels Ranger Man

    I agree but others will argue that the bilinear look is original or better and that's fine. Just give the user the choice, that's my opinion.

     
    • Ozkan Sezer

      Ozkan Sezer - 2021-03-05

      IIRC, it was like that before but others reacted, so we went back to hardcoding it. (can't find the original commit or the issue report.)

       
  • Ozkan Sezer

    Ozkan Sezer - 2021-03-05

    OK, tried the following patch briefly, looked OK. Will try a bit more
    and then will apply if nothing goes wrong.

    diff --git a/engine/h2shared/gl_draw.c b/engine/h2shared/gl_draw.c
    index 998114a..727a0d6 100644
    --- a/engine/h2shared/gl_draw.c
    +++ b/engine/h2shared/gl_draw.c
    @@ -1882,6 +1882,6 @@ GL_LoadPicTexture
     */
     GLuint GL_LoadPicTexture (qpic_t *pic)
     {
    -   return GL_LoadTexture ("", pic->data, pic->width, pic->height, TEX_ALPHA|TEX_LINEAR);
    +   return GL_LoadTexture ("", pic->data, pic->width, pic->height, TEX_ALPHA|TEX_NEAREST);
     }
    
     
    • Feels Ranger Man

      Awesome. Thank you for taking the time to fix this and add it into the actual release. If you have time, please take a look a this feature request solution I provided so it can perhaps make it into the next release:

      https://sourceforge.net/p/uhexen2/feature-requests/37/#ed39

      I don't see any issues with allowing this to be configurable and the default remains 72. I noticed no weird physic irregularities when playing briefly above 72FPS, it seems Hexen II decoupled the physics from the rendering as well. Regardless, this solution allows the normal default behavior but gives the user the ability to uncap the FPS using host_maxfps

       

      Last edit: Feels Ranger Man 2021-03-06
  • Ozkan Sezer

    Ozkan Sezer - 2021-03-07
    • status: open --> closed-fixed
     
  • Ozkan Sezer

    Ozkan Sezer - 2021-03-07

    Fixed as of svn r6156

     

Log in to post a comment.