2025-01-14 16:10:40 +01:00

35 lines
942 B
PostScript

cbuffer LightBuffer
{
float4 diffuseColor;
float3 lightDirection;
float padding; // Padding to ensure the structure is a multiple of 16 bytes.
float3 lightPosition; // Add light position
float padding2; // Padding to ensure the structure is a multiple of 16 bytes.
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
float padding3; // Padding to ensure the structure is a multiple of 16 bytes.
};
Texture2D shaderTexture;
SamplerState SampleType;
struct PixelInputType
{
float4 position : SV_POSITION;
float3 normal : NORMAL;
float2 tex : TEXCOORD0;
float3 worldPos : TEXCOORD1; // Add world position
};
float4 CelShadingPixelShader(PixelInputType input) : SV_TARGET
{
// Normalize the normal
float3 normal = normalize(input.normal);
// Convert the normal to a color
float4 color = float4((normal + 1.0f) * 0.5f, 1.0f);
return color;
}