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
0b69ae86
Commit
0b69ae86
authored
Apr 03, 2019
by
chili
Browse files
better, but position doesn't matter
parent
8332eb95
Changes
1
Show whitespace changes
Inline
Side-by-side
hw3d/PhongPS.hlsl
View file @
0b69ae86
...
@@ -4,12 +4,12 @@ cbuffer LightCBuf
...
@@ -4,12 +4,12 @@ cbuffer LightCBuf
};
};
static
const
float3
materialColor
=
{
0
.
7
f
,
0
.
7
f
,
0
.
9
f
};
static
const
float3
materialColor
=
{
0
.
7
f
,
0
.
7
f
,
0
.
9
f
};
static
const
float3
ambient
=
{
0
.
1
5
f
,
0
.
1
5
f
,
0
.
1
5
f
};
static
const
float3
ambient
=
{
0
.
0
5
f
,
0
.
0
5
f
,
0
.
0
5
f
};
static
const
float3
diffuseColor
=
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
};
static
const
float3
diffuseColor
=
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
};
static
const
float
diffuseIntensity
=
1
.
0
f
;
static
const
float
diffuseIntensity
=
1
.
0
f
;
static
const
float
attConst
=
1
.
0
f
;
static
const
float
attConst
=
1
.
0
f
;
static
const
float
attLin
=
1
.
0
f
;
static
const
float
attLin
=
0
.
0
45
f
;
static
const
float
attQuad
=
1
.
0
f
;
static
const
float
attQuad
=
0
.
0
075
f
;
float4
main
(
float3
worldPos
:
Position
,
float3
n
:
Normal
)
:
SV_Target
float4
main
(
float3
worldPos
:
Position
,
float3
n
:
Normal
)
:
SV_Target
{
{
...
@@ -18,7 +18,7 @@ float4 main( float3 worldPos : Position,float3 n : Normal ) : SV_Target
...
@@ -18,7 +18,7 @@ float4 main( float3 worldPos : Position,float3 n : Normal ) : SV_Target
const
float
distToL
=
length
(
vToL
);
const
float
distToL
=
length
(
vToL
);
const
float3
dirToL
=
vToL
/
distToL
;
const
float3
dirToL
=
vToL
/
distToL
;
// diffuse attenuation
// diffuse attenuation
const
float
att
=
attConst
+
attLin
*
distToL
+
attQuad
*
(
distToL
*
distToL
);
const
float
att
=
1
.
0
f
/
(
attConst
+
attLin
*
distToL
+
attQuad
*
(
distToL
*
distToL
)
)
;
// diffuse intensity
// diffuse intensity
const
float3
diffuse
=
diffuseColor
*
diffuseIntensity
*
att
*
max
(
0
.
0
f
,
dot
(
dirToL
,
n
)
);
const
float3
diffuse
=
diffuseColor
*
diffuseIntensity
*
att
*
max
(
0
.
0
f
,
dot
(
dirToL
,
n
)
);
// final color
// final color
...
...
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