Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
a69de679
Commit
a69de679
authored
Jul 27, 2019
by
chili
Browse files
exponential glossiness mapping
parent
bfe02273
Changes
1
Show whitespace changes
Inline
Side-by-side
hw3d/PhongPSSpecMap.hlsl
View file @
a69de679
...
...
@@ -14,8 +14,6 @@ Texture2D spec;
SamplerState
splr
;
static
const
float
specularPowerFactor
=
100
.
0
f
;
float4
main
(
float3
worldPos
:
Position
,
float3
n
:
Normal
,
float2
tc
:
Texcoord
)
:
SV_Target
{
...
...
@@ -33,7 +31,7 @@ float4 main(float3 worldPos : Position, float3 n : Normal, float2 tc : Texcoord)
// calculate specular intensity based on angle between viewing vector and reflection vector, narrow with power function
const
float4
specularSample
=
spec
.
Sample
(
splr
,
tc
);
const
float3
specularReflectionColor
=
specularSample
.
rgb
;
const
float
specularPower
=
specularSample
.
a
*
specularPowerFactor
;
const
float
specularPower
=
pow
(
2
.
0
f
,
specularSample
.
a
*
13
.
0
f
)
;
const
float3
specular
=
att
*
(
diffuseColor
*
diffuseIntensity
)
*
pow
(
max
(
0
.
0
f
,
dot
(
normalize
(
-
r
),
normalize
(
worldPos
))),
specularPower
);
// final color
return
float4
(
saturate
((
diffuse
+
ambient
)
*
tex
.
Sample
(
splr
,
tc
).
rgb
+
specular
*
specularReflectionColor
),
1
.
0
f
);
...
...
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