VoxelGI

package
v0.0.0-...-c858641 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

[graphics.gd/classdb/VoxelGI]s 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. [graphics.gd/classdb/VoxelGI]s 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: graphics.gd/classdb/VoxelGI is only supported in the Forward+ rendering method, not Mobile or Compatibility.

Procedural generation: graphics.gd/classdb/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 graphics.gd/classdb/Environment.Instance.SdfgiEnabled).

Performance: graphics.gd/classdb/VoxelGI is relatively demanding on the GPU and is not suited to low-end hardware such as integrated graphics (consider graphics.gd/classdb/LightmapGI instead). To improve performance, adjust graphics.gd/classdb/ProjectSettings "rendering/global_illumination/voxel_gi/quality" and enable graphics.gd/classdb/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 graphics.gd/classdb/VoxelGI in your project's options menus. A graphics.gd/classdb/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 graphics.gd/classdb/MeshInstance3D nodes with their graphics.gd/classdb/GeometryInstance3D.Instance.GiMode set to [Geometryinstance3d.GiModeStatic]. These temporary nodes can then be hidden after baking the graphics.gd/classdb/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 [1]gdclass.VoxelGI

func (Expanded) Bake

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

Bakes the effect from all [graphics.gd/classdb/GeometryInstance3D]s marked with [Geometryinstance3d.GiModeStatic] and [graphics.gd/classdb/Light3D]s marked with either [Light3d.BakeStatic] or [Light3d.BakeDynamic]. If 'create_visual_debug' is true, after baking the light, this will generate a graphics.gd/classdb/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 graphics.gd/classdb/VoxelGI's data and debug any issues that may be occurring.

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

Note: [graphics.gd/classdb/GeometryInstance3D]s and [graphics.gd/classdb/Light3D]s must be fully ready before Instance.Bake is called. If you are procedurally creating those and some meshes or lights are missing from your baked graphics.gd/classdb/VoxelGI, use call_deferred("bake") instead of calling Instance.Bake directly.

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 [graphics.gd/classdb/GeometryInstance3D]s marked with [Geometryinstance3d.GiModeStatic] and [graphics.gd/classdb/Light3D]s marked with either [Light3d.BakeStatic] or [Light3d.BakeDynamic]. If 'create_visual_debug' is true, after baking the light, this will generate a graphics.gd/classdb/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 graphics.gd/classdb/VoxelGI's data and debug any issues that may be occurring.

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

Note: [graphics.gd/classdb/GeometryInstance3D]s and [graphics.gd/classdb/Light3D]s must be fully ready before Instance.Bake is called. If you are procedurally creating those and some meshes or lights are missing from your baked graphics.gd/classdb/VoxelGI, use call_deferred("bake") instead of calling Instance.Bake directly.

func (Instance) CameraAttributes

func (self Instance) CameraAttributes() CameraAttributes.Instance

func (Instance) Data

func (self Instance) Data() VoxelGIData.Instance

func (Instance) DebugBake

func (self Instance) DebugBake()

Calls Instance.Bake with create_visual_debug enabled.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) SetCameraAttributes

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

func (Instance) SetData

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

func (*Instance) SetObject

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

func (Instance) SetSize

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

func (Instance) SetSubdiv

func (self Instance) SetSubdiv(value Subdiv)

func (Instance) Size

func (self Instance) Size() Vector3.XYZ

func (Instance) Subdiv

func (self Instance) Subdiv() Subdiv

func (Instance) Virtual

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

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