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
a6d6652f
Commit
a6d6652f
authored
2 years ago
by
Ptolemy
Browse files
Options
Downloads
Patches
Plain Diff
SL-17763: PBR: Add common spotlight ambiance calcs to deferred utilities
parent
e408fb9f
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/deferredUtil.glsl
+30
-1
30 additions, 1 deletion
...ew/app_settings/shaders/class1/deferred/deferredUtil.glsl
with
30 additions
and
1 deletion
indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+
30
−
1
View file @
a6d6652f
...
@@ -34,6 +34,7 @@ uniform vec3 proj_p; //plane projection is emitting from (in screen space)
...
@@ -34,6 +34,7 @@ uniform vec3 proj_p; //plane projection is emitting from (in screen space)
uniform
float
proj_focus
;
// distance from plane to begin blurring
uniform
float
proj_focus
;
// distance from plane to begin blurring
uniform
float
proj_lod
;
// (number of mips in proj map)
uniform
float
proj_lod
;
// (number of mips in proj map)
uniform
float
proj_range
;
// range between near clip and far clip plane of projection
uniform
float
proj_range
;
// range between near clip and far clip plane of projection
uniform
float
proj_ambiance
;
// light params
// light params
uniform
vec3
color
;
// light_color
uniform
vec3
color
;
// light_color
...
@@ -146,6 +147,18 @@ float getDepth(vec2 pos_screen)
...
@@ -146,6 +147,18 @@ float getDepth(vec2 pos_screen)
return
depth
;
return
depth
;
}
}
vec4
getTexture2DLodAmbient
(
vec2
tc
,
float
lod
)
{
vec4
ret
=
texture2DLod
(
projectionMap
,
tc
,
lod
);
ret
.
rgb
=
srgb_to_linear
(
ret
.
rgb
);
vec2
dist
=
tc
-
vec2
(
0
.
5
);
float
d
=
dot
(
dist
,
dist
);
ret
*=
min
(
clamp
((
0
.
25
-
d
)
/
0
.
25
,
0
.
0
,
1
.
0
),
1
.
0
);
return
ret
;
}
vec4
getTexture2DLodDiffuse
(
vec2
tc
,
float
lod
)
vec4
getTexture2DLodDiffuse
(
vec2
tc
,
float
lod
)
{
{
vec4
ret
=
texture2DLod
(
projectionMap
,
tc
,
lod
);
vec4
ret
=
texture2DLod
(
projectionMap
,
tc
,
lod
);
...
@@ -160,8 +173,24 @@ vec4 getTexture2DLodDiffuse(vec2 tc, float lod)
...
@@ -160,8 +173,24 @@ vec4 getTexture2DLodDiffuse(vec2 tc, float lod)
return
ret
;
return
ret
;
}
}
//
Returns projected light in Linear
//
lit This is set by the caller: if (nl > 0.0) { lit = attenuation * nl * noise; }
// Uses:
// Uses:
// color Projected spotlight color
vec3
getProjectedLightAmbiance
(
float
amb_da
,
float
attenuation
,
float
lit
,
float
nl
,
float
noise
,
vec2
projected_uv
)
{
vec4
amb_plcol
=
getTexture2DLodAmbient
(
projected_uv
,
proj_lod
);
vec3
amb_rgb
=
amb_plcol
.
rgb
*
amb_plcol
.
a
;
amb_da
+=
proj_ambiance
;
amb_da
+=
(
nl
*
nl
*
0
.
5
+
0
.
5
)
*
proj_ambiance
;
amb_da
*=
attenuation
*
noise
;
amb_da
=
min
(
amb_da
,
1
.
0
-
lit
);
return
(
amb_da
*
color
.
rgb
*
amb_rgb
);
}
// Returns projected light in Linear
// Uses global spotlight color:
// color
// color
// NOTE: projected.a will be pre-multiplied with projected.rgb
// NOTE: projected.a will be pre-multiplied with projected.rgb
vec3
getProjectedLightDiffuseColor
(
float
light_distance
,
vec2
projected_uv
)
vec3
getProjectedLightDiffuseColor
(
float
light_distance
,
vec2
projected_uv
)
...
...
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