You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Fix reflection probe
This commit is contained in:
@@ -1126,6 +1126,7 @@ void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform
|
|||||||
bool using_ssr = false;
|
bool using_ssr = false;
|
||||||
bool using_sdfgi = false;
|
bool using_sdfgi = false;
|
||||||
bool using_giprobe = false;
|
bool using_giprobe = false;
|
||||||
|
bool reverse_cull = false;
|
||||||
|
|
||||||
if (render_buffer) {
|
if (render_buffer) {
|
||||||
screen_size.x = render_buffer->width;
|
screen_size.x = render_buffer->width;
|
||||||
@@ -1192,6 +1193,8 @@ void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform
|
|||||||
if (storage->reflection_probe_is_interior(reflection_probe_instance_get_probe(p_reflection_probe))) {
|
if (storage->reflection_probe_is_interior(reflection_probe_instance_get_probe(p_reflection_probe))) {
|
||||||
p_environment = RID(); //no environment on interiors
|
p_environment = RID(); //no environment on interiors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reverse_cull = true; // for some reason our views are inverted
|
||||||
} else {
|
} else {
|
||||||
ERR_FAIL(); //bug?
|
ERR_FAIL(); //bug?
|
||||||
}
|
}
|
||||||
@@ -1321,7 +1324,7 @@ void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform
|
|||||||
RID rp_uniform_set = _setup_render_pass_uniform_set(RENDER_LIST_OPAQUE, RID(), RID(), RID(), RID(), RID(), PagedArray<RID>(), PagedArray<RID>());
|
RID rp_uniform_set = _setup_render_pass_uniform_set(RENDER_LIST_OPAQUE, RID(), RID(), RID(), RID(), RID(), PagedArray<RID>(), PagedArray<RID>());
|
||||||
|
|
||||||
bool finish_depth = using_ssao || using_sdfgi || using_giprobe;
|
bool finish_depth = using_ssao || using_sdfgi || using_giprobe;
|
||||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), false, depth_pass_mode, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, depth_pass_mode, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
||||||
_render_list_with_threads(&render_list_params, depth_framebuffer, needs_pre_resolve ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, needs_pre_resolve ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_CLEAR, finish_depth ? RD::FINAL_ACTION_READ : RD::FINAL_ACTION_CONTINUE, needs_pre_resolve ? Vector<Color>() : depth_pass_clear);
|
_render_list_with_threads(&render_list_params, depth_framebuffer, needs_pre_resolve ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, needs_pre_resolve ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_CLEAR, finish_depth ? RD::FINAL_ACTION_READ : RD::FINAL_ACTION_CONTINUE, needs_pre_resolve ? Vector<Color>() : depth_pass_clear);
|
||||||
|
|
||||||
RD::get_singleton()->draw_command_end_label();
|
RD::get_singleton()->draw_command_end_label();
|
||||||
@@ -1379,7 +1382,7 @@ void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform
|
|||||||
}
|
}
|
||||||
|
|
||||||
RID framebuffer = using_separate_specular ? opaque_specular_framebuffer : opaque_framebuffer;
|
RID framebuffer = using_separate_specular ? opaque_specular_framebuffer : opaque_framebuffer;
|
||||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), false, using_separate_specular ? PASS_MODE_COLOR_SPECULAR : PASS_MODE_COLOR, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, using_separate_specular ? PASS_MODE_COLOR_SPECULAR : PASS_MODE_COLOR, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
||||||
_render_list_with_threads(&render_list_params, framebuffer, keep_color ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CLEAR, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, depth_pre_pass ? (continue_depth ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP) : RD::INITIAL_ACTION_CLEAR, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, c, 1.0, 0);
|
_render_list_with_threads(&render_list_params, framebuffer, keep_color ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CLEAR, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, depth_pre_pass ? (continue_depth ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP) : RD::INITIAL_ACTION_CLEAR, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, c, 1.0, 0);
|
||||||
if (will_continue_color && using_separate_specular) {
|
if (will_continue_color && using_separate_specular) {
|
||||||
// close the specular framebuffer, as it's no longer used
|
// close the specular framebuffer, as it's no longer used
|
||||||
|
|||||||
@@ -2356,7 +2356,7 @@ void RendererSceneRenderRD::_setup_reflections(const PagedArray<RID> &p_reflecti
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cluster.reflection_count) {
|
if (cluster.reflection_count) {
|
||||||
RD::get_singleton()->buffer_update(cluster.reflection_buffer, 0, cluster.reflection_count * sizeof(RendererSceneSkyRD::ReflectionData), cluster.reflections, RD::BARRIER_MASK_RASTER | RD::BARRIER_MASK_COMPUTE);
|
RD::get_singleton()->buffer_update(cluster.reflection_buffer, 0, cluster.reflection_count * sizeof(Cluster::ReflectionData), cluster.reflections, RD::BARRIER_MASK_RASTER | RD::BARRIER_MASK_COMPUTE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -462,8 +462,8 @@ private:
|
|||||||
uint32_t mask;
|
uint32_t mask;
|
||||||
float ambient[3]; // ambient color,
|
float ambient[3]; // ambient color,
|
||||||
float intensity;
|
float intensity;
|
||||||
bool exterior;
|
uint32_t exterior;
|
||||||
bool box_project;
|
uint32_t box_project;
|
||||||
uint32_t ambient_mode;
|
uint32_t ambient_mode;
|
||||||
uint32_t pad;
|
uint32_t pad;
|
||||||
float local_matrix[16]; // up to here for spot and omni, rest is for directional
|
float local_matrix[16]; // up to here for spot and omni, rest is for directional
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ layout(set = 0, binding = 4, std430) restrict readonly buffer SpotLights {
|
|||||||
}
|
}
|
||||||
spot_lights;
|
spot_lights;
|
||||||
|
|
||||||
layout(set = 0, binding = 5) buffer restrict readonly ReflectionProbeData {
|
layout(set = 0, binding = 5, std430) restrict readonly buffer ReflectionProbeData {
|
||||||
ReflectionData data[];
|
ReflectionData data[];
|
||||||
}
|
}
|
||||||
reflections;
|
reflections;
|
||||||
|
|||||||
@@ -2891,8 +2891,15 @@ bool RendererSceneCull::_render_reflection_probe_step(Instance *p_instance, int
|
|||||||
shadow_atlas = scenario->reflection_probe_shadow_atlas;
|
shadow_atlas = scenario->reflection_probe_shadow_atlas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RID environment;
|
||||||
|
if (scenario->environment.is_valid()) {
|
||||||
|
environment = scenario->environment;
|
||||||
|
} else {
|
||||||
|
environment = scenario->fallback_environment;
|
||||||
|
}
|
||||||
|
|
||||||
RENDER_TIMESTAMP("Render Reflection Probe, Step " + itos(p_step));
|
RENDER_TIMESTAMP("Render Reflection Probe, Step " + itos(p_step));
|
||||||
_render_scene(xform, cm, false, false, RID(), RID(), RID(), RSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, shadow_atlas, reflection_probe->instance, p_step, lod_threshold, use_shadows);
|
_render_scene(xform, cm, false, false, RID(), environment, RID(), RSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, shadow_atlas, reflection_probe->instance, p_step, lod_threshold, use_shadows);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//do roughness postprocess step until it believes it's done
|
//do roughness postprocess step until it believes it's done
|
||||||
|
|||||||
Reference in New Issue
Block a user