Jump to content
  • Advertisement
Sign in to follow this  
kosmonaut

Manual generation of mip maps?

This topic is 938 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 guys,

 

MonoGame Dev here (aka XNA with SharpDX)

 

how would I go about manually generating mip maps for a rendertarget (or texture for that matter)?

 

I often read that for min/max shadow mip chains are generated manually (in this example obviously not just an average downsample but rather a min/max) as well as for bloom RTs.

 

I presume in these papers the engineers are actually writing to the corresponding mip maps instead of having a dozen other renderTargets called rtMip0, rtMip1 etc.

 

As of now I use several differently sized renderTargets for my bloom and such, but i feel it would be more convenient to store it all in one RT with its child MIPs - especially for min/max shadows.

 

So - if that is indeed feasible - how would I go about it?

 

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

the dx API has calls to add / load your own mip maps. check the docs. 

 

its usually used to make your own mip maps in a separate app that doesn't blend the background into the image the way dx does. blending in the background is what creates the back halo around the edge of sprite textures, and is why alpha tests must be something like "value<128" instead of "value==0".

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

I've got no monogame experience... Which version of D3D is it using?

In D3D11, a texture resource is separate from "views" of that resource. A render-target view is basically a link to a particular mip-level in the texture resource. So, you can make an array of RTV's for your texture's mip-chain, and then render to each of them one by one.

In D3D9, a "surface" acts similarly to an RTV. If you've got a renderable texture with a mip-chain, you can use IDirect3DTexture9::GetSurfaceLevel to obtain one writable surface for each mipmap, which can be bound as a render-target.

Edited by Hodgman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!