Hello all,
I’m using a FBO to render to texture the six faces of a cubemap every x frames. It seems to work fine but I’d like to access each face to display some small billboards to make sure the sides are being rendered correctly.
During rendering to texture I set each cubemap face like this:
But it doesn’t seem to work. I only get a half white/half pink quad haha. So I was wondering if somebody knows if it’s actually possible to access each cube side
@flavious:
Thanks for the quick response , the rendering looks good, the FBO status is ok and I don’t get any error. But after rendering to texture and unbinding the FBO, I’d like to access each rendered face to display a billboard with that texture, only to see what’s actually being rendered to each face.
Let’s say you want to layout your cubemap in a 2D overlay as an unfolded box, for debugging purposes.
For each of the 6 quads in 2D:
<set quad’s 3D cubemap texcoords>
(corners of corresponding cube face in 3D)
<set quad’s 2D vertex positions on screen>
(these correspond to the cube positions in 3D)
every side of the cubemap can be accessed with special tex coords??
Imagine that you have a cube (of any size) with point (0, 0, 0) exactly in it’s center.
Now imagine a vector from (0,0,0) pointing in any direction, having any length - this vector is the texture coordinate, and GPU will use it to sample the cubemap (it just points towards some texel on the cubemap).
So, for example, texture coordinate (x, y, 1.0) for any -1 <= x <= 1 and any -1 <= y <= 1 will point to the positive Z side.
Simply put - the coordinate with the biggest absolute value will select the side.
This sample does exactly what you want-- render to FBO cubemap, then unfold and show each face on screen. It is just a matter of using the correct texcoords.