mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Fix opaque pre pass not casting shadows
This commit is contained in:
parent
89e1b302b5
commit
ad88979841
3 changed files with 8 additions and 2 deletions
|
|
@ -4086,6 +4086,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
|
||||||
state.ubo_data.z_slope_scale = 0;
|
state.ubo_data.z_slope_scale = 0;
|
||||||
state.ubo_data.shadow_dual_paraboloid_render_side = 0;
|
state.ubo_data.shadow_dual_paraboloid_render_side = 0;
|
||||||
state.ubo_data.shadow_dual_paraboloid_render_zfar = 0;
|
state.ubo_data.shadow_dual_paraboloid_render_zfar = 0;
|
||||||
|
state.ubo_data.opaque_prepass_treshold = 0.99;
|
||||||
|
|
||||||
p_cam_projection.get_viewport_size(state.ubo_data.viewport_size[0], state.ubo_data.viewport_size[1]);
|
p_cam_projection.get_viewport_size(state.ubo_data.viewport_size[0], state.ubo_data.viewport_size[1]);
|
||||||
|
|
||||||
|
|
@ -4698,6 +4699,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
||||||
state.ubo_data.z_slope_scale = normal_bias;
|
state.ubo_data.z_slope_scale = normal_bias;
|
||||||
state.ubo_data.shadow_dual_paraboloid_render_side = dp_direction;
|
state.ubo_data.shadow_dual_paraboloid_render_side = dp_direction;
|
||||||
state.ubo_data.shadow_dual_paraboloid_render_zfar = zfar;
|
state.ubo_data.shadow_dual_paraboloid_render_zfar = zfar;
|
||||||
|
state.ubo_data.opaque_prepass_treshold = 0.1;
|
||||||
|
|
||||||
_setup_environment(NULL, light_projection, light_transform);
|
_setup_environment(NULL, light_projection, light_transform);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ public:
|
||||||
float subsurface_scatter_width;
|
float subsurface_scatter_width;
|
||||||
float ambient_occlusion_affect_light;
|
float ambient_occlusion_affect_light;
|
||||||
float ambient_occlusion_affect_ssao;
|
float ambient_occlusion_affect_ssao;
|
||||||
|
float opaque_prepass_treshold;
|
||||||
|
|
||||||
uint32_t fog_depth_enabled;
|
uint32_t fog_depth_enabled;
|
||||||
float fog_depth_begin;
|
float fog_depth_begin;
|
||||||
|
|
@ -152,7 +153,7 @@ public:
|
||||||
float fog_height_max;
|
float fog_height_max;
|
||||||
float fog_height_curve;
|
float fog_height_curve;
|
||||||
// make sure this struct is padded to be a multiple of 16 bytes for webgl
|
// make sure this struct is padded to be a multiple of 16 bytes for webgl
|
||||||
float pad[3];
|
float pad[2];
|
||||||
|
|
||||||
} ubo_data;
|
} ubo_data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ layout(std140) uniform SceneData { //ubo:0
|
||||||
mediump float subsurface_scatter_width;
|
mediump float subsurface_scatter_width;
|
||||||
mediump float ambient_occlusion_affect_light;
|
mediump float ambient_occlusion_affect_light;
|
||||||
mediump float ambient_occlusion_affect_ao_channel;
|
mediump float ambient_occlusion_affect_ao_channel;
|
||||||
|
mediump float opaque_prepass_treshold;
|
||||||
|
|
||||||
bool fog_depth_enabled;
|
bool fog_depth_enabled;
|
||||||
highp float fog_depth_begin;
|
highp float fog_depth_begin;
|
||||||
|
|
@ -679,6 +680,7 @@ layout(std140) uniform SceneData {
|
||||||
mediump float subsurface_scatter_width;
|
mediump float subsurface_scatter_width;
|
||||||
mediump float ambient_occlusion_affect_light;
|
mediump float ambient_occlusion_affect_light;
|
||||||
mediump float ambient_occlusion_affect_ao_channel;
|
mediump float ambient_occlusion_affect_ao_channel;
|
||||||
|
mediump float opaque_prepass_treshold;
|
||||||
|
|
||||||
bool fog_depth_enabled;
|
bool fog_depth_enabled;
|
||||||
highp float fog_depth_begin;
|
highp float fog_depth_begin;
|
||||||
|
|
@ -1690,9 +1692,10 @@ FRAGMENT_SHADER_CODE
|
||||||
|
|
||||||
#ifdef USE_OPAQUE_PREPASS
|
#ifdef USE_OPAQUE_PREPASS
|
||||||
|
|
||||||
if (alpha<0.99) {
|
if (alpha<opaque_prepass_treshold) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_NORMALMAP)
|
#if defined(ENABLE_NORMALMAP)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue