How regular lights work in Voxel Play?

Modified on Tue, 30 May 2023 at 10:26 PM

Voxel Play renders lights in different ways.


Custom Point Light rendering


Use the "Bright Point Lights" in the Voxel Play Environment to render point lights in the voxel world. In built-in pipeline, Voxel Play is limited to point lights using this option (with no shadows). For URP, read the section dedicated to URP below.


When this option is enabled, Voxel Play shaders support up to 32 simultaneous point lights in a single pass. The Voxel Play Light Manager script attached to the camera is responsible for keeping the internal buffer of light data updated as the character moves around, picking the 32 nearest point lights to the camera while also feeding shaders with data as light color, intensity and range.


Voxel shaders are compatible with this kind of light rendering. If you want to get this light applied to your character models, make sure you use one of the factory Voxel Play materials.


To avoid checking for new lights continuously, attach the script VoxelPlayLight to the point light gameobject. This script takes care of registering/unregistering the light with Voxel Play automatically.


Each point light can have a different color, range and intensity of course. However, there're two global settings that can modify how point lights look in the scene. These settings can be found in your World Definition:



The Light Scattering is a multiplier to the point light range.

The LIght Intensity Multiplier affects the point light intensity.


If you want point lights to look like in regular Unity scenes, make sure both values are set to 1.


Note that in Voxel Play there's also voxel global illumination (also called smooth lighting) which means light spreads across empty spaces in the voxel world. For example, when you place a torch it has both a point light and also emits voxel light. To avoid burning effect (too much light due to both light contributions), Voxel Play uses a very short Light Scattering value so the point light only is visible at the point light position while the rest of the area is illuminated by the voxel light spread. This provides the best look since the voxel lighting can bounce around corners while point lights not.


Increasing the maximum number of active point lights


If you need to use more than 32 point lights active in the scene, you can increase this number by modifying the limits defined in VoxelPlayLightManager.cs script and VPCommonOptions.cginc shader file.



Virtual Point Lights


You can also add the VoxelPlayLight component to an empty gameobject and enable the checkbox "Virtual Light". This will add a light with the desired color, intensity and range even if there's no light component attached. This option is more performant than adding a real point light to the scene, however, it will only illuminate objects that use Voxel Play shaders.


As you can see, this feature is just an extension to the existing point light support but that doesn't require a Light component since properties like light color, intensity or range are provided by the user.




Universal Rendering Pipeline native light support


In URP and if "Bright Point Lights" and "Enable URP Native Lights" options are selected in the VoxelPlay Environment inspector, Voxel Play will render point lights and spot lights as you would expect, including shadows.


Make sure that the URP asset used in Project Settings / Graphics or Project Settings / Quality has the "Additional Lights" set to "Per Pixel" and also enable the shadows option there.


In this case, limitations and options related to URP lighting applies, including the maximum 8 lights per object (as of URP 12 or below). This means that you can't have more than 8 lights illuminating the same chunk.


Also, no additional setup is required. This means that when this mode is used, you don't need to add a VoxelPlayLight script to your lights.


Note: URP native lights require Voxel Play 2 (v10.0 or later).

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article