summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-01-27 17:24:22 -0600
committerGitHub <noreply@github.com>2023-01-27 17:24:22 -0600
commit3ef31cb9b28f7b026e109eab69d383dddc922850 (patch)
treeeb4034470bbc59bba139a66b053583bb05e3d7c1 /indra/newview/app_settings/shaders/class1/deferred
parent503e18fc646c6d88cd8006ad2210a8afd0bced83 (diff)
SL-19203 et al -- Integrate SSR with reflection probes, tweak probe blending. (#63)
* SL-19203 WIP -- Integrate SSR with reflection probes. Decruft LLRenderTarget. * SL-19203 WIP -- Re-integrate SSR. Incidental decruft. * SL-19203 WIP -- SSR frame delta correction (still broken for Z) * SL-19203 WIP -- SSR frame delta Z fix * SL-19203 WIP -- Make SSR toggleable again and disable SSR in cube snapshots. * SL-19203 WIP -- Soften sphere probe transitions and fix reflections on void water (make fallback probe a simple terrain+water+sky probe). Remove parallax correction for automatic probes to reduce artifacts. * SL-19203 Tune probe blending. * SL-19203 Cleanup.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl101
3 files changed, 15 insertions, 122 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl
index 95abd4d932..2ffe688524 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl
@@ -25,14 +25,14 @@
// fallback stub -- will be used if actual reflection probe shader failed to load (output pink so it's obvious)
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
- vec3 pos, vec3 norm, float glossiness, bool errorCorrect)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, bool errorCorrect)
{
ambenv = vec3(1,0,1);
glossenv = vec3(1,0,1);
}
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
- vec3 pos, vec3 norm, float glossiness)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness)
{
sampleReflectionProbes(ambenv, glossenv,
pos, norm, glossiness, false);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl
index 8373567bb0..df16e7f0e7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl
@@ -23,35 +23,11 @@
* $/LicenseInfo$
*/
-#extension GL_ARB_texture_rectangle : enable
+ // debug stub
-/*[EXTRA_CODE_HERE]*/
-
-#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-uniform vec2 screen_res;
-uniform mat4 projection_matrix;
-uniform mat4 inv_proj;
-uniform float zNear;
-uniform float zFar;
-
-VARYING vec2 vary_fragcoord;
-
-uniform sampler2D depthMap;
-uniform sampler2D normalMap;
-uniform sampler2D sceneMap;
-uniform sampler2D diffuseRect;
-
-vec3 getNorm(vec2 screenpos);
-float getDepth(vec2 pos_screen);
-float linearDepth(float d, float znear, float zfar);
-void main() {
- vec2 tc = vary_fragcoord.xy;
- vec4 pos = getPositionWithDepth(tc, getDepth(tc));
- frag_color = pos;
+void main()
+{
+ frag_color = vec4(0.5, 0.4, 0.1, 0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
index 6dfc89a6c6..b3da216b81 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
@@ -23,98 +23,15 @@
* $/LicenseInfo$
*/
-uniform sampler2D depthMap;
-uniform sampler2D normalMap;
-uniform sampler2D sceneMap;
-uniform vec2 screen_res;
-uniform mat4 projection_matrix;
+// debug stub
-// Shamelessly taken from http://casual-effects.blogspot.com/2014/08/screen-space-ray-tracing.html
-// Original paper: https://jcgt.org/published/0003/04/04/
-// By Morgan McGuire and Michael Mara at Williams College 2014
-// Released as open source under the BSD 2-Clause License
-// http://opensource.org/licenses/BSD-2-Clause
-
-float distanceSquared(vec2 a, vec2 b) { a -= b; return dot(a, a); }
-
-bool traceScreenSpaceRay1(vec3 csOrig, vec3 csDir, mat4 proj, float zThickness,
- float nearPlaneZ, float stride, float jitter, const float maxSteps, float maxDistance,
- out vec2 hitPixel, out vec3 hitPoint)
+float random (vec2 uv)
{
-
- // Clip to the near plane
- float rayLength = ((csOrig.z + csDir.z * maxDistance) > nearPlaneZ) ?
- (nearPlaneZ - csOrig.z) / csDir.z : maxDistance;
- vec3 csEndPoint = csOrig + csDir * rayLength;
-
- // Project into homogeneous clip space
- vec4 H0 = proj * vec4(csOrig, 1.0);
- vec4 H1 = proj * vec4(csEndPoint, 1.0);
- float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;
-
- // The interpolated homogeneous version of the camera-space points
- vec3 Q0 = csOrig * k0, Q1 = csEndPoint * k1;
-
- // Screen-space endpoints
- vec2 P0 = H0.xy * k0, P1 = H1.xy * k1;
-
- // If the line is degenerate, make it cover at least one pixel
- // to avoid handling zero-pixel extent as a special case later
- P1 += vec2((distanceSquared(P0, P1) < 0.0001) ? 0.01 : 0.0);
- vec2 delta = P1 - P0;
-
- // Permute so that the primary iteration is in x to collapse
- // all quadrant-specific DDA cases later
- bool permute = false;
- if (abs(delta.x) < abs(delta.y)) {
- // This is a more-vertical line
- permute = true; delta = delta.yx; P0 = P0.yx; P1 = P1.yx;
- }
-
- float stepDir = sign(delta.x);
- float invdx = stepDir / delta.x;
-
- // Track the derivatives of Q and k
- vec3 dQ = (Q1 - Q0) * invdx;
- float dk = (k1 - k0) * invdx;
- vec2 dP = vec2(stepDir, delta.y * invdx);
-
- // Scale derivatives by the desired pixel stride and then
- // offset the starting values by the jitter fraction
- dP *= stride; dQ *= stride; dk *= stride;
- P0 += dP * jitter; Q0 += dQ * jitter; k0 += dk * jitter;
-
- // Slide P from P0 to P1, (now-homogeneous) Q from Q0 to Q1, k from k0 to k1
- vec3 Q = Q0;
-
- // Adjust end condition for iteration direction
- float end = P1.x * stepDir;
-
- float k = k0, stepCount = 0.0, prevZMaxEstimate = csOrig.z;
- float rayZMin = prevZMaxEstimate, rayZMax = prevZMaxEstimate;
- float sceneZMax = rayZMax + 100;
- for (vec2 P = P0;
- ((P.x * stepDir) <= end) && (stepCount < maxSteps) &&
- ((rayZMax < sceneZMax - zThickness) || (rayZMin > sceneZMax)) &&
- (sceneZMax != 0);
- P += dP, Q.z += dQ.z, k += dk, ++stepCount) {
-
- rayZMin = prevZMaxEstimate;
- rayZMax = (dQ.z * 0.5 + Q.z) / (dk * 0.5 + k);
- prevZMaxEstimate = rayZMax;
- if (rayZMin > rayZMax) {
- float t = rayZMin; rayZMin = rayZMax; rayZMax = t;
- }
-
- hitPixel = permute ? P.yx : P;
- hitPixel.y = screen_res.y - hitPixel.y;
- // You may need hitPixel.y = screen_res.y - hitPixel.y; here if your vertical axis
- // is different than ours in screen space
- sceneZMax = texelFetch(depthMap, ivec2(hitPixel)).r;
- }
-
- // Advance Q based on the number of steps
- Q.xy += dQ.xy * stepCount;
- hitPoint = Q * (1.0 / k);
- return (rayZMax >= sceneZMax - zThickness) && (rayZMin < sceneZMax);
+ return 0;
}
+
+float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source)
+{
+ collectedColor = vec4(0);
+ return 0;
+} \ No newline at end of file