Update docs for the vertex lights 3d module.

This commit is contained in:
Relintai 2024-03-27 16:12:15 +01:00
parent 20776d0746
commit fd1f8aa5d7
6 changed files with 39 additions and 60 deletions

View File

@ -137,6 +137,9 @@
<member name="VertexLights2DServer" type="VertexLights2DServer" setter="" getter=""> <member name="VertexLights2DServer" type="VertexLights2DServer" setter="" getter="">
The [VertexLights2DServer] singleton. The [VertexLights2DServer] singleton.
</member> </member>
<member name="VertexLights3DServer" type="VertexLights3DServer" setter="" getter="">
The [VertexLights3DServer] singleton.
</member>
</members> </members>
<constants> <constants>
<constant name="MARGIN_LEFT" value="0" enum="Margin"> <constant name="MARGIN_LEFT" value="0" enum="Margin">

View File

@ -2122,6 +2122,9 @@
<member name="thread_pool/use_threads" type="bool" setter="" getter="" default="true"> <member name="thread_pool/use_threads" type="bool" setter="" getter="" default="true">
</member> </member>
<member name="vertex_lights_2d/default_quadrant_size" type="Vector2i" setter="" getter="" default="Vector2i( 256, 256 )"> <member name="vertex_lights_2d/default_quadrant_size" type="Vector2i" setter="" getter="" default="Vector2i( 256, 256 )">
The default internal quadrant size of the [VertexLights2DServer] singleton.
</member>
<member name="vertex_lights_3d/default_quadrant_size" type="Vector3i" setter="" getter="" default="Vector3i( 32, 32, 32 )">
</member> </member>
<member name="world/2d/cell_size" type="int" setter="" getter="" default="100"> <member name="world/2d/cell_size" type="int" setter="" getter="" default="100">
Cell size used for the 2D hash grid that [VisibilityNotifier2D] uses (in pixels). Cell size used for the 2D hash grid that [VisibilityNotifier2D] uses (in pixels).

View File

