Sign in to follow this  
PiCroft

Dynamically generated cubemaps

Recommended Posts

I have an environment-mapped Utah Teapot that correctly reflects its environment which is a cubemap. I'm looking to make it reflect other objects as well, such as a second teapot bu the current method doesn't allow that. I was wondering if someone could give me a hand generating a dynamic cubemap (I already know about placing a camera at the object's position and taking a snapshot in all six directions, but I haven't the slightest idea how to do this). If someone could point me to a very detailed tutorial on this, or explain how it is done, I would be very grateful. Cheers.

Share this post


Link to post
Share on other sites
* Create an additional rendertarget cubemap.
* For all six sides
..* Retrieve surface of that side
..* Set it as rendertarget
..* Set up camera with 90° fov and a aspect ratio of 1 looking "out" of that side
..* render scene, including background
* Use the dynamic cubemap instead of the background cubemap

There's an example in the DirectX SDK for that. Or at least it was, they keep removing examples and adding new with every revision.

Bye, Thomas

Share this post


Link to post
Share on other sites
Thanks but I need to reflect stuff in the teapot, not in a surface. That tutorial, (though useful and I'll definitely file it away :) ) shows me how to reflect an object in a static surface such as a wall or floor, but I'm looking to make an object reflect other objects dynamically.

Share this post


Link to post
Share on other sites
Quote:
Original post by Schrompf
* Create an additional rendertarget cubemap.
* For all six sides
..* Retrieve surface of that side
..* Set it as rendertarget
..* Set up camera with 90° fov and a aspect ratio of 1 looking "out" of that side
..* render scene, including background
* Use the dynamic cubemap instead of the background cubemap

There's an example in the DirectX SDK for that. Or at least it was, they keep removing examples and adding new with every revision.

Bye, Thomas


Thanks, that's more like what I'm looking for. Could you break it down a bit more though? I'm not sure how to perform those steps.

Share this post


Link to post
Share on other sites
I made an attempt after looking up rendertarget, but I have no idea how to use it.

I found it in the directX SDK and I don't know any DirectX programming (OpenGL and GLUT only, with a little CG) so I don't know what dependencies it requires, what includes I need etc or if I even have them available on my machine (Getting OpenGL and GLUT working without endless "Cannot find glext.h" and so on is frustrating enough).

Having said that, I did try and see if I could use it but to no avail. I need an include somewhere and I don't know what.

Also, I'm not sure how to do this:

Set up camera with 90° fov and a aspect ratio of 1 looking "out" of that side.

I have a vague feeling I know what I need to do: gluLookAt() with the appropriate arguments, but since I can't use rednertarget I can't experiment and see if I'm right.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this