Skip to content
github-actions[bot] edited this page Jul 30, 2026 · 2 revisions

Veil offers deferred lighting as an option to provide more advanced and realistic lighting in comparison to vanilla Minecraft's block lighting system.

Light Types

By default, Veil offers three different types of lighting: point lights, area lights, and directional lights. Each light has its own associated data, and custom light types can be defined using LightTypeRegistry.

Light Data

Each light has its own instance of LightData associated with it. To create custom light data, simply extend LightData into its own class and add your desired fields. You may also use InstancedLightData or IndirectLightData to use different types of renderers (see below).

Point lights emit light uniformly in all directions from a single point. Each point light has the properties of IndirectLightData, that being a position and a radius.

Area lights emit light from a quad, which can be rotated to face any direction. Area lights have the same position property as point lights, but in addition have distance, angle, and orientation.

Directional lights, unlike point and area lights, do not have a position, merely having a direction property. Directional lights simulate the sun, shadowing faces away from the light.

Spot lights emit light from a point, which can be rotated to face any direction. Spot lights have the same values as Area lights except it has one size value instead of separate width and height values.

Light Renderers

Each light type additionally its own LightTypeRenderer. Each LightTypeRenderer is responsible for rendering all lights of its assigned types. Lights that have a position (like point and area lights) can extend the InstancedLightRenderer to have some methods built in.

Digital Differential Analyzer (DDA) Occlusion

DDA lights is a method of occlusion to render cheap shadows. It is limited in the sense that it can only being able to occlude full blocks, and not more complex models like entities. To use DDA, your renderer should implement the interface DDALightRenderer and your data should implement DDALightData.

Creating Lights in the World

Using Veil's lighting system is simple, and like Quasar, there are two ways to do it: using the editor (F6 by default) menu or with code.

Using the Light Editor

Veil's light editor can be accessed under the "Renderer" menu. Upon clicking the "Add Light" button, a light of the specified type (which can be changed by clicking on the 3 buttons below) will be spawned into the world at your camera's location and orientation (if the light type has one). Each light will be assigned a random name generated by Minecraft's DebugEntityNameGenerator. By clicking the dropdown, you can view the properties of the light and edit them.

Using Code

To create a light in code, you first must create an instance of the desired light data. For this tutorial, we will be using PointLightData

/**
 * Create a light.
 */
public static void createPointLight(Vector3d position, float radius) {
    PointLightData pointLightData = new PointLightData();
    pointLightData.setPosition(position);
    pointLightData.setRadius(radius);
    
    // The handle returned by addLight can be used to modify the data of the light at runtime.
    LightRenderHandle<PointLightData> handle = VeilRenderSystem.renderer().getLightRenderer().addLight(pointLightData);
    handle.getLightData().setColor(Color.RED); // See [Colors](Colors)
}

To remove a light, you can simply call remove on the LightRenderHandle.

public static void removeLight(LightRenderHandle<?> handle) {
    handle.free();
}

Clone this wiki locally