Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
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
JennaHuntsman
XDG Integration
Commits
63c5ffa8
Commit
63c5ffa8
authored
3 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Port rainbow fix to class1 deferred sky fragment shader
parent
c0ca9670
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+16
-7
16 additions, 7 deletions
indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
with
16 additions
and
7 deletions
indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+
16
−
7
View file @
63c5ffa8
...
@@ -48,14 +48,23 @@ out vec4 frag_data[3];
...
@@ -48,14 +48,23 @@ out vec4 frag_data[3];
vec3
rainbow
(
float
d
)
vec3
rainbow
(
float
d
)
{
{
// 'Interesting' values of d are -0.75 .. -0.825, i.e. when view vec nearly opposite of sun vec
// d is the dot product of view and sun directions, so ranging -1.0..1.0
// Rainbox tex is mapped with REPEAT, so -.75 as tex coord is same as 0.25. -0.825 -> 0.175. etc.
// 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec
// SL-13629
// Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175.
// Unfortunately the texture is inverted, so we need to invert the y coord, but keep the 'interesting'
// part within the same 0.175..0.250 range, i.e. d = (1 - d) - 1.575
// SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted.
d
=
clamp
(
-
0
.
575
-
d
,
0
.
0
,
1
.
0
);
// Rather than replace the texture, we mirror and translate the y tc to keep the colors within the
// interesting range, but in reversed order: i.e. d = (1 - d) - 1.575
d
=
clamp
(
-
0
.
575
-
d
,
0
.
0
,
1
.
0
);
// With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible.
// So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate
// space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857
float
interior_coord
=
max
(
0
.
0
,
d
-
0
.
25
)
*
4
.
2857
;
d
=
clamp
(
d
,
0
.
0
,
0
.
25
)
+
interior_coord
;
float
rad
=
(
droplet_radius
-
5
.
0
f
)
/
1024
.
0
f
;
float
rad
=
(
droplet_radius
-
5
.
0
f
)
/
1024
.
0
f
;
return
pow
(
texture2D
(
rainbow_map
,
vec2
(
rad
+
0
.
5
,
d
)).
rgb
,
vec3
(
1
.
8
))
*
moisture_level
;
return
pow
(
texture2D
(
rainbow_map
,
vec2
(
rad
,
d
)).
rgb
,
vec3
(
1
.
8
))
*
moisture_level
;
}
}
vec3
halo22
(
float
d
)
vec3
halo22
(
float
d
)
...
...
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