Sign in to follow this  

Mipmap texture problem

This topic is 4665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this