how a cubemap texture is applied on a surface ?

Community Forums/General Help/how a cubemap texture is applied on a surface ?

RemiD(Posted 2016) [#1]
Hello, :)

I have searched on the forums but still no precise answer...

When creating a cubemap texture, we can define the width/height in texels.
But we can't define the texels size in units (the size of the texel in the 3d world) and we can't define the "projecting cube" width/height/depth, nor its origine (related to the shape where the cubemap texture will be projected)...

So how i am supposed to know how a cubemap texture will be applied on a surface ?
I have no idea of the origin or size of the "projecting cube"...

I ask this because some shapes have a different width than the height than the depth and therefore i wonder how is the "projecting cube" size is calculated and where is its origin (i suppose at a point at the center of the boundingbox of the shape)

I also wonder if the "projecting cube" has always the shape of a cube (with all faces being the same size, and the size of a face being calculated depending on the largest size of the shape (either width, or height, or depth), because if the "projecting cube" is not uniform (has all its faces with the same size) how can the texel size/shape stay consistent ?

Any explanations about that ?

Thanks,


col(Posted 2016) [#2]
Here's some d3d9 source in BMax, unfortunately the download doesn't work. The example goes one step further to generate the cube textures dynamically then used them to texture an object making a realtime cubic environment reflection. I could redo the example as a standalone source if you really wanted me to.

Try not to think of the a cube texture as an actual cube with a physical size. It's a texture made up of 6 textures - one for direction on each axis, so that would be +x -x +y -y +z and -z. The texture gets mapped to the geometry in the usual way via uv coords. The difference being how those uv coords relate to the texture - the normal of the vertices is taken into consideration in world space not model space. Which one of the six texture images that is chosen is decided upon which world direction the vertex/face is facing.

For a much better explanation that I do here visit the NVidia site. There are tons of papers written about how to achieve the effect but they pretty much boil down to similar techniques.
http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter07.html


RemiD(Posted 2016) [#3]
@col>>thanks for the second link, i will take a look. :)