# Blit from Cube to Cube map

## Recommended Posts

wolf    852
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 on other sites
HellRaiZer    1001
Hi wolf,

I think this is API dependent. I haven't used it, but in OpenGL you can check EXT_framebuffer_blit.

For DX, unfortunately i have no idea.

Hope that helps.

HellRaiZer

##### Share on other sites
jbarcz1    265

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 on other sites
wolf    852
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]