transmission was broken, fix was made. Also fixed treshold.

This commit is contained in:
Juan Linietsky 2018-07-22 14:03:43 -03:00
parent 8e4de57e56
commit 4b549faaab
3 changed files with 12 additions and 12 deletions

View file

@ -4086,7 +4086,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
state.ubo_data.z_slope_scale = 0;
state.ubo_data.shadow_dual_paraboloid_render_side = 0;
state.ubo_data.shadow_dual_paraboloid_render_zfar = 0;
state.ubo_data.opaque_prepass_treshold = 0.99;
state.ubo_data.opaque_prepass_threshold = 0.99;
p_cam_projection.get_viewport_size(state.ubo_data.viewport_size[0], state.ubo_data.viewport_size[1]);
@ -4699,7 +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.shadow_dual_paraboloid_render_side = dp_direction;
state.ubo_data.shadow_dual_paraboloid_render_zfar = zfar;
state.ubo_data.opaque_prepass_treshold = 0.1;
state.ubo_data.opaque_prepass_threshold = 0.1;
_setup_environment(NULL, light_projection, light_transform);

View file

@ -141,7 +141,7 @@ public:
float subsurface_scatter_width;
float ambient_occlusion_affect_light;
float ambient_occlusion_affect_ssao;
float opaque_prepass_treshold;
float opaque_prepass_threshold;
uint32_t fog_depth_enabled;
float fog_depth_begin;

View file

@ -91,7 +91,7 @@ layout(std140) uniform SceneData { //ubo:0
mediump float subsurface_scatter_width;
mediump float ambient_occlusion_affect_light;
mediump float ambient_occlusion_affect_ao_channel;
mediump float opaque_prepass_treshold;
mediump float opaque_prepass_threshold;
bool fog_depth_enabled;
highp float fog_depth_begin;
@ -680,7 +680,7 @@ layout(std140) uniform SceneData {
mediump float subsurface_scatter_width;
mediump float ambient_occlusion_affect_light;
mediump float ambient_occlusion_affect_ao_channel;
mediump float opaque_prepass_treshold;
mediump float opaque_prepass_threshold;
bool fog_depth_enabled;
highp float fog_depth_begin;
@ -1028,12 +1028,11 @@ LIGHT_SHADER_CODE
diffuse_brdf_NL = cNdotL * (1.0 / M_PI);
#endif
#if defined(TRANSMISSION_USED)
diffuse_light += light_color * diffuse_color * mix(vec3(diffuse_brdf_NL), vec3(M_PI), transmission) * attenuation;
#else
diffuse_light += light_color * diffuse_color * diffuse_brdf_NL * attenuation;
#endif
#if defined(TRANSMISSION_USED)
diffuse_light += light_color * diffuse_color * (vec3(1.0 / M_PI) - diffuse_brdf_NL) * transmission * attenuation;
#endif
#if defined(LIGHT_USE_RIM)
@ -1630,7 +1629,7 @@ void main() {
float alpha = 1.0;
#if defined(DO_SIDE_CHECK)
float side=float(gl_FrontFacing)*2.0-1.0;
float side=gl_FrontFacing ? 1.0 : -1.0;
#else
float side=1.0;
#endif
@ -1692,7 +1691,7 @@ FRAGMENT_SHADER_CODE
#ifdef USE_OPAQUE_PREPASS
if (alpha<opaque_prepass_treshold) {
if (alpha<opaque_prepass_threshold) {
discard;
}
@ -2141,6 +2140,8 @@ FRAGMENT_SHADER_CODE
#else
//approximate ambient scale for SSAO, since we will lack full ambient
float max_emission=max(emission.r,max(emission.g,emission.b));
float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b));
@ -2172,7 +2173,6 @@ FRAGMENT_SHADER_CODE
frag_color=vec4(emission+ambient_light+diffuse_light+specular_light,alpha);
#endif //SHADELESS
#endif //USE_MULTIPLE_RENDER_TARGETS