Skip to content

Commit

Permalink
Merge pull request #89253 from Calinou/debug-draw-modes-ignore-decals-2
Browse files Browse the repository at this point in the history
Make Overdraw, Lighting and Shadow Splits debug draw modes ignore decals
  • Loading branch information
akien-mga committed Mar 8, 2024
2 parents 6db28c9 + 26a220b commit f8140a4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
6 changes: 3 additions & 3 deletions drivers/gles3/rasterizer_scene_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4075,7 +4075,7 @@ RasterizerSceneGLES3::RasterizerSceneGLES3() {
scene_globals.default_shader = material_storage->shader_allocate();
material_storage->shader_initialize(scene_globals.default_shader);
material_storage->shader_set_code(scene_globals.default_shader, R"(
// Default 3D material shader.
// Default 3D material shader (Compatibility).
shader_type spatial;
Expand All @@ -4100,11 +4100,11 @@ void fragment() {
scene_globals.overdraw_shader = material_storage->shader_allocate();
material_storage->shader_initialize(scene_globals.overdraw_shader);
material_storage->shader_set_code(scene_globals.overdraw_shader, R"(
// 3D editor Overdraw debug draw mode shader.
// 3D editor Overdraw debug draw mode shader (Compatibility).
shader_type spatial;
render_mode blend_add, unshaded;
render_mode blend_add, unshaded, fog_disabled;
void fragment() {
ALBEDO = vec3(0.4, 0.8, 0.8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ void SceneShaderForwardClustered::init(const String p_defines) {
default_shader = material_storage->shader_allocate();
material_storage->shader_initialize(default_shader);
material_storage->shader_set_code(default_shader, R"(
// Default 3D material shader (clustered).
// Default 3D material shader (Forward+).
shader_type spatial;
Expand Down Expand Up @@ -768,11 +768,11 @@ void fragment() {
material_storage->shader_initialize(overdraw_material_shader);
// Use relatively low opacity so that more "layers" of overlapping objects can be distinguished.
material_storage->shader_set_code(overdraw_material_shader, R"(
// 3D editor Overdraw debug draw mode shader (clustered).
// 3D editor Overdraw debug draw mode shader (Forward+).
shader_type spatial;
render_mode blend_add, unshaded;
render_mode blend_add, unshaded, fog_disabled;
void fragment() {
ALBEDO = vec3(0.4, 0.8, 0.8);
Expand All @@ -792,11 +792,11 @@ void fragment() {
debug_shadow_splits_material_shader = material_storage->shader_allocate();
material_storage->shader_initialize(debug_shadow_splits_material_shader);
material_storage->shader_set_code(debug_shadow_splits_material_shader, R"(
// 3D debug shadow splits mode shader(mobile).
// 3D debug shadow splits mode shader (Forward+).
shader_type spatial;
render_mode debug_shadow_splits;
render_mode debug_shadow_splits, fog_disabled;
void fragment() {
ALBEDO = vec3(1.0, 1.0, 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ void SceneShaderForwardMobile::init(const String p_defines) {
default_shader = material_storage->shader_allocate();
material_storage->shader_initialize(default_shader);
material_storage->shader_set_code(default_shader, R"(
// Default 3D material shader (mobile).
// Default 3D material shader (Mobile).
shader_type spatial;
Expand Down Expand Up @@ -671,11 +671,11 @@ void fragment() {
material_storage->shader_initialize(overdraw_material_shader);
// Use relatively low opacity so that more "layers" of overlapping objects can be distinguished.
material_storage->shader_set_code(overdraw_material_shader, R"(
// 3D editor Overdraw debug draw mode shader (mobile).
// 3D editor Overdraw debug draw mode shader (Mobile).
shader_type spatial;
render_mode blend_add, unshaded;
render_mode blend_add, unshaded, fog_disabled;
void fragment() {
ALBEDO = vec3(0.4, 0.8, 0.8);
Expand All @@ -696,11 +696,11 @@ void fragment() {
material_storage->shader_initialize(debug_shadow_splits_material_shader);
// Use relatively low opacity so that more "layers" of overlapping objects can be distinguished.
material_storage->shader_set_code(debug_shadow_splits_material_shader, R"(
// 3D debug shadow splits mode shader(mobile).
// 3D debug shadow splits mode shader (Mobile).
shader_type spatial;
render_mode debug_shadow_splits;
render_mode debug_shadow_splits, fog_disabled;
void fragment() {
ALBEDO = vec3(1.0, 1.0, 1.0);
Expand Down
9 changes: 8 additions & 1 deletion servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,12 +1153,19 @@ void RendererSceneRenderRD::render_scene(const Ref<RenderSceneBuffers> &p_render

PagedArray<RID> empty;

if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_UNSHADED || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_OVERDRAW) {
render_data.lights = &empty;
render_data.reflection_probes = &empty;
render_data.voxel_gi_instances = &empty;
}

if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_UNSHADED ||
get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_OVERDRAW ||
get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_LIGHTING ||
get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_PSSM_SPLITS) {
render_data.decals = &empty;
}

Color clear_color;
if (p_render_buffers.is_valid() && p_reflection_probe.is_null()) {
clear_color = texture_storage->render_target_get_clear_request_color(rb->get_render_target());
Expand Down

0 comments on commit f8140a4

Please sign in to comment.