Cel shading Update
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// celshading.vs
|
||||
cbuffer MatrixBuffer
|
||||
{
|
||||
matrix worldMatrix;
|
||||
@@ -9,13 +8,16 @@ cbuffer MatrixBuffer
|
||||
struct VertexInputType
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 tex : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PixelInputType
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 tex : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1; // Add world position
|
||||
};
|
||||
|
||||
PixelInputType CelShadingVertexShader(VertexInputType input)
|
||||
@@ -30,8 +32,14 @@ PixelInputType CelShadingVertexShader(VertexInputType input)
|
||||
output.position = mul(output.position, viewMatrix);
|
||||
output.position = mul(output.position, projectionMatrix);
|
||||
|
||||
// Pass the normal to the pixel shader
|
||||
output.normal = mul(input.normal, (float3x3)worldMatrix);
|
||||
|
||||
// Pass the world position to the pixel shader
|
||||
output.worldPos = mul(input.position, worldMatrix).xyz;
|
||||
|
||||
// Store the texture coordinates for the pixel shader.
|
||||
output.tex = input.tex;
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user