Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b4dd89c
add area light
CookieBadger Jul 2, 2025
2e7db7e
move light param enums to end
CookieBadger Jul 3, 2025
38f1dd7
Update doc/classes/AreaLight3D.xml
CookieBadger Jul 15, 2025
906fc8d
change area width and height to Vector2 size
CookieBadger Jul 15, 2025
e733ed6
implement area lights in forward mobile
CookieBadger Jul 21, 2025
2e06837
implement area lights in compatibility renderer
CookieBadger Jul 25, 2025
082bd61
attempt implementing area light shadows in compatibility
CookieBadger Jul 26, 2025
36e9d66
disable and remove area light shadows in compatibility renderer
CookieBadger Jul 26, 2025
b13ffdf
update documentation
CookieBadger Jul 29, 2025
f9a5098
fix specular reflection missing in Copatibility
CookieBadger Jul 29, 2025
4f33ee5
remove unused additive area light computation in compatibility
CookieBadger Jul 29, 2025
477efed
fix undo on area light gizmo
CookieBadger Aug 6, 2025
b8a4d0d
integrate area lights into lightmapper_rd
CookieBadger Aug 25, 2025
b172ed1
remove unused inv_center_range and use f90
CookieBadger Aug 27, 2025
92c17c9
implement area light illumination for volumetric fog
CookieBadger Aug 28, 2025
4fe33e1
fix volumetric fog NaNs when area light has 0 size
CookieBadger Aug 29, 2025
36a1c35
add normalization factor for area lights
CookieBadger Sep 2, 2025
fcae9af
fix near-zero vector normalization issue in volumetric fog
CookieBadger Sep 2, 2025
64ec9df
remove accidental area light boilerplate SDFGI code
CookieBadger Sep 3, 2025
6f72ba6
add setting for area light normalization
CookieBadger Sep 4, 2025
bc5458d
fix area light attenuation
CookieBadger Sep 4, 2025
104fc64
update documentation for area light energy normalization
CookieBadger Sep 4, 2025
4bb09ed
fix area light attenuation in compatibility renderer
CookieBadger Sep 4, 2025
4ac2426
fix flickering area light and missing shadows
CookieBadger Sep 4, 2025
f846e99
fix normalize energy flag to not be a float param
CookieBadger Sep 4, 2025
5abe59d
implement voxelGI for area lights
CookieBadger Sep 4, 2025
8f7c46f
fix invalid shadow range when size changes
CookieBadger Sep 5, 2025
2c89ebd
improve gizmos
CookieBadger Sep 11, 2025
80373f4
remove old TODO's
CookieBadger Sep 11, 2025
6f69a69
fix abs function usage
CookieBadger Sep 11, 2025
3679e36
add conversion exception for area light
CookieBadger Sep 11, 2025
ca7ed18
make projector configuration warning always show
CookieBadger Sep 11, 2025
35eed04
update deprecated methods
CookieBadger Oct 28, 2025
391ad67
implement custom light shader function
CookieBadger Nov 24, 2025
a8d008b
optimize calculation of local light function
CookieBadger Nov 24, 2025
956db9e
use acos approximation
CookieBadger Dec 4, 2025
44e798a
add shader built-ins for area light
CookieBadger Dec 4, 2025
78ccd41
set up light texture storage and decal atlas
CookieBadger Oct 28, 2025
faf4ba6
write and sample mipmaps
CookieBadger Oct 31, 2025
ae5c267
fix form factor calculation
CookieBadger Nov 11, 2025
35c22ae
fix intersection code
CookieBadger Dec 1, 2025
9e9b6db
implement blurring
CookieBadger Dec 2, 2025
995a652
write to mipmaps instead
CookieBadger Dec 3, 2025
a51df93
implement area light atlas
CookieBadger Dec 3, 2025
cab8d16
add support in mobile renderer
CookieBadger Dec 3, 2025
bb1ad3d
implement texture in fog
CookieBadger Dec 3, 2025
2470571
use closest point for fog sampling instead
CookieBadger Dec 3, 2025
7568587
implement texture in VoxelGI
CookieBadger Dec 3, 2025
ac12150
add texture warning in compat mode
CookieBadger Dec 3, 2025
7d7b17b
fix syntax in voxelGI
CookieBadger Dec 3, 2025
4b2a51f
textures in lightmapper WIP
CookieBadger Dec 4, 2025
2151fdf
fix rebase problems
CookieBadger Dec 4, 2025
a87d55b
fix atlas being too small
CookieBadger Dec 4, 2025
8502f9c
fix LOD clamping
CookieBadger Dec 4, 2025
8169d02
set up using area light textures in lightmaps
CookieBadger Dec 5, 2025
e1a7899
finish lightmap texture implementation
CookieBadger Dec 6, 2025
85e90e4
add documentation
CookieBadger Dec 6, 2025
290250a
fix CI
CookieBadger Dec 6, 2025
f9d0ec5
fix horizon clipping
CookieBadger Dec 6, 2025
2b286cd
remove comment
CookieBadger Dec 6, 2025
1a40278
fix normalization factor in lightmaps
CookieBadger Dec 8, 2025
4071d39
implement material effects transmittance, clearcoat, rim, backlight, …
CookieBadger Dec 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions doc/classes/AreaLight3D.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AreaLight3D" inherits="Light3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
An area light, such as a neon light tube or a screen.
</brief_description>
<description>
An area light is a type of [Light3D] node that emits light over a 2-dimensional area, in the shape of a rectangle. The light is attenuated through the distance. This attenuation can be configured by changing the energy, [member area_attenuation], and [member area_range].
Light is emitted in the -Z direction of the node's global basis. For an unrotated light, this means that the light is emitted forwards, illuminating the front side of a 3D model (see [constant Vector3.FORWARD] and [constant Vector3.MODEL_FRONT]).
Area lights can cast soft shadows using PCSS, which you can control by tweaking the size parameter. The shadow map is drawn from the center of the light.
[b]Note:[/b] Area lights have limited support in the Mobile or Compatibility renderer. In the Mobile renderer, the size of the penumbra doesn't vary is it should with PCSS. In Compatibility, area lights cannot cast shadows. For static lighting, consider instead using [LightmapGI] and a [QuadMesh] with [member PrimitiveMesh.add_uv2] set to [code]true[/code] and assign an emissive material to the [QuadMesh], then hide the [QuadMesh] after baking lightmaps.
</description>
<tutorials>
</tutorials>
<members>
<member name="area_attenuation" type="float" setter="set_param" getter="get_param" default="1.0">
Controls the distance attenuation function for area lights.
A value of [code]0.0[/code] will maintain a constant brightness through most of the range, but smoothly attenuate the light at the edge of the range. Use a value of [code]2.0[/code] for physically accurate lights as it results in the proper inverse square attenuation.
[b]Note:[/b] Setting attenuation to [code]2.0[/code] or higher may result in distant objects receiving minimal light, even within range. For example, with a range of [code]4096[/code], an object at [code]100[/code] units is attenuated by a factor of [code]0.0001[/code]. With a default brightness of [code]1[/code], the light would not be visible at that distance.
[b]Note:[/b] Using negative or values higher than [code]10.0[/code] may lead to unexpected results.
</member>
<member name="area_normalize_energy" type="bool" setter="set_area_normalize_energy" getter="get_area_normalize_energy" default="true">
Defines whether the energy is normalized (divided) by the surface area of the light. If set to [code]true[/code], changing the size does not affect the amount of total energy output, and does not dramatically alter the brightness of the scene.
</member>
<member name="area_range" type="float" setter="set_param" getter="get_param" default="5.0">
The range of the area in meters. This determines the maximum distance at which the area can still emit light relative to its surface, but also to its borders (which are positioned according to [member area_size]).
</member>
<member name="area_size" type="Vector2" setter="set_area_size" getter="get_area_size" default="Vector2(1, 1)">
The extents (width and height) of the area in meters.
</member>
<member name="area_texture" type="Texture2D" setter="set_area_texture" getter="get_area_texture">
An optional texture to use as a light source. Changing the texture at runtime might impact performance, as it needs to be drawn to the area light atlas with filtered mipmaps.
If no texture is assigned, the area light emits uniform light across its surface.
</member>
<member name="light_size" type="float" setter="set_param" getter="get_param" overrides="Light3D" default="0.5" />
<member name="shadow_bias" type="float" setter="set_param" getter="get_param" overrides="Light3D" default="0.03" />
<member name="shadow_normal_bias" type="float" setter="set_param" getter="get_param" overrides="Light3D" default="1.0" />
</members>
</class>
38 changes: 38 additions & 0 deletions doc/classes/Light3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
<link title="Third Person Shooter (TPS) Demo">https://godotengine.org/asset-library/asset/2710</link>
</tutorials>
<methods>
<method name="get_area_normalize_energy" qualifiers="const">
<return type="bool" />
<description>
Getter for [member AreaLight3D.area_normalize_energy]. If [code]true[/code], the energy of an [AreaLight3D] is normalized by its area.
</description>
</method>
<method name="get_area_size" qualifiers="const">
<return type="Vector2" />
<description>
Returns the width and height of the area.
</description>
</method>
<method name="get_area_texture" qualifiers="const">
<return type="Texture2D" />
<description>
Returns the texture used for the area light.
</description>
</method>
<method name="get_correlated_color" qualifiers="const">
<return type="Color" />
<description>
Expand All @@ -25,6 +43,26 @@
Returns the value of the specified [enum Light3D.Param] parameter.
</description>
</method>
<method name="set_area_normalize_energy">
<return type="void" />
<param index="0" name="enable" type="bool" />
<description>
Setter for [member AreaLight3D.area_normalize_energy]. If [code]true[/code], the energy of an [AreaLight3D] is normalized by its area.
</description>
</method>
<method name="set_area_size">
<return type="void" />
<param index="0" name="area_size" type="Vector2" />
<description>
Sets the width and height of the area.
</description>
</method>
<method name="set_area_texture">
<return type="void" />
<param index="0" name="texture" type="Texture2D" />
<description>
</description>
</method>
<method name="set_param">
<return type="void" />
<param index="0" name="param" type="int" enum="Light3D.Param" />
Expand Down
23 changes: 23 additions & 0 deletions doc/classes/RenderingServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<link title="Optimization using Servers">$DOCS_URL/tutorials/performance/using_servers.html</link>
</tutorials>
<methods>
<method name="area_light_create">
<return type="RID" />
<description>
</description>
</method>
<method name="bake_render_uv2">
<return type="Image[]" />
<param index="0" name="base" type="RID" />
Expand Down Expand Up @@ -2100,6 +2105,22 @@
Returns [code]true[/code] if our code is currently executing on the rendering thread.
</description>
</method>
<method name="light_area_set_normalize_energy">
<return type="void" />
<param index="0" name="light" type="RID" />
<param index="1" name="enable" type="bool" />
<description>
Defines whether the energy of an [AreaLight3D] is normalized (divided) by its area. If set to [code]true[/code], changing the size does not affect the amount of total energy output. Equivalent to [member AreaLight3D.area_normalize_energy].
</description>
</method>
<method name="light_area_set_size">
<return type="void" />
<param index="0" name="light" type="RID" />
<param index="1" name="size" type="Vector2" />
<description>
Sets the extents (width and height) in meters for this area light. Equivalent to [member AreaLight3D.area_size].
</description>
</method>
<method name="light_directional_set_blend_splits">
<return type="void" />
<param index="0" name="light" type="RID" />
Expand Down Expand Up @@ -4847,6 +4868,8 @@
<constant name="LIGHT_SPOT" value="2" enum="LightType">
Spot light (see [SpotLight3D]).
</constant>
<constant name="LIGHT_AREA" value="3" enum="LightType">
</constant>
<constant name="LIGHT_PARAM_ENERGY" value="0" enum="LightParam">
The light's energy multiplier.
</constant>
Expand Down
8 changes: 8 additions & 0 deletions doc/classes/Viewport.xml
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,14 @@
Draws the internal resolution buffer of the scene in linear colorspace before tonemapping or post-processing is applied.
[b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods.
</constant>
<constant name="DEBUG_DRAW_CLUSTER_AREA_LIGHTS" value="27" enum="DebugDraw">
Draws the cluster used by [AreaLight3D] nodes to optimize light rendering.
[b]Note:[/b] Only supported when using the Forward+ rendering method.
</constant>
<constant name="DEBUG_DRAW_AREA_LIGHT_ATLAS" value="28" enum="DebugDraw">
Draws the atlas used by [AreaLight3D] nodes in the upper left quadrant of the [Viewport].
[b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST" value="0" enum="DefaultCanvasItemTextureFilter">
The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled).
</constant>
Expand Down
Loading
Loading