making cube maps


#1

i posted this in the 3ds max forum but i want to make sure i can get a solution.

i cant figure it out how to make cube maps for the life of me. i have the 6 renders from the sphere, but im lost as to how to get them into a .dds format to do realtime viewport reflections in an .fx shader.

its driving me nuts! :banghead:


#2

Peddy,

ATI has a nice little tool called CubeMapGen That takes all the hard work out of making a cube map. You can download it here:

http://www.ati.com/developer/cubemapgen/index.html

Once you start up the program, here are the steps to creating a cube map:

  1. In the blue section on the right, hit the “Skybox” checkbox so you can see your cube map faces in the background as they’re loaded.
  2. In the green section on the right, set “Select Cube Face” to +Y (the up direction). Then hit the “Load CubeMap Face” button. From your set of 6 images, select the image that’s in the up direction.
  3. Set “Select Cube Face” to -Y (the down direction). Hit the “Load CubeMap Face” button. Select the image that’s in the down direction.
  4. Set “Select Cube Face” to +Z (the forward direction). Hit the “Load CubeMap Face” button. Select the image that’s in the forward direction.
  5. Set “Select Cube Face” to -Z (the back direction). Hit the “Load CubeMap Face” button. Select the image that’s in the back direction.
  6. Set “Select Cube Face” to +X (the right direction). Hit the “Load CubeMap Face” button. Select the image that’s in the right direction.
  7. Set “Select Cube Face” to -X (the left direction). Hit the “Load CubeMap Face” button. Select the image that’s in the left direction.
  8. Now that all six of your panels are loaded, switch the “Display CubeMap” drop-down to “Output”. The sphere in the center will turn black because you haven’t generated any output yet.
  9. Hit the “Filter Cubemap” button toward the bottom. CubemapGen will work for a few seconds and then your sphere will display the filtered version of your cubemap.
  10. To save out your cube map, Hit “Save CubeMap (.dds)” toward the top and give your cube map a name.

That’s it, your done. Now you can load the resulting DDS file into an FX shader as a cube map.

Before this tool came out, I made cube maps in Photoshop by pasting all of the panels into a single image where they were all in a row. Then I used the Nvidia DDS plugin to save the image in cube map format, but that was a lot more laborious because you have to paste and align all of the panels by hand. Another advantage to this new tool is that it correctly creates the mip maps so that they don’t have seams around the edges at lower levels. Just be sure that you check the “Save Mipchain” box before you output your DDS file.

Let me know if you need more help.


#3

thanks a million for that bcloward, I’ve been looking for a tool like this forever - i’ve never got into cubemaps because I never knew how they were made but now I will have an experiment :smiley:


#4

Here’s another cool trick - if you start with a high dynamic range light probe image in verticle cross format, such as the ones found on this page:

http://www.debevec.org/Probes/

you can load that straight into CubeMapGen with the “Load Cube Cross” button. That will save you the time of loading six panels, one at a time. The really cool thing about starting with a HDR image is that the DDS format also supports high dynamic range, so you can create a high dynamic range cube map in DDS format and use that with your shaders. I’ve been doing that lately and getting really nice results.

To save out your cube map in HDR, choose “float16 RGB” from the Output Cube Format drop down box in CubeMapGen. (I think you might have to have a video card that supports shader model 3 in order for that option to work.) Then just click the “Save CubeMap (.dds)” button like usual and you’ll get an HDR cube map.


#5

sweet, cheers. ill give that a shot shortly and hopefully itll work. the ATI tool doesnt appear to be hardware dependant.


#6

yeah it works great! pretty dang easy.

Id tried making the cubemap using the photoshop plugin - that was my first approach. i just didnt know how to do it i guess. it either output it in funky colours or as a normal map, so i dunno =\

it works now anyway, i can make any cubemap my heart desires


#7

fwiw, there’s also a small Photoshop script (runs through the File->Automate->Scripts menu) that comes with the NVIDIA texture tools – it remaps back and forth from the 6-in-a-row photoshop display that you get from DDS files to the “inverse cross” format used by HDRshop and others. Should work in both CS and CS2 (and, one presumes, CS3, CS4, etc)


#8

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.