Sign in to follow this  

Blit from Cube to Cube map

Recommended Posts

Hi, I was thinking today about how to blit from one cube map face to the cube map face of another cube map. Unfortunately without hacking around the cube map, there seems to be no "right" solution. As soon as you fetch the face with the incident vector, you have to correct the fetch by approximating a kind of sphere like look-up or something else (isoCube). If you want to build a kind of postfx for cube maps this is not satisfying, because there is an on-going quality decrease. So I assume many will now suggest to treat the cube map as a series of 2D textures ... but this also does not sound like a great and generic solution. Does anyone has a good idea on how to blit from a cube map to a cube map without treating it as an array of 2D textures and without using stuff like isoCubes? Thanks in advance, - Wolf

Share this post

Link to post
Share on other sites

The DX way is something like this:

for( int i=0; i<6; i++ )
IDirect3DSurface9* pSrc;
IDirect3DSurface9* pDst;
pSrcCube->GetSurfaceLevel( i, 0, &pSrc );
pDstCube->GetSurfaceLevel( i, 0, &pDst );
pD3DDevice->StretchRect( pDst, pSrc );

I dont know if thats right, as its just off the top of my head, but you get the idea.

If you want to do an arbitrary post-processing trick on the cubemap, just bind the surfaces as render targets and render full-screen quads into each of them.

Share this post

Link to post
Share on other sites
Thanks a lot. I need to find out how this fits onto my current hardware platform :-)

- Wolf

[Edited by - wolf on March 20, 2007 7:11:43 PM]

Share this post

Link to post
Share on other sites

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