Cube map reflection demo!

Blitz3D Forums/Blitz3D Programming/Cube map reflection demo!

Quick cube map tut...


Cube maps are just textures - but textures with 6 'sides'.

The idea is that instead of using u,v coords to look up a texture, you use x,y,z 'vector' coords.

Think of a vector with its origin at 0,0,0 within a cube centred at 0,0,0. The vector will 'point' to a texel on one of the six faces. This is the texel looked up by the hardware for a particular x,y,z texcoord.

At the moment, I'm using D3D to generate a 'reflection vector' at each vertex. This means the texcoords used to index the cube map are atuomatically generated, and will represent the eye-to-vertex ray 'bounced' off the vertex (the bounce is calculate using the vertex normal).

By drawing an environment on the cube sides, the end result is a pretty nifty reflection effect.