Dds cubemaps

From SIMboxWiki
Jump to navigation Jump to search

A cubemap or cubic environment map is a special layout of a panorama, that uses six square images, representing six directions (front, back, left, right, up, down), all of which are combined into a single image.  Often used in computer games, this layout gives the least amount of distortion and wastes as little texture space as possible.

Cubemaps can be downloaded from the web or generated inside a 3d package, usually as six separate images. To generate the six images in 3ds Max, follow this procedure:

  1. Install Nvidia's DDS tools for Photoshop from: https://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop
  2. Open a scene you wish to render to six textures.
  3. Create a camera or other object in the point you wish the rendered images to be taken from.
  4. Open the Material Editor. Create a new material.
  5. Click the material's reflection slot, and in the Material/Mpa Browser select Reflect/Refract.
  6. In the Reflect/Refract parameters, set the source to From File.
  7. Set the size to the desired images size in pixels (usually 256 should be enough).
  8. At the bottom of the rollout, click the empty slot labeled "To File", and select the output format, name and path. This could be any format such as png or tga.
  9. Click the button labeled Pick Object and Render Maps, then pick the object to use as the origin point of the render - the one created in step 3.
  10. Once the object is selected, 3ds max renders six files. each has an additional couple of letters to indicate direction - BK for Back, RT for right, etc.
  11. Load all six files in Photoshop and arrange them in a single strip file according to the following template. Notice the up and down images should be rotated - the "down" image clockwise, and the "up" image counter-clockwise.
    Cubemap TEMPLATE.png
  12. Save the image as a DDS file. In the DDS export dialog, find the map type dropdown (second from top, and set to "2D Texture" by default), and set it to Cube Map. Click Save.


Cubemaps may not display properly inside 3ds max, however if they are loaded as reflection maps they will be detected and correcly configured in the exported mesh file.

An example of an input strip in Photoshop:

Cubestrip.jpg

An example of a sphere model using the resulting dds cubemap:

Cubmap model.jpg