VoxelGI

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

VoxelGIs are used to provide high-quality real-time indirect light and reflections to scenes. They precompute the effect of objects that emit light and the effect of static geometry to simulate the behavior of complex light in real-time. VoxelGIs need to be baked before having a visible effect. However, once baked, dynamic objects will receive light from them. Furthermore, lights can be fully dynamic or baked.

Note: VoxelGI is only supported in the Forward+ rendering method, not Mobile or Compatibility.

Procedural generation: VoxelGI can be baked in an exported project, which makes it suitable for procedurally generated or user-built levels as long as all the geometry is generated in advance. For games where geometry is generated at any time during gameplay, SDFGI is more suitable (see Environment.SdfgiEnabled).

Performance: VoxelGI is relatively demanding on the GPU and is not suited to low-end hardware such as integrated graphics (consider LightmapGI instead). To improve performance, adjust ProjectSettings "rendering/global_illumination/voxel_gi/quality" and enable ProjectSettings "rendering/global_illumination/gi/use_half_resolution" in the Project Settings. To provide a fallback for low-end hardware, consider adding an option to disable VoxelGI in your project's options menus. A VoxelGI node can be disabled by hiding it.

Note: Meshes should have sufficiently thick walls to avoid light leaks (avoid one-sided walls). For interior levels, enclose your level geometry in a sufficiently large box and bridge the loops to close the mesh. To further prevent light leaks, you can also strategically place temporary MeshInstance3D nodes with their GeometryInstance3D.GiMode set to [Geometryinstance3d.GiModeStatic]. These temporary nodes can then be hidden after baking the VoxelGI node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsVoxelGI() Instance
}

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsVisualInstance3D

func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance

func (*Extension[T]) AsVoxelGI

func (self *Extension[T]) AsVoxelGI() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.VoxelGI

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsVisualInstance3D

func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance

func (Instance) AsVoxelGI

func (self Instance) AsVoxelGI() Instance

func (Instance) Bake

func (self Instance) Bake()

Bakes the effect from all GeometryInstance3Ds marked with [Geometryinstance3d.GiModeStatic] and Light3Ds marked with either [Light3d.BakeStatic] or [Light3d.BakeDynamic]. If 'create_visual_debug' is true, after baking the light, this will generate a MultiMesh that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the VoxelGI's data and debug any issues that may be occurring.

Note: Bake works from the editor and in exported projects. This makes it suitable for procedurally generated or user-built levels. Baking a VoxelGI node generally takes from 5 to 20 seconds in most scenes. Reducing Subdiv can speed up baking.

Note: GeometryInstance3Ds and Light3Ds must be fully ready before Bake is called. If you are procedurally creating those and some meshes or lights are missing from your baked VoxelGI, use call_deferred("bake") instead of calling Bake directly.

func (Instance) CameraAttributes

func (self Instance) CameraAttributes() CameraAttributes.Instance

The CameraAttributes resource that specifies exposure levels to bake at. Auto-exposure and non exposure properties will be ignored. Exposure settings should be used to reduce the dynamic range present when baking. If exposure is too high, the VoxelGI will have banding artifacts or may have over-exposure artifacts.

func (Instance) Data

func (self Instance) Data() VoxelGIData.Instance

The VoxelGIData resource that holds the data for this VoxelGI.

func (Instance) DebugBake

func (self Instance) DebugBake()

Calls Bake with create_visual_debug enabled.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) SetCameraAttributes

func (self Instance) SetCameraAttributes(value CameraAttributes.Instance)

SetCameraAttributes sets the property returned by [GetCameraAttributes].

func (Instance) SetData

func (self Instance) SetData(value VoxelGIData.Instance)

SetData sets the property returned by [GetProbeData].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSize

func (self Instance) SetSize(value Vector3.XYZ)

SetSize sets the property returned by [GetSize].

func (Instance) SetSubdiv

func (self Instance) SetSubdiv(value Subdiv)

SetSubdiv sets the property returned by [GetSubdiv].

func (Instance) Size

func (self Instance) Size() Vector3.XYZ

The size of the area covered by the VoxelGI. If you make the size larger without increasing the subdivisions with Subdiv, the size of each cell will increase and result in lower detailed lighting.

Note: Size is clamped to 1.0 unit or more on each axis.

func (Instance) Subdiv

func (self Instance) Subdiv() Subdiv

Number of times to subdivide the grid that the VoxelGI operates on. A higher number results in finer detail and thus higher visual quality, while lower numbers result in better performance.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type MoreArgs

type MoreArgs [1]gdclass.VoxelGI

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) Bake

func (self MoreArgs) Bake(from_node Node.Instance, create_visual_debug bool)

Bakes the effect from all GeometryInstance3Ds marked with [Geometryinstance3d.GiModeStatic] and Light3Ds marked with either [Light3d.BakeStatic] or [Light3d.BakeDynamic]. If 'create_visual_debug' is true, after baking the light, this will generate a MultiMesh that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the VoxelGI's data and debug any issues that may be occurring.

Note: Bake works from the editor and in exported projects. This makes it suitable for procedurally generated or user-built levels. Baking a VoxelGI node generally takes from 5 to 20 seconds in most scenes. Reducing Subdiv can speed up baking.

Note: GeometryInstance3Ds and Light3Ds must be fully ready before Bake is called. If you are procedurally creating those and some meshes or lights are missing from your baked VoxelGI, use call_deferred("bake") instead of calling Bake directly.

type Subdiv

type Subdiv int //gd:VoxelGI.Subdiv
const (
	// Use 64 subdivisions. This is the lowest quality setting, but the fastest. Use it if you can, but especially use it on lower-end hardware.
	Subdiv64 Subdiv = 0
	// Use 128 subdivisions. This is the default quality setting.
	Subdiv128 Subdiv = 1
	// Use 256 subdivisions.
	Subdiv256 Subdiv = 2
	// Use 512 subdivisions. This is the highest quality setting, but the slowest. On lower-end hardware, this could cause the GPU to stall.
	Subdiv512 Subdiv = 3
	// Represents the size of the [Subdiv] enum.
	SubdivMax Subdiv = 4
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL