mirror of
https://github.com/godotengine/godot.git
synced 2024-12-27 11:24:59 +08:00
385ee5c70b
This allows light sources to be specified in physical light units in addition to the regular energy multiplier. In order to avoid loss of precision at high values, brightness values are premultiplied by an exposure normalization value. In support of Physical Light Units this PR also renames CameraEffects to CameraAttributes.
67 lines
5.9 KiB
XML
67 lines
5.9 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="VoxelGI" inherits="VisualInstance3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
Real-time global illumination (GI) probe.
|
|
</brief_description>
|
|
<description>
|
|
[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. [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.
|
|
[b]Procedural generation:[/b] [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 [member Environment.sdfgi_enabled]).
|
|
[b]Performance:[/b] [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 [member ProjectSettings.rendering/global_illumination/voxel_gi/quality] and enable [member 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.
|
|
[b]Note:[/b] 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 [member GeometryInstance3D.gi_mode] set to [constant GeometryInstance3D.GI_MODE_STATIC]. These temporary nodes can then be hidden after baking the [VoxelGI] node.
|
|
</description>
|
|
<tutorials>
|
|
<link title="GI probes">$DOCS_URL/tutorials/3d/gi_probes.html</link>
|
|
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="bake">
|
|
<return type="void" />
|
|
<param index="0" name="from_node" type="Node" default="null" />
|
|
<param index="1" name="create_visual_debug" type="bool" default="false" />
|
|
<description>
|
|
Bakes the effect from all [GeometryInstance3D]s marked with [constant GeometryInstance3D.GI_MODE_STATIC] and [Light3D]s marked with either [constant Light3D.BAKE_STATIC] or [constant Light3D.BAKE_DYNAMIC]. If [code]create_visual_debug[/code] is [code]true[/code], 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.
|
|
[b]Note:[/b] [method 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 [member subdiv] can speed up baking.
|
|
[b]Note:[/b] [GeometryInstance3D]s and [Light3D]s must be fully ready before [method bake] is called. If you are procedurally creating those and some meshes or lights are missing from your baked [VoxelGI], use [code]call_deferred("bake")[/code] instead of calling [method bake] directly.
|
|
</description>
|
|
</method>
|
|
<method name="debug_bake">
|
|
<return type="void" />
|
|
<description>
|
|
Calls [method bake] with [code]create_visual_debug[/code] enabled.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="camera_attributes" type="CameraAttributes" setter="set_camera_attributes" getter="get_camera_attributes">
|
|
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.
|
|
</member>
|
|
<member name="data" type="VoxelGIData" setter="set_probe_data" getter="get_probe_data">
|
|
The [VoxelGIData] resource that holds the data for this [VoxelGI].
|
|
</member>
|
|
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(10, 10, 10)">
|
|
The size of the area covered by the [VoxelGI]. If you make the extents larger without increasing the subdivisions with [member subdiv], the size of each cell will increase and result in lower detailed lighting.
|
|
[b]Note:[/b] Extents are clamped to 1.0 unit or more on each axis.
|
|
</member>
|
|
<member name="subdiv" type="int" setter="set_subdiv" getter="get_subdiv" enum="VoxelGI.Subdiv" default="1">
|
|
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.
|
|
</member>
|
|
</members>
|
|
<constants>
|
|
<constant name="SUBDIV_64" value="0" enum="Subdiv">
|
|
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.
|
|
</constant>
|
|
<constant name="SUBDIV_128" value="1" enum="Subdiv">
|
|
Use 128 subdivisions. This is the default quality setting.
|
|
</constant>
|
|
<constant name="SUBDIV_256" value="2" enum="Subdiv">
|
|
Use 256 subdivisions.
|
|
</constant>
|
|
<constant name="SUBDIV_512" value="3" enum="Subdiv">
|
|
Use 512 subdivisions. This is the highest quality setting, but the slowest. On lower-end hardware, this could cause the GPU to stall.
|
|
</constant>
|
|
<constant name="SUBDIV_MAX" value="4" enum="Subdiv">
|
|
Represents the size of the [enum Subdiv] enum.
|
|
</constant>
|
|
</constants>
|
|
</class>
|