What are cubemaps?
To make it simple, predefined reflections for surfaces to well…. Reflect.
Why are cubemaps used?
To do real-time reflections the engine needs to take what the player sees, flip it up-side-down, distort it to make it look reflected, and then draw it to the surface. Doing this frame will take way too much processing power to be worth it…. So that is what cubemaps are used for.
How do cubemaps work?
A cubemap is a point entity (env_cubemap) that you place on your map…. They should be placed in the following areas:
Using cubemaps
Once you have the cubemaps in your map, you compile your map; however, the only things your cubemaps are reflecting are the default ones provided by the skybox, so whether your reflective surface in inside or out, it will be reflecting clouds.
This is what a map looks like with NO env_cubemap entities… ewww, the black/purple checks are what get displayed then a texture can’t be found… and because there are not cubemaps, it doesn’t know that to reflect.
But when we toss in some env_cubemap’s… this is what we get…. A little better.
Notice though, how the water does not reflect the cube (That black mark in the water was me accidently shooting). Why? We haven’t yet done what is known as ‘building our cubemaps’.
Building cubemaps
The process of building your cubemaps is actually quite simple. In fact all it takes is one console command: ‘buildcubemaps’. However, before you do that you first need to set up your map, by typing the following commands into the console.
Now the water looks much nicer, and if you look close enough, the cap point will reflect the sky.
To make it simple, predefined reflections for surfaces to well…. Reflect.
Why are cubemaps used?
To do real-time reflections the engine needs to take what the player sees, flip it up-side-down, distort it to make it look reflected, and then draw it to the surface. Doing this frame will take way too much processing power to be worth it…. So that is what cubemaps are used for.
How do cubemaps work?
A cubemap is a point entity (env_cubemap) that you place on your map…. They should be placed in the following areas:
- Near reflective surfaces
- Windows
- Water (Should be tied to the water face, so it only applies to that face)
- Near reflective entities
Some examples:- Cap points
- Direction signs
- In areas of high contrast
- If you have a dark room, you don’t want things reflecting the bright outside or vice-versa
Using cubemaps
Once you have the cubemaps in your map, you compile your map; however, the only things your cubemaps are reflecting are the default ones provided by the skybox, so whether your reflective surface in inside or out, it will be reflecting clouds.
This is what a map looks like with NO env_cubemap entities… ewww, the black/purple checks are what get displayed then a texture can’t be found… and because there are not cubemaps, it doesn’t know that to reflect.
But when we toss in some env_cubemap’s… this is what we get…. A little better.
Notice though, how the water does not reflect the cube (That black mark in the water was me accidently shooting). Why? We haven’t yet done what is known as ‘building our cubemaps’.
Building cubemaps
The process of building your cubemaps is actually quite simple. In fact all it takes is one console command: ‘buildcubemaps’. However, before you do that you first need to set up your map, by typing the following commands into the console.
- Compile and load your map.
- mat_specular 0
This turns off reflections. - buildcubemaps
The game will pause for a second, and lots of little pictures will flash up the top of the screen. - disconnect
If you are not using HDR, you can step to step 11 - mat_hdr_level 0
Turn off HDR. - map “your_map_name”
Load the map again - buildcubemaps
- disconnect
- mat_specular 1
- mat_hdr_level 2
- map “cp_dustbowl”
We need to load another map, to clear the caches of your map contents, otherwise it will not reload any of the cubemaps. - Disconnect again, and load up your map. Enjoy!
Now the water looks much nicer, and if you look close enough, the cap point will reflect the sky.
Last edited: