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 ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) AsVoxelGI() Instance
- func (self Instance) Bake()
- func (self Instance) CameraAttributes() CameraAttributes.Instance
- func (self Instance) Data() VoxelGIData.Instance
- func (self Instance) DebugBake()
- func (self Instance) ID() ID
- func (self Instance) SetCameraAttributes(value CameraAttributes.Instance)
- func (self Instance) SetData(value VoxelGIData.Instance)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSize(value Vector3.XYZ)
- func (self Instance) SetSubdiv(value Subdiv)
- func (self Instance) Size() Vector3.XYZ
- func (self Instance) Subdiv() Subdiv
- func (self Instance) Virtual(name string) reflect.Value
- type Subdiv
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 Expanded ¶
func (Expanded) 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.
type Extension ¶
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]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type 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.
type Instance ¶
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 (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.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) SetCameraAttributes ¶
func (self Instance) SetCameraAttributes(value CameraAttributes.Instance)
func (Instance) SetData ¶
func (self Instance) SetData(value VoxelGIData.Instance)
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 )