Open Klizmotron opened 7 years ago
Yeah I can confirm. I think there was a hack put in the surface functions to help prevent artifacts on textured rects not bordered correctly. Without the hack, some of the texture on one side of the rect appears wrapped to the other side due to AA.
DrawTexturedRectUV is a direct binding with no extra code to DrawTexturedSubRect
Then it's valve's doing.
Well, seems like we'll have to keep on using this arbitrary adjustment to make it all look good
This is the cause. Apparently to do with DX to GL abstraction layer the engine uses according to internal comments.
"Fixing" this (provided a nice way of doing so is found) not only will break all existing code that has been adjusted, it will also break all code that has not been adjusted. Interestingly some parts of the spawnmenu are not affected by this, like silk icons and the derma skin.
I imagine the unaffected materials are already the correct size for the border correction. Most addons use render.drawQuad instead to avoid this bug. You might as well fix it.
Weirdly, this doesn't affect macOS. No idea about Linux
Details
For some reason the UV coordinates in this function do not do what they should. For example, when you set some 8x8 texture as a material to draw and want to draw a 64x64 rectangle with it using surface.DrawTexturedRectUV, where the texture tiles (it should tile 8 times for x and y), you would expect the correct UVs to be 0, 0, 8, 8, but in reality it leads to some uneven and crappy results, but when you add some randomly discovered offset, which is equal to tiling/texture_resolution to the end UV coordinate it fixes the thing. This is very strange behavior and I wonder if it can be fixed. Here are some illustrations of my words:
The code:
In-game results
I hope it can be fixed soon, this is not the way it should work