Sign in to follow this  

Colored mipmaps

This topic is 4202 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

I'd like to have a chain of mipmaps with different colors, so I can see which levels are mostly useless. Must I load them manually? If so, is there a good tutorial on this? I can only find D3D code that does automatic mipmap generation. Or, if there's a way to do each mip level within an editor and save the whole chain (in a dds, say), that would be optimal. Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by discman1028
Must I load them manually? If so, is there a good tutorial on this?
Simply using IDirect3DTexture9::GetLevelCount() to iterate through each IDirect3DTexture9::GetSurfaceLevel() should do the trick. If your texture is also a render target you can use a ColorFill() operation, otherwise you can use a trivial D3DXFillTexture() - even a regular Lock() might work well if you know the pixel format.

Quote:
Original post by discman1028
Or, if there's a way to do each mip level within an editor and save the whole chain (in a dds, say), that would be optimal.
I'm pretty sure the "DirectX Texture Tool" (dxtex.exe) should be able to load up individual images and export as a mip-chain. Might be worth looking into the Nvidia photoshop plugins (if you have Photoshop, or compatible, available)...

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
Quote:
Original post by discman1028
Or, if there's a way to do each mip level within an editor and save the whole chain (in a dds, say), that would be optimal.
I'm pretty sure the "DirectX Texture Tool" (dxtex.exe) should be able to load up individual images and export as a mip-chain. Might be worth looking into the Nvidia photoshop plugins (if you have Photoshop, or compatible, available)...


Yep, the Texture Tool has a Generate Mip Maps option on the Format menu. You can then save the texture as a DDS file. The DDS format stores the mip map chain for you.

What's more, the source code to the DirectX Texture Tool comes with the DirectX SDK! - take a look in the Utilities\Source\dxtex folder of DirectX SDK. [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by S1CA
Yep, the Texture Tool has a Generate Mip Maps option on the Format menu. You can then save the texture as a DDS file. The DDS format stores the mip map chain for you.

What's more, the source code to the DirectX Texture Tool comes with the DirectX SDK! - take a look in the Utilities\Source\dxtex folder of DirectX SDK. [smile]


I know that I can generate mipmaps from the original image. The question is, can I modify individual mipmaps, so that one size is red, the other blue, or write my name on one of them :), etc.

jollyjeffers's func calls should do it, I'll look into it. But a tool would be nice.

Share this post


Link to post
Share on other sites
To save yourself from future headaches you should not try to bring colored mipmaps to your game with an external tool chain. Write a function that will change the color of already created textures and add a hotkey (or console command) that allows calling it for all textures that you use.

Throwing away mipmaps based on your personal observations is a bad idea. There are too many factors that control the mipmap selection. To make things even more worse there are some that you can’t control. The user can overwrite the filter settings as an example.

If you want to optimize you should provide a “Texture detail” setting and create downscaled versions of your textures. This means that if your texture is 512*512 with the highest setting you should go back to 256*256 if the setting is set one level down.

Share this post


Link to post
Share on other sites
Quote:
Original post by Demirug

Throwing away mipmaps based on your personal observations is a bad idea. There are too many factors that control the mipmap selection. To make things even more worse there are some that you can’t control. The user can overwrite the filter settings as an example.

If you want to optimize you should provide a “Texture detail” setting and create downscaled versions of your textures. This means that if your texture is 512*512 with the highest setting you should go back to 256*256 if the setting is set one level down.


My problem is an unusual one: I need to optimize for the size of the release.

And how could the user overwrite the filter settings to request a larger texture than I even have in the mip chain?

Quote:
Original post by Demirug
To save yourself from future headaches you should not try to bring colored mipmaps to your game with an external tool chain. Write a function that will change the color of already created textures and add a hotkey (or console command) that allows calling it for all textures that you use.


Can you mofidy the loaded textures within D3D, AFTER having D3D automatically create mipmaps from a large texture? Or must you pre-process the images?

EDIT: Nevermind, the link posted answers this second question. The bolded question above remains though.

Share this post


Link to post
Share on other sites
Quote:
Original post by discman1028
My problem is an unusual one: I need to optimize for the size of the release.

And how could the user overwrite the filter settings to request a larger texture than I even have in the mip chain?


If you have already removed it can’t.

It was meant in the other way. It is possible that you test with filter settings that don’t show anything of your larger mipmap. But there could other filter settings that use the larger mipmaps if they are there.
But when you need to trim your distribution size and have already compressed anything to maximum you have not many options left.



Share this post


Link to post
Share on other sites
Quote:
Original post by discman1028
Quote:
Original post by S1CA
Yep, the Texture Tool has a Generate Mip Maps option on the Format menu. You can then save the texture as a DDS file. The DDS format stores the mip map chain for you.

What's more, the source code to the DirectX Texture Tool comes with the DirectX SDK! - take a look in the Utilities\Source\dxtex folder of DirectX SDK. [smile]


I know that I can generate mipmaps from the original image. The question is, can I modify individual mipmaps, so that one size is red, the other blue, or write my name on one of them :), etc.

jollyjeffers's func calls should do it, I'll look into it. But a tool would be nice.


Yeah, I probably didn't make my post probably wasn't as clear as I should have.

I was kinda going off Jack's comment about the DirectX Texture Tool being able to generate mips and your comment about doing it in an editor that could save the whole mip chain [smile]

It was more a suggestion that since you already have the source code to the DirectX Texture Tool, you could modify/hack the "Generate Mip Maps" functionality of it to colour in each level of the mip chain. That modification would likely involve using the functions Jack suggested.

It's handy functionality to have, particularly for demonstrating to artists that only, say, the 128x128 mip level of their 2048x2048 masterpiece texture is ever seen in normal game situations [wink]

[Edited by - S1CA on June 14, 2006 6:21:57 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by S1CA
Yeah, I probably didn't make my post probably wasn't as clear as I should have.


Same with that sentence! [wink]

Quote:
Original post by S1CA
It was more a suggestion that since you already have the source code to the DirectX Texture Tool, you could modify/hack the "Generate Mip Maps" functionality of it to colour in each level of the mip chain. That modification would likely involve using the functions Jack suggested.


That would be a cool improvement... I'll put it in my list things to do. [smile]

Quote:
Original post by S1CA
It's handy functionality to have, particularly for demonstrating to artists that only, say, the 128x128 mip level of their 2048x2048 masterpiece texture is ever seen in normal game situations


Exactly why it's useful. [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by discman1028
Quote:
Original post by S1CA
Yeah, I probably didn't make my post probably wasn't as clear as I should have.


Same with that sentence! [wink]


DOH! [smile] methinks that's a definite sign that it's time to get some sleep!

[ZZZZzzzzz]

Share this post


Link to post
Share on other sites

This topic is 4202 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