Fix specular direction by correcting front face winding for Vulkan Y-flip

The projection matrix Y-flip (projectionMatrix[1][1] *= -1) reverses
triangle winding from the GPU's perspective. With the default
VK_FRONT_FACE_COUNTER_CLOCKWISE, gl_FrontFacing was inverted, causing
all fragment shaders (M2, WMO, character) to flip normals on front
faces instead of back faces, putting specular highlights on the wrong
side of surfaces.
This commit is contained in:
Kelsi 2026-02-23 04:02:21 -08:00
parent ef1e5abe8e
commit ae3903561c

View file

@ -43,7 +43,7 @@ public:
// Rasterization
PipelineBuilder& setRasterization(VkPolygonMode polygonMode,
VkCullModeFlags cullMode,
VkFrontFace frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE);
VkFrontFace frontFace = VK_FRONT_FACE_CLOCKWISE);
// Depth test/write
PipelineBuilder& setDepthTest(bool enable, bool writeEnable,
@ -92,7 +92,7 @@ private:
VkBool32 primitiveRestart_ = VK_FALSE;
VkPolygonMode polygonMode_ = VK_POLYGON_MODE_FILL;
VkCullModeFlags cullMode_ = VK_CULL_MODE_NONE;
VkFrontFace frontFace_ = VK_FRONT_FACE_COUNTER_CLOCKWISE;
VkFrontFace frontFace_ = VK_FRONT_FACE_CLOCKWISE;
bool depthTestEnable_ = false;
bool depthWriteEnable_ = false;
VkCompareOp depthCompareOp_ = VK_COMPARE_OP_LESS;