Problem with mipmaps in OpenGL/Windows

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Problem with mipmaps in OpenGL/Windows

Post by fractile » Sun Nov 30, 2014 9:33 pm

Most of my textures with mipmaps are invisible on windows using OpenGL renderer. No errors in Ogre log. Same code works fine in Linux and with Direct3D9 renderer. Materials seem to effect z-buffer, but do not render any color. Same thing happens with different types of textures, some use shaders and others are simple fixed function materials like this one:

Code: Select all

material loadscreenbackground
{
    technique
    {
        pass
        {
            lighting off
            depth_check off

            texture_unit
            {
                texture loadscreenbackground.png 1
            }
        }
    }
}
If I set numMipMaps to zero (the "1" in above example), the material becomes visible! I assume there's something wrong with the generated mipmaps. I'm seeing this on Windows 7 laptop with Intel HD4000.

How can I fix this without disabling mipmaps completely?
Attachments
application.log
Ogre log
(105.75 KiB) Downloaded 38 times
0 x

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Mon Dec 08, 2014 7:34 pm

Intel drivers were quite old so I updated them just to be sure, but that didn't change anything. It's worth noting that Other OpenGL games (at least Xonotic) work fine on the same PC. My game works fine on AMD GPU with OpenGL renderer. I also tried it on yet another Windows PC with Intel HD4000 and saw this exact same problem:

Image
Some of the textures do show up even with mipmaps enabled, most don't. All the missing textures become visible if I disable their mipmaps (by setting mipmap count to zero).

So, this seems to be specific to Intel Driver/GPU.
0 x

scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 2

Re: Problem with mipmaps in OpenGL/Windows

Post by scrawl » Mon Dec 08, 2014 11:01 pm

What kind of textures are you using? Compressed textures, .dds? And what version of Ogre? There was a related bug fixed for v1.9: https://ogre3d.atlassian.net/browse/OGRE-259
0 x

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Tue Dec 09, 2014 7:13 am

Simple uncompressed RGBA textures from png -files. Here are log messages for two (of many) textures that are invisible:
I 2014-12-07 12:45:16.472 Texture: loadscreenbackground.png: Loading 1 faces(PF_R8G8B8A8,1x768x1) with 1 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1x768x1.
I 2014-12-07 12:45:16.976 Texture: technical.png: Loading 1 faces(PF_R8G8B8A8,1024x1024x1) with 10 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x1024x1.

I'm using Ogre 1.9 branch. Not quite sure which revision (I can check that later), but I'm pretty sure the fix to that issue is there.
0 x

User avatar
Darthigor
Gnoblar
Posts: 16
Joined: Wed Dec 25, 2013 4:06 am

Re: Problem with mipmaps in OpenGL/Windows

Post by Darthigor » Tue Feb 10, 2015 10:27 am

I have similar problem on Windows Phone/DirectX11. Textures with mipmaps are invisible, but when no mipmaps are generated they are rendered correctly (though grainy). Textures are just plain pngs and jpgs. Is it the same/similar issue? I'm using latest 1.9. Almost the same program (+ same shaders and textures) renders correctly on Windows (OpenGL and DX9) and Android. Odd.
0 x
Check out my Ogre based mobile games: Pig Shooter 3D, Bubble Shooter 3D, Space Rush 3D

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Sun Feb 15, 2015 7:37 pm

I does sound very similar. You're facing the problem on a completely different platform and different renderer. However, since I haven't solved my issue or even found out the reason to it, we might as well be dealing with same problem here..
0 x

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Sun Apr 12, 2015 5:10 pm

Since my last post I have updated Ogre to latest version from 1.9 branch and updated Intel drivers once more. No change. I'm running out of ideas. Does anyone have an idea on how to debug this further? What else could I try?

This is a big problem for me. My game would run well on Intel integrated GPUs performance-wise, but this issue is ruling out a lot of potential players with non-gaming laptops.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Problem with mipmaps in OpenGL/Windows

Post by c6burns » Sun Apr 12, 2015 8:12 pm

My understanding is that not all hardware fully supports mipmapping npot textures (could be outdated info, but used to be true). Make the textures power of two and see if that's the case?
0 x

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Mon Apr 13, 2015 7:14 am

c6burns wrote:My understanding is that not all hardware fully supports mipmapping npot textures (could be outdated info, but used to be true). Make the textures power of two and see if that's the case?
Thanks for the suggestion, but I don't think this is it. Nearly all my textures are already power-of-two sized and square. For example the missing wall/floor textures are all 512x512 or 1024x1024 RGBA textures.
0 x

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Mon Apr 13, 2015 7:57 pm

Just a small update: I tried running the game with GLIntercept. Unfortunately, it did not reveal any meaningful errors, just a few performance warnings and potential memory leaks on shutdown.
0 x

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Sat Sep 05, 2015 12:25 pm

Still struggling with this. Tested on a new laptop with newer generation Intel HD4600, Windows 8.1 and new drivers, but textures are missing here too.

I tried comparing two materials, one that shows up and one that does not. Both use identical shaders and material setup:

Code: Select all

I 2015-09-05 13:59:55.940 Texture: technical.png: Loading 1 faces(PF_R8G8B8A8,1024x1024x1) with 10 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x1024x1.
I 2015-09-05 13:59:55.943 Texture: crate.png: Loading 1 faces(PF_R8G8B8,256x256x1) with 8 generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
Only meaningful difference I can find is that all visible textures have no alpha channel and load as PF_X8R8G8B8 format while non-visible textures use PF_A8R8G8B8 format.

If I force all textures to use PF_X8R8G8B8 format, the invisible materials become visible, but their color is all black. It looks like the generated mipmaps are all empty (0, 0, 0, 0). If the alpha is ignored, it become 1 and the material shows up, but RGB is still zero.
0 x

User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 5
Contact:

Re: Problem with mipmaps in OpenGL/Windows

Post by fractile » Sat Sep 05, 2015 3:59 pm

I added a hack to my game that detects Intel GPU on Windows and disables mipmaps. I can live with this workaround for now..
0 x

Post Reply