Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
f0dc9ea3
Commit
f0dc9ea3
authored
1 year ago
by
David Parks
Browse files
Options
Downloads
Plain Diff
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
parents
85967398
db485adb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
+26
-15
26 additions, 15 deletions
...settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
with
26 additions
and
15 deletions
indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
+
26
−
15
View file @
f0dc9ea3
...
...
@@ -36,7 +36,7 @@ uniform mat4 inv_modelview_delta;
vec4
getPositionWithDepth
(
vec2
pos_screen
,
float
depth
);
float
random
(
vec2
uv
)
float
random
(
vec2
uv
)
{
return
fract
(
sin
(
dot
(
uv
,
vec2
(
12
.
9898
,
78
.
233
)))
*
43758
.
5453123
);
//simple random function
}
...
...
@@ -75,7 +75,7 @@ float getLinearDepth(vec2 tc)
return
-
pos
.
z
;
}
bool
traceScreenRay
(
vec3
position
,
vec3
reflection
,
out
vec4
hitColor
,
out
float
hitDepth
,
float
depth
,
sampler2D
textureFrame
)
bool
traceScreenRay
(
vec3
position
,
vec3
reflection
,
out
vec4
hitColor
,
out
float
hitDepth
,
float
depth
,
sampler2D
textureFrame
)
{
// transform position and reflection into same coordinate frame as the sceneMap and sceneDepth
reflection
+=
position
;
...
...
@@ -93,22 +93,27 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
bool
hit
=
false
;
hitColor
=
vec4
(
0
);
int
i
=
0
;
if
(
depth
>
depthRejectBias
)
if
(
depth
>
depthRejectBias
)
{
for
(;
i
<
iterationCount
&&
!
hit
;
i
++
)
for
(;
i
<
iterationCount
&&
!
hit
;
i
++
)
{
screenPosition
=
generateProjectedPosition
(
marchingPosition
);
if
(
screenPosition
.
x
>
1
||
screenPosition
.
x
<
0
||
screenPosition
.
y
>
1
||
screenPosition
.
y
<
0
)
{
hit
=
false
;
break
;
}
depthFromScreen
=
getLinearDepth
(
screenPosition
);
delta
=
abs
(
marchingPosition
.
z
)
-
depthFromScreen
;
if
(
depth
<
depthFromScreen
+
epsilon
&&
depth
>
depthFromScreen
-
epsilon
)
if
(
depth
<
depthFromScreen
+
epsilon
&&
depth
>
depthFromScreen
-
epsilon
)
{
break
;
}
if
(
abs
(
delta
)
<
distanceBias
)
if
(
abs
(
delta
)
<
distanceBias
)
{
vec4
color
=
vec4
(
1
);
if
(
debugDraw
)
...
...
@@ -118,7 +123,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
hit
=
true
;
break
;
}
if
(
isBinarySearchEnabled
&&
delta
>
0
)
if
(
isBinarySearchEnabled
&&
delta
>
0
)
{
break
;
}
...
...
@@ -130,7 +135,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
step
=
step
*
(
1
.
0
-
rayStep
*
max
(
directionSign
,
0
.
0
));
marchingPosition
+=
step
*
(
-
directionSign
);
}
else
else
{
marchingPosition
+=
step
;
}
...
...
@@ -148,15 +153,21 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
marchingPosition
=
marchingPosition
-
step
*
sign
(
delta
);
screenPosition
=
generateProjectedPosition
(
marchingPosition
);
if
(
screenPosition
.
x
>
1
||
screenPosition
.
x
<
0
||
screenPosition
.
y
>
1
||
screenPosition
.
y
<
0
)
{
hit
=
false
;
break
;
}
depthFromScreen
=
getLinearDepth
(
screenPosition
);
delta
=
abs
(
marchingPosition
.
z
)
-
depthFromScreen
;
if
(
depth
<
depthFromScreen
+
epsilon
&&
depth
>
depthFromScreen
-
epsilon
)
if
(
depth
<
depthFromScreen
+
epsilon
&&
depth
>
depthFromScreen
-
epsilon
)
{
break
;
}
if
(
abs
(
delta
)
<
distanceBias
&&
depthFromScreen
!=
(
depth
-
distanceBias
))
if
(
abs
(
delta
)
<
distanceBias
&&
depthFromScreen
!=
(
depth
-
distanceBias
))
{
vec4
color
=
vec4
(
1
);
if
(
debugDraw
)
...
...
@@ -326,8 +337,8 @@ collectedColor = vec4(1, 0, 1, 1);
float
jitter
=
mod
(
c
,
1
.
0
);
vec2
screenpos
=
1
-
abs
(
tc
*
2
-
1
);
float
vignette
=
clamp
((
abs
(
screenpos
.
x
)
*
abs
(
screenpos
.
y
))
*
6
4
,
0
,
1
);
vignette
*=
clamp
((
dot
(
normalize
(
viewPos
),
n
)
*
0
.
5
+
0
.
5
)
*
16
,
0
,
1
);
float
vignette
=
clamp
((
abs
(
screenpos
.
x
)
*
abs
(
screenpos
.
y
))
*
1
6
,
0
,
1
);
vignette
*=
clamp
((
dot
(
normalize
(
viewPos
),
n
)
*
0
.
5
+
0
.
5
)
*
5
.
5
-
0
.
8
,
0
,
1
);
float
zFar
=
128
.
0
;
vignette
*=
clamp
(
1
.
0
+
(
viewPos
.
z
/
zFar
),
0
.
0
,
1
.
0
);
...
...
@@ -345,7 +356,7 @@ collectedColor = vec4(1, 0, 1, 1);
{
if
(
vignette
>
0
)
{
for
(
int
i
=
0
;
i
<
totalSamples
;
i
++
)
for
(
int
i
=
0
;
i
<
totalSamples
;
i
++
)
{
vec3
firstBasis
=
normalize
(
cross
(
getPoissonSample
(
i
),
rayDirection
));
vec3
secondBasis
=
normalize
(
cross
(
rayDirection
,
firstBasis
));
...
...
@@ -358,7 +369,7 @@ collectedColor = vec4(1, 0, 1, 1);
hitpoint
.
a
=
0
;
if
(
hit
)
if
(
hit
)
{
++
hits
;
collectedColor
+=
hitpoint
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment