Cube maps

From The DarkMod Wiki
Revision as of 13:36, 20 April 2007 by 129.27.239.66 (talk)
Jump to navigationJump to search

How to create a cube map (also called environmental map) of your environment using the envshot command in Doom3

Create your room

Create the room you want to have your pseudo-reflective water in. Add all the large parts, but you can leave small details (and of course the AI) out. Your room might for example look like this:


shot00127wq7.th.jpg

Create your images

  • Set the screen resolution of Doom3 to 640 x 480. If you don't do that, part of your images might be cut of and they will not fit together any more. You might have to close and reopen Doom3 for the changes to take place.
  • Make sure you are on full screen before you take your images. (If you don't, you can see windows task bar and it doesn't look that good ingame.) If you are in windowed mode, you can change to full screen by pressing Alt + Enter.
  • Open your map in Doom3 and get to the position of your water. In the console, type
envshot [prefix] [size]

[prefix] is how the images are going to be named. The size should be in powers of two. For example, your command could look like this:

envshot water_pool 512

Press enter, and you will see some flickering on the sreen while your images are created, and a message in the console will appear saying

Wrote env/water_pool_nz.tga,etc

(You might want to make a few more envshots at slightly different positions, so that you don't have to repaet the whole procedure if your images are not appropriate.)

  • You should now find six new images in your /env folder:
water_pool_nx.tga
water_pool_ny.tga
water_pool_nz.tga
water_pool_px.tga
water_pool_py.tga
water_pool_pz.tga

looking like this:

envshotli0.th.jpg

Edit your images

If you leave the images like this, they will not work ingame. You have to rename them to _up, _down, etc and there is also some rotating / flipping required.

  • Rename water_pool_pz to water_pool_up. Flip it horizontally and rotate it 90° counter clock wise.
  • Rename water_pool_py to water_pool_left. Rotate it 180° and flip it horizontally. This is going to be located at the north.
  • Rename water_pool_ny to water_pool_right. Flip it horizontally. This is going to be loacted at the south.
  • Rename water_pool_nx to water_pool_back. Rotate it 90° counter clock wise and flip it horizontally. This is going to be located at the west.
  • Rename water_pool_px to water_pool_forward. Rotate it 90° clock wise and flip it horizontally. This is going to be located at the east.
  • Rename water_pool_nz to water_pool_down. You don't have to manipulate the direction here, since it is located at the bottom and will not be visible anyway.

You should now have six files in your /env folder called

water_pool_back
water_pool_down
water_pool_forward
water_pool_left
water_pool_right
water_pool_up

looking like this:

envshot2iz1.th.jpg


Write a material shader

Get your enviromental map ingame