Cube maps: Difference between revisions
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
envshot water_pool 512 | 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 | 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 | ||
Line 62: | Line 62: | ||
[http://img157.imageshack.us/img157/7884/envshot2iz1.jpg http://img157.imageshack.us/img157/7884/envshot2iz1.th.jpg] | [http://img157.imageshack.us/img157/7884/envshot2iz1.jpg http://img157.imageshack.us/img157/7884/envshot2iz1.th.jpg] | ||
==Write a material shader== | |||
Open an already existing material file or create a new one. Add the following shader: | |||
textures/env/water_pool | |||
{ | |||
qer_editorimage env/water_pool_up.tga | |||
noFragment | |||
noshadows | |||
noimpact | |||
nooverlays | |||
forceOpaque | |||
nonsolid | |||
{ | |||
forceHighQuality | |||
blend add | |||
cameraCubeMap env/water_pool | |||
texgen reflect | |||
} | |||
} | |||
If you have forceOpaque in your shader, the texture will be opaque and you will not be able to see the ground. If you leave it out, it will be semi-transparent and you can see the ground also. | |||
== | ==Get your enviromental map ingame== | ||
* Open darkRadiant (if you already have it open you might have to close and reopen it to be able to see the texture). | |||
* Draw a brush that is going to be your water. Texture it with common/nodraw. | |||
* Go to the media browser. You should find your texture in the /env folder. | |||
[http://img339.imageshack.us/img339/7849/envshot3na3.jpg http://img339.imageshack.us/img339/7849/envshot3na3.th.jpg] | |||
* Select it and apply it to the top face of the water brush. You should now see the water_pool_up image as editor image (that's what the qer_editorimage line in the shader was for). Scale and position of the texture is not important. | |||
[http://img267.imageshack.us/img267/7850/envshot4hw9.jpg http://img267.imageshack.us/img267/7850/envshot4hw9.th.jpg] | |||
* Convert the brush to a func_liquid. (You don't want to be able to walk on water, do you? That would happen if you didn't convert your brush) |
Revision as of 16:02, 20 April 2007
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:
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:
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:
Write a material shader
Open an already existing material file or create a new one. Add the following shader:
textures/env/water_pool { qer_editorimage env/water_pool_up.tga noFragment noshadows noimpact nooverlays forceOpaque nonsolid { forceHighQuality blend add cameraCubeMap env/water_pool texgen reflect } }
If you have forceOpaque in your shader, the texture will be opaque and you will not be able to see the ground. If you leave it out, it will be semi-transparent and you can see the ground also.
Get your enviromental map ingame
- Open darkRadiant (if you already have it open you might have to close and reopen it to be able to see the texture).
- Draw a brush that is going to be your water. Texture it with common/nodraw.
- Go to the media browser. You should find your texture in the /env folder.
- Select it and apply it to the top face of the water brush. You should now see the water_pool_up image as editor image (that's what the qer_editorimage line in the shader was for). Scale and position of the texture is not important.
- Convert the brush to a func_liquid. (You don't want to be able to walk on water, do you? That would happen if you didn't convert your brush)