Implement shadowmasks for LightmapGI

Co-authored-by: dearthdev <nathandearthdev@gmail.com>
This commit is contained in:
BlueCube3310 2023-11-30 17:14:45 +01:00
parent a40fc2354a
commit 189c8eb671
27 changed files with 1098 additions and 451 deletions

View file

@ -60,5 +60,19 @@
<member name="lightmap_textures" type="TextureLayered[]" setter="set_lightmap_textures" getter="get_lightmap_textures" default="[]">
The lightmap atlas textures generated by the lightmapper.
</member>
<member name="shadowmask_textures" type="TextureLayered[]" setter="set_shadowmask_textures" getter="get_shadowmask_textures" default="[]">
The shadowmask atlas textures generated by the lightmapper.
</member>
</members>
<constants>
<constant name="SHADOWMASK_MODE_NONE" value="0" enum="ShadowmaskMode">
Shadowmasking is disabled. No shadowmask texture will be created when baking lightmaps. Existing shadowmask textures will be removed during baking.
</constant>
<constant name="SHADOWMASK_MODE_REPLACE" value="1" enum="ShadowmaskMode">
Shadowmasking is enabled. Directional shadows that are outside the [member DirectionalLight3D.directional_shadow_max_distance] will be rendered using the shadowmask texture. Shadows that are inside the range will be rendered using real-time shadows exclusively. This mode allows for more precise real-time shadows up close, without the potential "smearing" effect that can occur when using lightmaps with a high texel size. The downside is that when the camera moves fast, the transition between the real-time light and shadowmask can be obvious. Also, objects that only have shadows baked in the shadowmask (and no real-time shadows) won't display any shadows up close.
</constant>
<constant name="SHADOWMASK_MODE_OVERLAY" value="2" enum="ShadowmaskMode">
Shadowmasking is enabled. Directional shadows will be rendered with real-time shadows overlaid on top of the shadowmask texture. This mode makes for smoother shadow transitions when the camera moves fast, at the cost of a potential smearing effect for directional shadows that are up close (due to the real-time shadow being mixed with a low-resolution shadowmask). Objects that only have shadows baked in the shadowmask (and no real-time shadows) will keep their shadows up close.
</constant>
</constants>
</class>