-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeferredPS.hlsl
More file actions
70 lines (53 loc) · 1.44 KB
/
Copy pathDeferredPS.hlsl
File metadata and controls
70 lines (53 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Geometry Pass Pixel Shader
Texture2D diffuseTex : register(t0);
SamplerState wrapSampler : register(s0);
SamplerState clampSampler : register(s1);
struct PixelInput
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD;
float3 normal : NORMAL;
float3 worldPos : WORLDPOS;
};
struct PixelOutput
{
float4 position : SV_TARGET0;
float3 normal : SV_TARGET1;
float3 worldPos : SV_TARGET2;
float4 diffuse : SV_TARGET3;
float4 ambientMTL : SV_TARGET4;
float4 diffuseMTL : SV_TARGET5;
float4 specularMTL : SV_TARGET6;
float4 lightClipPos : SV_TARGET7;
};
cbuffer mtlData : register(b0)
{
float4 kA;
float4 kD;
float4 kS;
float4 reflectionColor;
float shine = 1; //shinyness
bool hasReflection = false;
bool isObj = true;
bool isTransparent = false;
bool canMove = false;
float textureIndex = 0;
float index = 0;
}
cbuffer LightMatrix : register(b1)
{
float4x4 lightMatrix;
}
PixelOutput main(PixelInput input)
{
PixelOutput output;
output.position = input.position;
output.normal = input.normal;
output.worldPos = input.worldPos;
output.diffuse = diffuseTex.Sample(wrapSampler, input.tex);
output.ambientMTL = kA;
output.diffuseMTL = kD;
output.specularMTL = kS;
output.lightClipPos = mul(float4(output.worldPos, 1.0f), lightMatrix);
return output;
}