Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix issue with decals lit with point lights using shadows

Bastiaan Olijfb48912be68c
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 8578188809b..e1fb717433f 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3652,14 +3652,6 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
spec_constants |= SceneShaderGLES3::SECOND_REFLECTION_PROBE;
}
- if (inst->decals_count > 0) {
- spec_constants |= SceneShaderGLES3::USE_DECALS;
-
- if (decals_filter == RSE::DECAL_FILTER_NEAREST_MIPMAPS || decals_filter == RSE::DECAL_FILTER_LINEAR_MIPMAPS || decals_filter == RSE::DECAL_FILTER_NEAREST_MIPMAPS_ANISOTROPIC || decals_filter == RSE::DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC) {
- spec_constants |= SceneShaderGLES3::USE_DECAL_MIPMAPS;
- }
- }
-
if (inst->lightmap_instance.is_valid()) {
spec_constants |= SceneShaderGLES3::USE_LIGHTMAP;
@@ -3768,6 +3760,15 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
}
}
}
+
+ // Decals apply in all color passes.
+ if (inst->decals_count > 0) {
+ spec_constants |= SceneShaderGLES3::USE_DECALS;
+
+ if (decals_filter == RSE::DECAL_FILTER_NEAREST_MIPMAPS || decals_filter == RSE::DECAL_FILTER_LINEAR_MIPMAPS || decals_filter == RSE::DECAL_FILTER_NEAREST_MIPMAPS_ANISOTROPIC || decals_filter == RSE::DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC) {
+ spec_constants |= SceneShaderGLES3::USE_DECAL_MIPMAPS;
+ }
+ }
}
if (prev_shader != shader || prev_variant != instance_variant || spec_constants != prev_spec_constants) {