mirror of
https://github.com/godotengine/godot.git
synced 2025-02-16 07:40:36 +00:00
Merge pull request #64342 from clayjohn/DOF-scale
Properly scale depth in bokeh_dof effect
This commit is contained in:
commit
117c530e1d
@ -30,7 +30,7 @@ layout(set = 1, binding = 0) uniform sampler2D source_bokeh;
|
|||||||
#ifdef MODE_GEN_BLUR_SIZE
|
#ifdef MODE_GEN_BLUR_SIZE
|
||||||
|
|
||||||
float get_depth_at_pos(vec2 uv) {
|
float get_depth_at_pos(vec2 uv) {
|
||||||
float depth = textureLod(source_depth, uv, 0.0).x;
|
float depth = textureLod(source_depth, uv, 0.0).x * 2.0 - 1.0;
|
||||||
if (params.orthogonal) {
|
if (params.orthogonal) {
|
||||||
depth = ((depth + (params.z_far + params.z_near) / (params.z_far - params.z_near)) * (params.z_far - params.z_near)) / 2.0;
|
depth = ((depth + (params.z_far + params.z_near) / (params.z_far - params.z_near)) * (params.z_far - params.z_near)) / 2.0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,7 +52,7 @@ layout(set = 2, binding = 0) uniform sampler2D original_weight;
|
|||||||
#ifdef MODE_GEN_BLUR_SIZE
|
#ifdef MODE_GEN_BLUR_SIZE
|
||||||
|
|
||||||
float get_depth_at_pos(vec2 uv) {
|
float get_depth_at_pos(vec2 uv) {
|
||||||
float depth = textureLod(source_depth, uv, 0.0).x;
|
float depth = textureLod(source_depth, uv, 0.0).x * 2.0 - 1.0;
|
||||||
if (params.orthogonal) {
|
if (params.orthogonal) {
|
||||||
depth = ((depth + (params.z_far + params.z_near) / (params.z_far - params.z_near)) * (params.z_far - params.z_near)) / 2.0;
|
depth = ((depth + (params.z_far + params.z_near) / (params.z_far - params.z_near)) * (params.z_far - params.z_near)) / 2.0;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user