-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelPS.hlsl
More file actions
47 lines (40 loc) · 1.3 KB
/
Copy pathModelPS.hlsl
File metadata and controls
47 lines (40 loc) · 1.3 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
Texture2D colorTexture : register(t0);
SamplerState colorSampler : register(s0);
cbuffer MaterialBuffer : register(b1)
{
float4 baseColor;
};
struct PixelInput
{
float4 position : SV_POSITION;
float3 normal : NORMAL;
float2 texcoord : TEXCOORD;
};
float4 main(PixelInput input) : SV_TARGET
{
// SIMPLE TEST: Just sample the texture
float4 texColor = colorTexture.Sample(colorSampler, input.texcoord);
// DEBUG: Show different colors based on texture result
if (texColor.a == 0.0f)
{
// Texture is fully transparent
return float4(1.0f, 0.0f, 0.0f, 1.0f); // RED = transparent
}
else if (texColor.r == 0.0f && texColor.g == 0.0f && texColor.b == 0.0f)
{
// Texture is black (or null descriptor)
return float4(0.0f, 1.0f, 0.0f, 1.0f); // GREEN = black/null
}
else if (texColor.r == 1.0f && texColor.g == 1.0f && texColor.b == 1.0f)
{
// Texture is white
return float4(0.0f, 0.0f, 1.0f, 1.0f); // BLUE = white
}
// Texture has actual color - apply lighting
float3 lightDir = normalize(float3(1.0f, 1.0f, 1.0f));
float3 normal = normalize(input.normal);
float diff = max(dot(normal, lightDir), 0.0f);
float ambient = 0.3f;
texColor.rgb *= (ambient + diff);
return texColor;
}