This tutorial showcases how to change the texture size of shadows casted by lights.
Texture size options
Supported texture sizes include: 512px, 1024px, 2048px, 4096px, 8192px, 16384px.
The default shadow texture size for all lights is 2K. The default max texture size is 16K, but for less powerful computers, it may be a lower value, like 8K.
Changing shadow texture size
The shadow texture size can be changed for the GUI with the usage of the Minimal Scene GUI plugin in the SDF.
Currently, light type is restricted to only directional light. As a scene should typically have at most one directional light (representing the sun), this will ensure that an increase in shadow texture size does not increase VRAM too much.
Example usage for the GUI
Let's change the shadow texture size for directional light with the SDF file below. (The finished SDF file can be viewed here.)
1) Save the below in an SDF file named shadow_texture_size.sdf
:
2) Add the following lines to the Minimal Scene GUI plugin.
The <texture_size>
value can be changed as per the Texture size options section.
3) Open the shadow_texsize_demo.sdf
world with
Impact on VRAM usage
Keep in mind that the larger the shadow texture size, the more VRAM is used. Thus, in a scene populated with many lights, changing the directional light's shadow texture size should be fine because there is typically only one directional light in a scene. But if the scene has many point lights and the point light's shadow texture size is increased, the VRAM consumption goes up significantly.