diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-05 08:11:33 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-05 08:11:33 -0500 |
commit | 30bcc7d6d5fa4ceedfec28cc0973c253364c555e (patch) | |
tree | 55be9de647378b14acfb2681f050bf8b4fbc7ae2 /indra/newview/app_settings/shaders/class1/deferred | |
parent | 1e72e3d82c438c2ca17bd8efb80709eaca6c14ca (diff) |
SL-18190 WIP - Add refraction to water without splitting scene between above and below water
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index bca4771c27..1c2034de69 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -310,16 +310,21 @@ vec4 getPosition(vec2 pos_screen) return pos; } +// get position given a normalized device coordinate +vec3 getPositionWithNDC(vec3 ndc) +{ + vec4 pos = inv_proj * vec4(ndc, 1.0); + return pos.xyz / pos.w; +} + vec4 getPositionWithDepth(vec2 pos_screen, float depth) { vec2 sc = getScreenCoordinate(pos_screen); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; + vec3 ndc = vec3(sc.x, sc.y, 2.0*depth-1.0); + return vec4(getPositionWithNDC(ndc), 1.0); } + vec2 getScreenXY(vec4 clip) { vec4 ndc = clip; |