Light shafts
BeginnerDesignerArtist Light shafts, also called god rays, are visible rays of light. 0.7 倍 1.0 倍 1.2 倍 1.5 倍 2.0 倍 Xenko light shafts are based on shadow maps and use raymarching rather than post effects, so they’re visible even when the light source isn’t. Any light source that casts shadows (ie point lights, directional lights and spot lights) can cast light shafts. lights, light shafts, and light shaft bounding volumes.
1. Enable light shafts in the graphics compositor
By default, Xenko disables light shafts in new projects. To enable them:
- Asset View (in the bottom pane by default), double-click the Graphics Compositor asset. The graphics compositor editor opens.
- forward renderer node.
- Property Grid (on the right by default), next to Light shafts, click (Replace) and select LightShafts.
- light shafts checkbox is selected.
Graphics compositor page.
2. Add a light shaft component
- light you want to create light shafts. This must be a light that casts shadows (ie a point light, directional light, or spot light).
- Property Grid, in the Light component properties, make sure the Shadow checkbox is selected.
- Add component and select Light shaft.
Game Studio adds a light shaft component to the entity.
3. Add a bounding volume
light shaft bounding volume defines the area in which light shafts are created. You can add the bounding volume to the same entity that has the directional light, but it’s usually simpler to add it to a separate entity. - Asset View, click Add asset.
- Models, select a model in the shape you want the volume to be. For example, if you use a cube, light shafts will be created in a cube-shaped area. Select an asset window opens.
- Cancel to create a model without a material.
- entity. For now, it doesn’t matter where you put it; you can reposition it later.
- Property Grid, click Add component and select light shaft bounding volume.
- light shaft bounding volume component properties, next to light shaft, click (Select an asset).
- entity picker, select the entity with the directional light you want to create light shafts and click OK.
- light shaft bounding volume component properties, next to Model, click (Select an asset).
- Select an asset window, select the model you created and click OK. This model defines the shape of the light shaft bounding volume.
- transform component, position and scale the entity to cover the area where you want to create light shafts.
Tip
Scene Editor toolbar, open the gizmo options menu and use the Light shaft bounding volumes checkbox.Light shaft properties
Light shaft graphics compositor properties
graphics compositor editor, select the forward renderer node and expand Light Shafts. These properties apply globally to all the light shafts in the scene.Optimize light shafts
light component properties) or the light shaft density (in the light shaft component properties). Multiple light shafts viewed through one another can become visually noisy, as in the screenshot below: light shaft component properties, reduce the density and increase the sample count. Alternatively, add additional bounding volumes and process them separately. To do this: - Create additional bounding volumes and position them to cover the areas where you want to create light shafts. Make sure the bounding volumes don’t overlap, as this makes light shafts extra-bright.
- light shaft component properties, make sure Process bounding volumes separately is selected.
Note
Processing bounding volumes separately uses more GPU.See also
- Directional lights
- Shadows
- Graphics compositor
