2024-03-27 12:26:20 +01:00
<?xml version="1.0" encoding="UTF-8" ?>
<class name= "VertexLights3DServer" inherits= "Object" version= "4.3" >
<brief_description >
2024-03-27 16:12:15 +01:00
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.
2024-03-27 12:26:20 +01:00
</brief_description>
<description >
2024-03-27 16:12:15 +01:00
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.
2024-03-27 12:26:20 +01:00
With this class extremely complex light information can be stored and used with no additional cost on the GPU side.
2024-03-27 16:12:15 +01:00
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.
2024-03-27 12:26:20 +01:00
The drawback of this method is that it's more expensive change lights.
2024-03-27 16:12:15 +01:00
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.
2024-03-27 16:13:58 +01:00
Currently this class stores lights inside octants. Their optimal size should be a bit more than the radius of the biggest light you want to have.
2024-03-27 12:26:20 +01:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "flush_notifications" >
<return type= "void" />
<description >
Flushes map changed notifications. This will get called automatically.
</description>
</method>
<method name= "free" >
<return type= "void" />
<argument index= "0" name= "rid" type= "RID" />
<description >
Frees an allocated resource.
</description>
</method>
2024-03-27 16:13:58 +01:00
<method name= "get_default_octant_size" qualifiers= "const" >
2024-03-27 16:12:15 +01:00
<return type= "Vector3i" />
2024-03-27 12:26:20 +01:00
<description >
2024-03-27 16:13:58 +01:00
Get the default internal octant size.
2024-03-27 12:26:20 +01:00
</description>
</method>
<method name= "light_create" >
<return type= "RID" />
<description >
Create a light.
</description>
</method>
<method name= "light_get_attenuation" >
<return type= "float" />
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's attenuation property.
</description>
</method>
<method name= "light_get_color" >
<return type= "Color" />
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's color property.
</description>
</method>
<method name= "light_get_is_enabled" >
<return type= "bool" />
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's enabled property.
</description>
</method>
<method name= "light_get_item_cull_mask" >
<return type= "int" />
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's item cull mask property.
</description>
</method>
<method name= "light_get_map" >
<return type= "RID" />
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's map.
</description>
</method>
<method name= "light_get_mode" >
<return type= "int" enum= "VertexLights3DServer.VertexLight3DMode" />
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's mix mode.
</description>
</method>
<method name= "light_get_position" >
2024-03-27 16:12:15 +01:00
<return type= "Vector3" />
2024-03-27 12:26:20 +01:00
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's position.
</description>
</method>
<method name= "light_get_range" >
2024-03-27 16:12:15 +01:00
<return type= "float" />
2024-03-27 12:26:20 +01:00
<argument index= "0" name= "light" type= "RID" />
<description >
Get a light's range.
</description>
</method>
<method name= "light_set_attenuation" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
<argument index= "1" name= "attenuation" type= "float" />
<description >
Set a light's attenuation property.
</description>
</method>
<method name= "light_set_color" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
<argument index= "1" name= "color" type= "Color" />
<description >
Set a light's color property.
</description>
</method>
<method name= "light_set_enabled" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
<argument index= "1" name= "enabled" type= "bool" />
<description >
Set a light's enabled property.
</description>
</method>
<method name= "light_set_item_cull_mask" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
<argument index= "1" name= "item_cull_mask" type= "int" />
<description >
Set a light's item cull mask property.
</description>
</method>
<method name= "light_set_map" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
<argument index= "1" name= "map" type= "RID" />
<description >
Set a light's map.
</description>
</method>
<method name= "light_set_mode" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
<argument index= "1" name= "mode" type= "int" enum= "VertexLights3DServer.VertexLight3DMode" />
<description >
Set a light's mix mode.
</description>
</method>
<method name= "light_set_position" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
2024-03-27 16:12:15 +01:00
<argument index= "1" name= "position" type= "Vector3" />
2024-03-27 12:26:20 +01:00
<description >
Set a light's position.
</description>
</method>
<method name= "light_set_range" >
<return type= "void" />
<argument index= "0" name= "light" type= "RID" />
2024-03-27 16:12:15 +01:00
<argument index= "1" name= "range" type= "float" />
2024-03-27 12:26:20 +01:00
<description >
Set a light's range.
</description>
</method>
<method name= "map_clear" >
<return type= "void" />
<argument index= "0" name= "map" type= "RID" />
<description >
Clears a map of all lights.
</description>
</method>
<method name= "map_create" >
<return type= "RID" />
<description >
Creates a map.
</description>
</method>
<method name= "map_get_base_color" qualifiers= "const" >
<return type= "Color" />
<argument index= "0" name= "map" type= "RID" />
<description >
Returns the base color of a map.
</description>
</method>
<method name= "map_get_lights" qualifiers= "const" >
<return type= "Array" />
<argument index= "0" name= "map" type= "RID" />
<description >
Returns all lights in a map.
</description>
</method>
2024-03-27 16:13:58 +01:00
<method name= "map_get_octant_size" qualifiers= "const" >
2024-03-27 16:12:15 +01:00
<return type= "Vector3i" />
2024-03-27 12:26:20 +01:00
<argument index= "0" name= "map" type= "RID" />
<description >
2024-03-27 16:13:58 +01:00
Returns a map's octant size.
2024-03-27 12:26:20 +01:00
</description>
</method>
<method name= "map_set_base_color" >
<return type= "void" />
<argument index= "0" name= "map" type= "RID" />
<argument index= "1" name= "base_color" type= "Color" />
<description >
Sets the base color of a map.
</description>
</method>
2024-03-27 16:13:58 +01:00
<method name= "map_set_octant_size" >
2024-03-27 12:26:20 +01:00
<return type= "void" />
<argument index= "0" name= "map" type= "RID" />
2024-03-27 16:12:15 +01:00
<argument index= "1" name= "size" type= "Vector3i" />
2024-03-27 12:26:20 +01:00
<description >
</description>
</method>
<method name= "sample_light" >
<return type= "Color" />
<argument index= "0" name= "map" type= "RID" />
2024-03-27 16:12:15 +01:00
<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" />
2024-03-27 12:26:20 +01:00
<argument index= "2" name= "item_cull_mask" type= "int" default= "1" />
<description >
Sample the lighing information at a specific position.
</description>
</method>
2024-03-27 16:13:58 +01:00
<method name= "set_default_octant_size" >
2024-03-27 12:26:20 +01:00
<return type= "void" />
2024-03-27 16:12:15 +01:00
<argument index= "0" name= "size" type= "Vector3i" />
2024-03-27 12:26:20 +01:00
<description >
</description>
</method>
</methods>
<signals >
<signal name= "map_changed" >
<argument index= "0" name= "map" type= "RID" />
<description >
Emitted after a map changed (only once per frame).
</description>
</signal>
</signals>
<constants >
<constant name= "VERTEX_LIGHT_3D_MODE_ADD" value= "0" enum= "VertexLight3DMode" >
The light's color gets added to the resulting colors.
</constant>
<constant name= "VERTEX_LIGHT_3D_MODE_SUB" value= "1" enum= "VertexLight3DMode" >
The light's color gets substracted to the resulting colors.
</constant>
<constant name= "VERTEX_LIGHT_3D_MODE_MIX" value= "2" enum= "VertexLight3DMode" >
The light's color gets blended with the resulting colors.
</constant>
</constants>
</class>