Difference between revisions of "Env cubemap"

From Valve Developer Community
Jump to: navigation, search
(How to place cubemaps properly: changed "place to place" to "place to put" (avoiding homophonic nouns and verbs))
m (More cleanup, I think this time it's fine)
 
(27 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{otherlang2
+
{{lang|Env cubemap}}
|zh-tw=Env_cubemap:zh-tw
+
[[File:Cubemap_build_result.jpeg|thumb|right|A cubemap example containing the white static prop car, a sprite and decals. Note that the blue physics prop car is not visible in the cubemap because it is not static.]]
|zh-cn=Env_cubemap:zh-cn
+
{{base point|env_cubemap|internal=1|sprite=1}} It specifies a location for which a [[cubemap]] will be generated when the {{ent|buildcubemaps}} console command is executed. [[Material]]s with {{ent|$envmap}} will use the nearest cubemap as their reflection.
|de=Env_cubemap:de
 
|fr=Env_cubemap:fr
 
|ru=Env_cubemap:ru
 
}}
 
  
 +
{{intent}}
  
{{base point|env_cubemap|internal=1|sprite=1}} It specifies a location for which a [[cubemap]] will be generated when the [[buildcubemaps]] console command is executed.
+
{{note|Cubemaps will contain static props, sprites and decals, such as enemy blood and user sprays.}}
  
Objects with <code>[[$envmap]]</code>-enabled [[material]]s will use the nearest cubemap as their reflection.
+
==Keyvalues==
 +
[[File:comparison_cubemapquality.jpg|thumb|Comparison of reflection quality. 1x1 is not included because it does not reflect at all.]]
 +
{{KV|Cubemap Size (cubemapsize)|choices|The resolution of each face of the cubemap. Remember that the actual number of pixels stored will be your selection times six, so higher numbers will make for very large file sizes!
 +
:*0: Default (usually 32x32, depending on the game)
 +
:*1: 1x1
 +
:*2: 2x2
 +
:*3: 4x4
 +
:*4: 8x8
 +
:*5: 16x16
 +
:*6: 32x32
 +
:*7: 64x64
 +
:*8: 128x128
 +
:*9: 256x256
 +
:*10: 512x512 ¹ {{Not in FGD}}
 +
:*11: 1024x1024 ¹ {{Not in FGD}}
 +
:*12: 2048x2048 ¹ {{Not in FGD}}
  
{{intent}}
+
¹ - To render higher resolution cubemaps than 256x256, see [[Env_cubemap#Higher_resolution_cubemaps|below]].
 
 
==Keyvalues==
 
  
{{KV|Cubemap Size|choices|The resolution of each face of the cubemap. Remember that the actual number of pixels stored will be your selection times six!}}
+
{{KV|Brush faces (sides)|sidelist|An optional override for individual brush faces, forcing them to use this cubemap instead of one closest to them. To select faces, press the '''Pick''' button then click on them in the 3D view. Hold {{key|Ctrl}} to toggle a face on or off.}}}}
:* Default (usually 32x32, depending on the game)
 
:* 1x1
 
:* 2x2
 
:* 4x4
 
:* 8x8
 
:* 16x16
 
:* 32x32
 
:* 64x64
 
:* 128x128
 
:* 256x256
 
  
Comparison of reflection quality ''(1x1 is not included because it does not reflect at all)'':
+
== Higher Resolution Cubemaps ==
 +
[[Image:4k.jpg|thumb|423px|right|]]
 +
Turn off Smart Edit and type in a value 10 or more. That will give the resolution corresponding to the next powers of 2 (512x512, 1024x1024 etc).
 +
{{note|Building cubemaps requires your screen to be at least 4 times in each dimension as big as the cubemap's resolution. If your screen is smaller than that, use Dynamic Super Resolution (DSR) to build them. }}
 +
{{note|Having high resolution cubemaps can significantly increase the map file size. So use sparingly for things like mirrors and marble surfaces, if you're concerned about file size / client download time for multiplayer maps at least.}}
  
[[File:comparison_cubemapquality.jpg|thumb|center]]
+
== Placement ==
 +
Declaring areas for cubemaps to cover is simple, just place an <code>env_cubemap</code> point entity inside the space of a map. When the map is compiled with [[vbsp|VBSP]], world geometry surfaces automatically associate themselves with the nearest <code>env_cubemap</code> and will use the cubemap generated from it. Entities associate themselves with the <code>env_cubemap</code> closest to their origin (alternatively, a cubemap can be applied to specific brush faces in the cubemap's properties); moving entities will dynamically change which cubemap they use. It is important to choose <code>env_cubemap</code> positions properly for both aesthetic and performance issues.
  
{{KV|Brush faces|sidelist|An optional override for individual brush faces, forcing them to use this cubemap instead of one closest to them.<br/> To select faces, press the "Pick" button then click on them in the 3D view. Hold {{key|Ctrl}} to toggle a face on or off.}}
+
Cubemaps are used in a few specific ways, and should be placed accordingly. Some cubemaps are used for reflections on static world geometry. Others are used with player entities, including [[NPC|NPCs]]. And the rest are used for any non-player reflective entities. The optimal placement of <code>env_cubemap</code> entities corresponds with each of these uses, to ensure the maximal benefit, ''visually and in performance.'' Here are a few simple heuristics to follow:
  
==How to place cubemaps properly==
+
* If a cubemap is intended for NPCs or the player, the <code>env_cubemap</code> should be placed at eye-level (usually 64 hammer units) above the ground. This way, the cubemap will most accurately represent the world from the perspective of the player.
 +
{{tip|You can achieve this by copy-pasting <code>env_cubemap</code> entities around the map floor and then use Hammer's '''Entity Report''' function to select all <code>env_cubemap</code> entities and then moving them 64 units upward by using the '''Transform''' tool {{key|Ctrl+M}}. }}
 +
* If a cubemap is intended for static world geometry, the <code>env_cubemap</code> should be a fair distance (as a rule of thumb, 16 Hammer units) away from all brush surfaces.
 +
*A different cubemap should be taken in each area of distinct visual contrast. A hallway with bright yellow light will need its own <code>env_cubemap</code>, especially if it is next to a room with low blue light. Without two <code>env_cubemap</code> entities, reflections and specular highlights will seem incorrect on entities and world geometry in one of the areas.
 +
* Location changes, such as one room-to-room, room-to-outside and general location changes with great visual changes need <code>env_cubemap</code> entities with equal distance in both locations to the transition point. For example 16 units away from the doorway into each rooms. That way the cubemap transition between locations is smooth. This will prevent the cubemap from showing the outside location inside the room and vice versa.
  
# Place the env_cubemap in the center of the rooms you want it in (unless there is a reason not to, e.g if the cubemap will be placed inside a prop, or there is a better place to put it).
+
== Building Cubemaps ==
# Make a brush that is 64 units high and place it beside one of the env_cubemaps.
+
For general and game specific information about building cubemaps, visit the [[Cubemaps]] page.  
# Go top map->Entity Report and mark all your env_cubemap entities.
 
# When marked, move the one beside the brush you made upwards, until it reaches the top line of the brush.
 
# Delete the brush you made.
 
# Compile-> And in game open the console and type "buildcubemaps".
 
  
[[file:http://i.gyazo.com/336c66a1eaabd7283a2080ede7217d75.png|thumb|Example of how the env_cubemap should look when placed in the correct height]]
+
== See Also ==
The map will now reload with the new cubemaps built. The reason you want to raise the cubemaps by 64 units is because this is the height that the players see in.
+
*{{ent|weapon_cubemap}}

Latest revision as of 14:57, 29 December 2019

Deutsch Français Русский 简体中文 简体中文 
A cubemap example containing the white static prop car, a sprite and decals. Note that the blue physics prop car is not visible in the cubemap because it is not static.
Env cubemap.png
env_cubemap is an internal point entity available in all Source games. It specifies a location for which a cubemap will be generated when the buildcubemaps console command is executed. Materials with $envmap will use the nearest cubemap as their reflection.
Note:This is an internal entity. When the map is compiled by VBSP it is processed and then removed: it does not exist when the map is running.
Note:Cubemaps will contain static props, sprites and decals, such as enemy blood and user sprays.

Keyvalues

Comparison of reflection quality. 1x1 is not included because it does not reflect at all.
Cubemap Size (cubemapsize) <choices>
The resolution of each face of the cubemap. Remember that the actual number of pixels stored will be your selection times six, so higher numbers will make for very large file sizes!
  • 0: Default (usually 32x32, depending on the game)
  • 1: 1x1
  • 2: 2x2
  • 3: 4x4
  • 4: 8x8
  • 5: 16x16
  • 6: 32x32
  • 7: 64x64
  • 8: 128x128
  • 9: 256x256
  • 10: 512x512 ¹ !FGD
  • 11: 1024x1024 ¹ !FGD
  • 12: 2048x2048 ¹ !FGD

¹ - To render higher resolution cubemaps than 256x256, see below.

Brush faces (sides) <sidelist>
An optional override for individual brush faces, forcing them to use this cubemap instead of one closest to them. To select faces, press the Pick button then click on them in the 3D view. Hold Ctrl to toggle a face on or off.

Higher Resolution Cubemaps

4k.jpg

Turn off Smart Edit and type in a value 10 or more. That will give the resolution corresponding to the next powers of 2 (512x512, 1024x1024 etc).

Note:Building cubemaps requires your screen to be at least 4 times in each dimension as big as the cubemap's resolution. If your screen is smaller than that, use Dynamic Super Resolution (DSR) to build them.
Note:Having high resolution cubemaps can significantly increase the map file size. So use sparingly for things like mirrors and marble surfaces, if you're concerned about file size / client download time for multiplayer maps at least.

Placement

Declaring areas for cubemaps to cover is simple, just place an env_cubemap point entity inside the space of a map. When the map is compiled with VBSP, world geometry surfaces automatically associate themselves with the nearest env_cubemap and will use the cubemap generated from it. Entities associate themselves with the env_cubemap closest to their origin (alternatively, a cubemap can be applied to specific brush faces in the cubemap's properties); moving entities will dynamically change which cubemap they use. It is important to choose env_cubemap positions properly for both aesthetic and performance issues.

Cubemaps are used in a few specific ways, and should be placed accordingly. Some cubemaps are used for reflections on static world geometry. Others are used with player entities, including NPCs. And the rest are used for any non-player reflective entities. The optimal placement of env_cubemap entities corresponds with each of these uses, to ensure the maximal benefit, visually and in performance. Here are a few simple heuristics to follow:

  • If a cubemap is intended for NPCs or the player, the env_cubemap should be placed at eye-level (usually 64 hammer units) above the ground. This way, the cubemap will most accurately represent the world from the perspective of the player.
Tip:You can achieve this by copy-pasting env_cubemap entities around the map floor and then use Hammer's Entity Report function to select all env_cubemap entities and then moving them 64 units upward by using the Transform tool Ctrl+M.
  • If a cubemap is intended for static world geometry, the env_cubemap should be a fair distance (as a rule of thumb, 16 Hammer units) away from all brush surfaces.
  • A different cubemap should be taken in each area of distinct visual contrast. A hallway with bright yellow light will need its own env_cubemap, especially if it is next to a room with low blue light. Without two env_cubemap entities, reflections and specular highlights will seem incorrect on entities and world geometry in one of the areas.
  • Location changes, such as one room-to-room, room-to-outside and general location changes with great visual changes need env_cubemap entities with equal distance in both locations to the transition point. For example 16 units away from the doorway into each rooms. That way the cubemap transition between locations is smooth. This will prevent the cubemap from showing the outside location inside the room and vice versa.

Building Cubemaps

For general and game specific information about building cubemaps, visit the Cubemaps page.

See Also