1
\$\begingroup\$

I'm trying to implement Hi-Z Screen-Space Cone-Traced Reflections using Direct3D9. I already know how to render to specific mip-level texture using Direct3D11, but not using Direct3D9.

Has anyone tried the same before?

How would I generate a custom mip-texture using D3D9? Not just switch between two different sized textures from system memory.

Maybe something involving StretchRect functions might work?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Create your mipmapped texture as a rendertarget. Then grab the surfaces of each Mip level you want to render to like this:

D3DXCreateTexture( device, width, height, numMips, D3DUSAGE_RENDERTARGET, texFormat, D3DPOOL_DEFAULT, &texture ); texture->GetSurfaceLevel( 0, &mipLevel0 ); texture->GetSurfaceLevel( 1, &mipLevel1 ); texture->GetSurfaceLevel( 2, &mipLevel2 ); ...

Then to render to the specified mipmap in the texture use SetRenderTarget with the appropriate surface. e.g. device->SetRenderTarget( 0, mipLevel2 );

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .