Mipmap texture problem

Started by
1 comment, last by Scythen 19 years, 1 month ago
Hi all, I’m having a problem with mipmaped textures. I’m using DXT1 textures with all mipmap levels generated. There are some areas of the textures that are transparent. I setup d3d for alpha test like this: m_pDevice->SetRenderState(D3DRS_ALPHAREF, (DWORD)0x00000001); m_pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); m_pDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); Now when the textures render, the look fine up close (using the largest mipmap). But portions of the models begin to disappear or turn black when smaller mipmaps are used as objects become further away. What could cause this? I've verified that the mipmap textures are valid in the dxtex tool. Any suggestions?
Advertisement
When mip maps are generated they also get filtered. When the different stages get filtered they use nearby pixels for the calculations. So if you had (0,0,0) for the transparent color then the next stage would change those values near the non transparent colors.

Think of it this way. Say you had a tree and the transparent part was black around that tree. When the mip maps did the filtering the transparent color around the leaves would be taken into effect to filter the leaves correctly, thus changing the (0,0,0) to the average of the surrounding pixels.

Take in image into photoshop or paint shop pro and smooth it. After you smooth it take the color picker and see what color values you get.

Mip maps are not good if you have an area in the image that needs to be transparent.
I understand what you’ve said but I don’t think it’s the problem I’m seeing.

All the levels look fine when I view them in the texture viewer.
In fact, some 1024x1024 textures have only small areas that use transparency.

So why would an area of the model using a portion of the texture that is no where near the transparent part disappear or go black?

I’m using the NVidia Photo Shop texture plug-in and I've tried all different settings.

What’s up with that?
And why would they go black when there is no black in the texture to begin with?

Also, there is one texture per model (like an atlas) some areas of the model need 1bit alpha so I'm using DXT1. I would think using multiple textures in this case would be bad. I have to use the mipmaping or the textures will look really bad.

This topic is closed to new replies.

Advertisement