@ -30,6 +30,9 @@
<member name="space" type="RID" setter="" getter="get_space"> <member name="space" type="RID" setter="" getter="get_space">
The World's physics space. The World's physics space.
</member> </member>
<member name="vertex_lights_3d_map" type="RID" setter="" getter="get_vertex_lights_3d_map">
The [RID] of this world's vertex light 3d space resource. Used by the [VertexLights3DServer] for static 3D lights. If the vertex lights 3d module is not enabled this will just return an empty RID.
</member>
</members> </members>
<constants> <constants>
</constants> </constants>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="VertexLight3D" inherits="Node3D" version="4.3"> <class name="VertexLight3D" inherits="Spatial" version="4.3">
<brief_description> <brief_description>
A [Node3D] that manages a light in [VertexLights3DServer]. A [Spatial] that manages a light in [VertexLights3DServer].
</brief_description> </brief_description>
<description> <description>
A [Node3D] that manages a light in [VertexLights3DServer]. A [Spatial] that manages a light in [VertexLights3DServer].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -23,18 +23,12 @@
<member name="item_cull_mask" type="int" setter="set_item_cull_mask" getter="get_item_cull_mask" default="1"> <member name="item_cull_mask" type="int" setter="set_item_cull_mask" getter="get_item_cull_mask" default="1">
The light's item cull mask. The light's item cull mask.
</member> </member>
<member name="layer_range" type="Vector2i" setter="set_layer_range" getter="get_layer_range" default="Vector2i( -512, 512 )">
The light's layer range.
</member>
<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="VertexLight3D.VertexLight3DMode" default="0"> <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="VertexLight3D.VertexLight3DMode" default="0">
The light's mode. The light's mode.
</member> </member>
<member name="range" type="Vector2i" setter="set_range" getter="get_range" default="Vector2i( 32, 32 )"> <member name="range" type="float" setter="set_range" getter="get_range" default="5.0">
The light's range. The light's range.
</member> </member>
<member name="z_range" type="Vector2i" setter="set_z_range" getter="get_z_range" default="Vector2i( -1024, 1024 )">
The light's z range.
</member>
</members> </members>
<constants> <constants>
<constant name="VERTEX_LIGHT_3D_MODE_ADD" value="0" enum="VertexLight3DMode"> <constant name="VERTEX_LIGHT_3D_MODE_ADD" value="0" enum="VertexLight3DMode">

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="VertexLight3DEnvironment" inherits="Node3D" version="4.3"> <class name="VertexLight3DEnvironment" inherits="Spatial" version="4.3">
<brief_description> <brief_description>
A [Node3D] that manages a map's base color in [VertexLights3DServer]. A [Spatial] that manages a map's base color in [VertexLights3DServer].
</brief_description> </brief_description>
<description> <description>
A [Node3D] that manages a map's base color in [VertexLights3DServer]. A [Spatial] that manages a map's base color in [VertexLights3DServer].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="VertexLights3DServer" inherits="Object" version="4.3"> <class name="VertexLights3DServer" inherits="Object" version="4.3">
<brief_description> <brief_description>
A server that provides a way to store static lights that can be used to bake lighting information into mesh vertex data, or [CanvasItem]'s color modulation. A server that provides a way to store static lights that can be used to bake lighting information into mesh vertex data, or [SpatialMaterial]'s albedo modulation.
</brief_description> </brief_description>
<description> <description>
A server that provides a way to store static lights that can be used to bake lighting information into mesh vertex data, or [CanvasItem]'s color modulation. A server that provides a way to store static lights that can be used to bake lighting information into mesh vertex data, or [SpatialMaterial]'s albedo modulation.
With this class extremely complex light information can be stored and used with no additional cost on the GPU side. With this class extremely complex light information can be stored and used with no additional cost on the GPU side.
After adding lights, you can use [member sample_light] to sample lighting at a specified point in the map's space, then use the resulting [Color] to either further modifty the modulate property of [CanvasItem]s, or you can render meshes using this color in you custom _draw methods. After adding lights, you can use [member sample_light] to sample lighting at a specified point in the map's space, then use the resulting [Color] to either further modifty the albedo color in your shader, or you can bake vertex colors of your meshes.
The drawback of this method is that it's more expensive change lights. The drawback of this method is that it's more expensive change lights.
Note that you can use the normal 3D lighting system on top of this if you need dynamic lights (like [Light3D]). That system is better suited for that purpose. Note that you can use the normal 3D lighting system on top of this if you need dynamic lights (like [OmniLight]). That system is better suited for that purpose.
Currently this class stores lights inside quadrants. Their optimal size should be a bit more than the radius of the biggest light you want to have. Currently this class stores lights inside quadrants. Their optimal size should be a bit more than the radius of the biggest light you want to have.
</description> </description>
<tutorials> <tutorials>
@ -28,7 +28,7 @@
</description> </description>
</method> </method>
<method name="get_default_quadrant_size" qualifiers="const"> <method name="get_default_quadrant_size" qualifiers="const">
<return type="Vector2i" /> <return type="Vector3i" />
<description> <description>
Get the default internal quadrant size. Get the default internal quadrant size.
</description> </description>
@ -67,13 +67,6 @@
Get a light's item cull mask property. Get a light's item cull mask property.
</description> </description>
</method> </method>
<method name="light_get_layer_range">
<return type="Vector2i" />
<argument index="0" name="light" type="RID" />
<description>
Get a light's layer range property.
</description>
</method>
<method name="light_get_map"> <method name="light_get_map">
<return type="RID" /> <return type="RID" />
<argument index="0" name="light" type="RID" /> <argument index="0" name="light" type="RID" />
@ -89,26 +82,19 @@
</description> </description>
</method> </method>
<method name="light_get_position"> <method name="light_get_position">
<return type="Vector2" /> <return type="Vector3" />
<argument index="0" name="light" type="RID" /> <argument index="0" name="light" type="RID" />
<description> <description>
Get a light's position. Get a light's position.
</description> </description>
</method> </method>
<method name="light_get_range"> <method name="light_get_range">
<return type="Vector2i" /> <return type="float" />
<argument index="0" name="light" type="RID" /> <argument index="0" name="light" type="RID" />
<description> <description>
Get a light's range. Get a light's range.
</description> </description>
</method> </method>
<method name="light_get_z_range">
<return type="Vector2i" />
<argument index="0" name="light" type="RID" />
<description>
Get a light's z range property.
</description>
</method>
<method name="light_set_attenuation"> <method name="light_set_attenuation">
<return type="void" /> <return type="void" />
<argument index="0" name="light" type="RID" /> <argument index="0" name="light" type="RID" />
@ -141,14 +127,6 @@
Set a light's item cull mask property. Set a light's item cull mask property.
</description> </description>
</method> </method>
<method name="light_set_layer_range">
<return type="void" />
<argument index="0" name="light" type="RID" />
<argument index="1" name="layer_range" type="Vector2i" />
<description>
Set a light's layer range property.
</description>
</method>
<method name="light_set_map"> <method name="light_set_map">
<return type="void" /> <return type="void" />
<argument index="0" name="light" type="RID" /> <argument index="0" name="light" type="RID" />
@ -168,7 +146,7 @@
<method name="light_set_position"> <method name="light_set_position">
<return type="void" /> <return type="void" />
<argument index="0" name="light" type="RID" /> <argument index="0" name="light" type="RID" />
<argument index="1" name="position" type="Vector2" /> <argument index="1" name="position" type="Vector3" />
<description> <description>
Set a light's position. Set a light's position.
</description> </description>
@ -176,19 +154,11 @@
<method name="light_set_range"> <method name="light_set_range">
<return type="void" /> <return type="void" />
<argument index="0" name="light" type="RID" /> <argument index="0" name="light" type="RID" />
<argument index="1" name="range" type="Vector2i" /> <argument index="1" name="range" type="float" />
<description> <description>
Set a light's range. Set a light's range.
</description> </description>
</method> </method>
<method name="light_set_z_range">
<return type="void" />
<argument index="0" name="light" type="RID" />
<argument index="1" name="z_range" type="Vector2i" />
<description>
Set a light's z range property.
</description>
</method>
<method name="map_clear"> <method name="map_clear">
<return type="void" /> <return type="void" />
<argument index="0" name="map" type="RID" /> <argument index="0" name="map" type="RID" />
@ -217,7 +187,7 @@
</description> </description>
</method> </method>
<method name="map_get_quadrant_size" qualifiers="const"> <method name="map_get_quadrant_size" qualifiers="const">
<return type="Vector2i" /> <return type="Vector3i" />
<argument index="0" name="map" type="RID" /> <argument index="0" name="map" type="RID" />
<description> <description>
Returns a map's quadrant size. Returns a map's quadrant size.
@ -234,27 +204,33 @@
<method name="map_set_quadrant_size"> <method name="map_set_quadrant_size">
<return type="void" /> <return type="void" />
<argument index="0" name="map" type="RID" /> <argument index="0" name="map" type="RID" />
<argument index="1" name="size" type="Vector2i" /> <argument index="1" name="size" type="Vector3i" />
<description> <description>
Sets a map's quadrant size.
</description> </description>
</method> </method>
<method name="sample_light"> <method name="sample_light">
<return type="Color" /> <return type="Color" />
<argument index="0" name="map" type="RID" /> <argument index="0" name="map" type="RID" />
<argument index="1" name="position" type="Vector2" /> <argument index="1" name="position" type="Vector3" />
<argument index="2" name="normal" type="Vector3" />
<argument index="3" name="item_cull_mask" type="int" default="1" />
<description>
Sample the lighing information at a specific position with the specified normal.
</description>
</method>
<method name="sample_light_value">
<return type="Color" />
<argument index="0" name="map" type="RID" />
<argument index="1" name="position" type="Vector3" />
<argument index="2" name="item_cull_mask" type="int" default="1" /> <argument index="2" name="item_cull_mask" type="int" default="1" />
<argument index="3" name="layer" type="int" default="0" />
<argument index="4" name="z_index" type="int" default="0" />
<description> <description>
Sample the lighing information at a specific position. Sample the lighing information at a specific position.
</description> </description>
</method> </method>
<method name="set_default_quadrant_size"> <method name="set_default_quadrant_size">
<return type="void" /> <return type="void" />
<argument index="0" name="size" type="Vector2i" /> <argument index="0" name="size" type="Vector3i" />
<description> <description>
Set the default internal quadrant size.
</description> </description>
</method> </method>
</methods> </methods>