diff options
Diffstat (limited to 'servers/rendering/renderer_rd/shaders/effects/subsurface_scattering.glsl')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/effects/subsurface_scattering.glsl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/servers/rendering/renderer_rd/shaders/effects/subsurface_scattering.glsl b/servers/rendering/renderer_rd/shaders/effects/subsurface_scattering.glsl index fb35d3cde6..553637dc4f 100644 --- a/servers/rendering/renderer_rd/shaders/effects/subsurface_scattering.glsl +++ b/servers/rendering/renderer_rd/shaders/effects/subsurface_scattering.glsl @@ -152,10 +152,10 @@ void main() { float depth_scale; if (params.orthogonal) { - depth = ((depth + (params.camera_z_far + params.camera_z_near) / (params.camera_z_far - params.camera_z_near)) * (params.camera_z_far - params.camera_z_near)) / 2.0; + depth = -(depth * (params.camera_z_far - params.camera_z_near) - (params.camera_z_far + params.camera_z_near)) / 2.0; depth_scale = params.unit_size; //remember depth is negative by default in OpenGL } else { - depth = 2.0 * params.camera_z_near * params.camera_z_far / (params.camera_z_far + params.camera_z_near - depth * (params.camera_z_far - params.camera_z_near)); + depth = 2.0 * params.camera_z_near * params.camera_z_far / (params.camera_z_far + params.camera_z_near + depth * (params.camera_z_far - params.camera_z_near)); depth_scale = params.unit_size / depth; //remember depth is negative by default in OpenGL } |