-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zoom-out causes random disappearance of texture #691
Comments
It’s definitely unwanted behavior. Let me know if you come up with anything. I’ll try looking into it later tonight to see I can replicate it. Thanks for tracking this down! |
I can't find anything, probably next year. :P I write one small piece of code to make it easier to reproduce the problem. Since it needs the assets, you can download the code and the assets here.
The assets is The bug can be trigged by zoom-out. Also, I notice that:
If the grid becomes smaller than 1px seems reasonable that they will disappear, that is why I thought that it's expected behaviour. But, it doesn't seem the case. |
Well, I have a guess. I'm trying to make it works, but my knowledge around OpenGL stuff is minimal. The problem seems related to However, the OpenGL has no clue about what is the most critical content of the image. It makes the white border disappear. Playing around I don't know if it makes sense, but I'm trying to make it work. |
Yes, I think it's the right direction. Now the image has a diferent color, but never disappear. I change the
I need to understand why it changes the color, seems to be related to the alpha, but I don't know how fix. |
The last change, mentioned previously, didn't fix the issue. Instead, it makes the usage of GPU significant higher than before, from 4% to 21%, of GPU usage, using an AMD RX 5700XT. Using |
Yeah, mipmaps are for when you have different quality textures based on distance, usually in a 3D settings. You can have detailed model textures when you're up close, and a flat png as a far away background so you don't have to, say, render a full mountain even though it's miles away. I believe I can replicate the behavor, but I can't seem to get it to repeat like yours, where it stretches to fill the viewport, that looks like the render component's Repeat is set to ClampToEdge. I would say that it's related to point number 5 here. It looks like if we switch between non-mipmapped filters to ones that are, we have to actually setup a mipmap (OpenGL can do this for us, just have to set it up so that it does). |
The workaround that I found is using an "power of 2". The texture must be 128x128 (instead of 100x100). The zoom must be also power of 2, which means that the zoom is: 1, 2, 4, 8, 16, 32... It's not a proper fix, but mitigates the issue for now. The current MouseZoomer didn't have any settings for that, like a Futhermore, the moviment of the camera (about X and Y) must be "kinda power of 2". If you are in the position of: {X: 6, Y: 6, Z: 8} some lines will be smaller than others. However, if you are at {X: 4, Y: 4, Z: 8} it's good. |
Saving textures as a power of two is how OpenGL does it anyway, if you save a 100x100 texture it'll take up the same amount of graphics memory as a 128x128 texture. We could simply put this into the stuff we use for UploadTexture; check the size of the texture and if it's not a power of two then we can create a new texture that is and copy the texture to the new one. Doing this would probably fix a lot of bugs like this. Adding 'Steps []float32' to the all the camera systems in |
I'm unable to re-open issue #679, the bug is very similar, but the causes seem to be not related.
So, I have that scene:
There's two layers of image, both created by
common.NewTextureSingle
. The first image is the background, the green grass (which is 100x100). Then, on top, has a grid which is 200x200, which is just a square border.Everything works, until zoom-out. If I zoom-out too much the texture desapears:
I'm trying to find what is causing it. I don't know if it's a bug or it's expected behaviour.
The text was updated successfully, but these errors were encountered: