From e230bc6caaf6eabf95889e00c64d7e91c62506f1 Mon Sep 17 00:00:00 2001 From: Timur Celik Date: Tue, 12 Oct 2021 21:45:38 +0200 Subject: [PATCH] Fix flipped `interior` option for second refprobe This patch fixes rendering of multiple reflection probes for a single mesh in the GLES2 renderer. If there were two reflection probes, one of them would always have the `interior` option flipped, resulting in broken blending between probes and flickering of ambient reflection. Also make note of GLES2 reflection probe limit --- doc/classes/ReflectionProbe.xml | 1 + drivers/gles2/rasterizer_scene_gles2.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml index 3581ca545d9..b5d7a5316e7 100644 --- a/doc/classes/ReflectionProbe.xml +++ b/doc/classes/ReflectionProbe.xml @@ -7,6 +7,7 @@ Capture its surroundings as a dual paraboloid image, and stores versions of it with increasing levels of blur to simulate different material roughnesses. The [ReflectionProbe] is used to create high-quality reflections at the cost of performance. It can be combined with [GIProbe]s and Screen Space Reflections to achieve high quality reflections. [ReflectionProbe]s render all objects within their [member cull_mask], so updating them can be quite expensive. It is best to update them once with the important static objects and then leave them. [b]Note:[/b] By default Godot will only render 16 reflection probes. If you need more, increase the number of atlas subdivisions. This setting can be found in [member ProjectSettings.rendering/quality/reflections/atlas_subdiv]. + [b]Note:[/b] The GLES2 backend will only display two reflection probes at the same time for a single mesh. If possible, split up large meshes that span over multiple reflection probes into smaller ones. https://docs.godotengine.org/en/3.4/tutorials/3d/reflection_probes.html diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 6cf7560b774..7fac97e0042 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -2132,7 +2132,7 @@ void RasterizerSceneGLES2::_setup_refprobes(ReflectionProbeInstance *p_refprobe1 state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE2_USE_BOX_PROJECT, p_refprobe2->probe_ptr->box_projection); state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE2_BOX_EXTENTS, p_refprobe2->probe_ptr->extents); state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE2_BOX_OFFSET, p_refprobe2->probe_ptr->origin_offset); - state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE2_EXTERIOR, p_refprobe2->probe_ptr->interior); + state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE2_EXTERIOR, !p_refprobe2->probe_ptr->interior); state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE2_INTENSITY, p_refprobe2->probe_ptr->intensity); Color ambient;