Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
f8748ef0
Commit
f8748ef0
authored
Sep 12, 2016
by
Christopher Tenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix shading when Shininess is set to 0 refs #69
parent
452d868f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Shaders/ShaderGen/SG_LIGHTING.GLSL
Shaders/ShaderGen/SG_LIGHTING.GLSL
+3
-3
No files found.
Shaders/ShaderGen/SG_LIGHTING.GLSL
View file @
f8748ef0
...
...
@@ -33,7 +33,7 @@ vec3 LitPointLight(vec3 vPosition,
// specular
vec3
h
=
normalize
(
vLightDir
-
vec3
(
0
,
0
,
-
1
));
// half vector between light and view direction
float
hdotn
=
max
(
dot
(
h
,
vNormal
),
0
.
0
);
float
hdotn
=
max
(
dot
(
h
,
vNormal
),
0
.
0
01
);
// small epsilon to avoid undefined pow(0, 0) if shininess is also 0
cLight
+=
(
pow
(
hdotn
,
SHININESS
)
*
cLightSpecular
)
*
g_cSpecular
;
...
...
@@ -60,7 +60,7 @@ vec3 LitDirLight(vec3 vPosition,
// specular
vec3
h
=
normalize
(
vLightDir
-
vec3
(
0
,
0
,
-
1
));
// half vector between light and view direction
float
hdotn
=
max
(
dot
(
h
,
vNormal
),
0
.
0
);
float
hdotn
=
max
(
dot
(
h
,
vNormal
),
0
.
0
01
);
// small epsilon to avoid undefined pow(0, 0) if shininess is also 0
cLight
+=
(
pow
(
hdotn
,
SHININESS
)
*
cLightSpecular
)
*
g_cSpecular
;
return
cLight
;
...
...
@@ -93,7 +93,7 @@ vec3 LitSpotLight(vec3 vPosition,
// specular
vec3
h
=
normalize
(
vLightDir
-
vec3
(
0
,
0
,
-
1
));
// half vector between light and view direction
float
hdotn
=
max
(
dot
(
h
,
vNormal
),
0
.
0
);
float
hdotn
=
max
(
dot
(
h
,
vNormal
),
0
.
0
01
);
// small epsilon to avoid undefined pow(0, 0) if shininess is also 0
cLight
+=
(
pow
(
hdotn
,
SHININESS
)
*
cLightSpecular
)
*
g_cSpecular
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment