Beginning with cube maps

Started by
4 comments, last by george7378 10 years, 7 months ago

Hi everyone,

I'm trying to get a shader working for a new technique (to me) - environment mapping. I know that I need to render the world around me to a 'cube texture' and that I then need to sample that texture in my shader, but I don't really know where to start with cube maps. Can anyone recommend a good place to learn about them? Is there some good sample code which will show me how to render my scene to a cube texture?

Thanks!

Advertisement

I don't know any tutorial, but you could try my code samples from this thread for starter.

You can take a look at the single pass environment mapping chapter of the D3D10 book: Programming Vertex, Geometry, and Pixel Shaders. It actually contrasts cube mapping with sphere mapping and dual paraboloid mapping, so you can get lots of information out of it. If you have any questions, feel free to ask here and I'm sure you will get some answers.

I hope that helps!

Hi, thanks belfegor and JasonZ, both of your sources have been great. I actually realised that my book 'Intro to DirectX 9.0c - A Shader Approach' has an EnvMap section. I think I have created a good EnvMap shader, but I just haven't got my program rendering to the cube map properly yet. Why can't there be a nice D3DX function to render to each face for you based on a specified 'up' direction and a chosen field of view for each face... ah well, I'll post a nice screenshot when it works :)

Well, it works - thanks for the help :) That's another HLSL method under my belt :)

[attachment=17893:envmapdemo.jpg]

[attachment=17894:envmapdemo2.jpg]

Here's a slightly nicer screenshot with a skybox for the full reflection experience!

[attachment=17916:emvmapteapot.jpg]

This topic is closed to new replies.

Advertisement