Diffusion features parallax-corrected cubemaps. To place one, create a brush entity named cubemap_box.
Creating the entity
You can create it both with origin-brush and without.
Origin-brush (a brush with ORIGIN texture) represents a view point, where a cubemap would photograph the world from, in game.
Without the origin-brush, center of the cubemap_box entity will be used.
Important:
When making cubemap_box with an origin-brush, it is crucial to select the origin-brush first, then the cubemap brush itself, and only then press Tie to entity. This is related to how brushes are being written into a map file. If you select the origin-brush last, the correct origin won't be saved.
Texture that is applied to a cubemap brush is not important, but for the sake of visibility I use TOOLSCUBEMAP texture in diffusion.wad.
Entity parameters
cubemapsize- deprecated, does nothing. By default, the cubemap is created in the best quality already.rendermode- editor only. Sets the brush to transparent mode in the editor, for better visiblity.renderamt- editor only. The amount of brush transparency in the editor, for better visibility.
Applying a cubemap to brush faces
The logic is very simple - if a brush face, particularly a center of a surface after map compilation is inside of the cubemap volume, this surface will receive this cubemap.
If a surface is inside multiple cubemap volumes, the smallest cubemap volume will be used. Same logic applies for models, but it's worth to note that models choose their cubemaps using their entity origin.
Example: a house in the middle of a field. Placing one huge cubemap around the map will apply this cubemap to everything - both inside and outside walls of the house, and the field. Now place smaller cubemaps inside the house to replace the outside cubemap with the internal ones.
Note
The texture material file must have the parameter ReflectScale (0.0 - 1.0) for a cubemap to work. You can also adjust cubemap quality using lower resolution mip level of the cubemap image, by using ReflectLod (0 - highest quality. The higher the number, the worse the quality).
Building cubemaps
- Load the map in game.
- Enable cheats using
sv_cheats 1 - Disable culling for certain models and brushes by typing
sv_cubemap_culling 1 - Type
buildcubemapsand wait for the cubemaps to build (left bottom corner of the screen) - When done with cubemap building, revert
sv_cubemap_cullingback to 0.
Optimizing disk space
By default, each cubemap is saved as 6 TGA files, which can take a lot of disk space as well as GPU memory.
It is recommended to convert them to a single DDS file, which can be easily done using Xash3D DDS cubemap creator - an automated tool that I created for personal use.
Once DDS files are created, you can delete all TGA files. Now each cubemap will take only 1 Mb of space.