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
7e2c4cd9
Commit
7e2c4cd9
authored
11 years ago
by
Graham Linden
Browse files
Options
Downloads
Patches
Plain Diff
NORSPEC-314 fix discrepancies between alpha and non-alpha deferred point/spot atten
parent
4854444e
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/alphaF.glsl
+22
-14
22 additions, 14 deletions
.../newview/app_settings/shaders/class1/deferred/alphaF.glsl
with
22 additions
and
14 deletions
indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+
22
−
14
View file @
7e2c4cd9
...
@@ -85,7 +85,7 @@ vec3 calcDirectionalLight(vec3 n, vec3 l)
...
@@ -85,7 +85,7 @@ vec3 calcDirectionalLight(vec3 n, vec3 l)
return
vec3
(
a
,
a
,
a
);
return
vec3
(
a
,
a
,
a
);
}
}
vec3
calcPointLightOrSpotLight
(
vec3
v
,
vec3
n
,
vec4
lp
,
vec3
ln
,
float
la
,
float
fa
,
float
is_pointlight
)
vec3
calcPointLightOrSpotLight
(
vec3
light_col
,
vec3
diffuse
,
vec3
v
,
vec3
n
,
vec4
lp
,
vec3
ln
,
float
la
,
float
fa
,
float
is_pointlight
)
{
{
//get light vector
//get light vector
vec3
lv
=
lp
.
xyz
-
v
;
vec3
lv
=
lp
.
xyz
-
v
;
...
@@ -93,7 +93,9 @@ vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float
...
@@ -93,7 +93,9 @@ vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float
//get distance
//get distance
float
d
=
length
(
lv
);
float
d
=
length
(
lv
);
float
da
=
0
.
0
;
float
da
=
1
.
0
;
vec3
col
=
vec3
(
0
);
if
(
d
>
0
.
0
&&
la
>
0
.
0
&&
fa
>
0
.
0
)
if
(
d
>
0
.
0
&&
la
>
0
.
0
&&
fa
>
0
.
0
)
{
{
...
@@ -102,20 +104,25 @@ vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float
...
@@ -102,20 +104,25 @@ vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float
//distance attenuation
//distance attenuation
float
dist
=
d
/
la
;
float
dist
=
d
/
la
;
da
=
clamp
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
0
.
0
,
1
.
0
);
float
dist_atten
=
clamp
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
0
.
0
,
1
.
0
);
da
*=
da
;
dist_atten
*=
dist_atten
;
da
*=
2
.
0
;
dist_atten
*=
2
.
0
;
// spotlight coefficient.
// spotlight coefficient.
float
spot
=
max
(
dot
(
-
ln
,
lv
),
is_pointlight
);
float
spot
=
max
(
dot
(
-
ln
,
lv
),
is_pointlight
);
da
*=
spot
*
spot
;
// GL_SPOT_EXPONENT=2
da
*=
spot
*
spot
;
// GL_SPOT_EXPONENT=2
//angular attenuation
//angular attenuation
da
*=
max
(
dot
(
n
,
lv
),
0
.
0
);
da
*=
max
(
dot
(
n
,
lv
),
0
.
0
);
float
lit
=
max
(
da
*
dist_atten
,
0
.
0
);
col
=
light_col
*
lit
*
diffuse
;
// no spec for alpha shader...
}
}
return
vec3
(
da
,
da
,
da
);
return
max
(
col
,
vec3
(
0
.
0
,
0
.
0
,
0
.
0
)
);
}
}
#if HAS_SHADOW
#if HAS_SHADOW
...
@@ -321,15 +328,12 @@ void main()
...
@@ -321,15 +328,12 @@ void main()
color
.
rgb
*=
gamma_diff
.
rgb
;
color
.
rgb
*=
gamma_diff
.
rgb
;
color
.
rgb
=
atmosLighting
(
color
.
rgb
);
color
.
rgb
=
atmosLighting
(
color
.
rgb
);
color
.
rgb
=
scaleSoftClip
(
color
.
rgb
);
color
.
rgb
=
scaleSoftClip
(
color
.
rgb
);
color
.
rgb
=
srgb_to_linear
(
color
.
rgb
);
col
=
vec4
(
0
,
0
,
0
,
0
);
col
=
vec4
(
0
,
0
,
0
,
0
);
#define LIGHT_LOOP(i) col.rgb +=
light_diffuse[i].rgb *
calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
#define LIGHT_LOOP(i) col.rgb += calcPointLightOrSpotLight(
light_diffuse[i].rgb, diff.rgb,
pos.xyz, normal, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
LIGHT_LOOP
(
1
)
LIGHT_LOOP
(
1
)
LIGHT_LOOP
(
2
)
LIGHT_LOOP
(
2
)
LIGHT_LOOP
(
3
)
LIGHT_LOOP
(
3
)
...
@@ -338,8 +342,12 @@ void main()
...
@@ -338,8 +342,12 @@ void main()
LIGHT_LOOP
(
6
)
LIGHT_LOOP
(
6
)
LIGHT_LOOP
(
7
)
LIGHT_LOOP
(
7
)
color
.
rgb
+=
diff
.
rgb
*
vary_pointlight_col_linear
*
col
.
rgb
;
// keep it linear
//
color
.
rgb
=
srgb_to_linear
(
color
.
rgb
)
+
col
.
rgb
;
// ramp directly to display gamma as we're POST-deferred
//
color
.
rgb
=
pow
(
color
.
rgb
,
vec3
(
display_gamma
));
color
.
rgb
=
pow
(
color
.
rgb
,
vec3
(
display_gamma
));
#ifdef WATER_FOG
#ifdef WATER_FOG
...
...
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