Cube Map

From HEWIKI
Jump to: navigation, search

A cube map is a texture that contains image data representing the scene surrounding an object, as if the object were in the center of a cube. It's an inexpensive way to enhance the look of anything with a specular highlight or reflectivity--such as water or metal objects--by faking a reflection: instead of rendering the entire scene again to generate an accurate reflection, a shader can quickly look up a location in the cube map that represents approximately where you're looking. Because of their non-dynamic nature, cube maps are less accurate than true reflections, but often they're "good enough," since many types of reflections tend to be blurred and distorted anyway.

Cube maps are defined in the Environment Scheme for an area.

Viewing Cubemaps

To view existing cubemaps, navigate to the appropriate .dds file in the Repository Browser, download the file to your own system, and then view it with a program such as ddsview.exe. This will have a button at the top of the interface which will allow you to "View Cubemap" and will "unwrap" the six sides so that you can see them.

With Clean Engine, you will receive one default Cubemap called hero_cubemap.dds:

Hero cubemap.gif

Authoring Cubemaps

To create a cube map in Photoshop, first decide how big each face of the cube should be. The only requirement is that this size is a power of 2: 256x256 or 512x512 are good sizes to choose from. You may be able to get away with something even smaller (like 64x64), since blurred reflections occur naturally. Start by making a new PSD document that is (4 x width of a cube face) pixels wide by (3 x width of a cube face) pixels high and placed in a cross arrangement(Fig. 1).

Figure 1


This arrangement allows you to preview your map on a cube in 3dsMax or Maya and provides an efficient way of editing and blending your edges.


Since it's a cube, all the edges must be blended. The Left, Front, Right, and Back panels naturally blend together as well as the Top, Front, and Bottom panels. The trick is getting the proper blend from the Top and Bottom panels to carry over to the side panels.


The following image(Fig. 2) is an example of how these edges line up.

Figure 2

Now that we have our image properly blended, we need to rearrange these panels so that HeroEngine can read them properly. Open a new Photoshop document that is (6 x the width of a cube face) pixels wide by the height of a single cube face. The order of the 6 image panels should be placed as follows without changing it's orientation: Right, Left, Top, Bottom, Front, Back. This can also be referred to as Positive X, Negative X, Positive Y, Negative Y, Positive Z, Negative Z in 3D space (imagine yourself standing at the center of the cube).

Cubemap cloudy text wide.jpg

At this point we can now flatten our document layers and save this out as an NVidia DDS file.

When saving out a cube map, make sure to have the following settings:

Nvidia cubemap box.jpg

The image thumbnail that you will see from the resulting DDS is just of 1 panel and represented as a square image.

If you want to double check the results of your image open up ddsview.exe and toggle the cube map button. It will take your thumbnail image and open it up to its initial state as in Fig .1 above.

Ddsview menu.jpg

The last thing to do is upload the image into the repository at a location of your choice.

See also

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox