From ae3903561c8f5163c75007a2bee97bbfa9bf2428 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 23 Feb 2026 04:02:21 -0800 Subject: [PATCH] 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. --- include/rendering/vk_pipeline.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rendering/vk_pipeline.hpp b/include/rendering/vk_pipeline.hpp index 86929b72..ea0a3e10 100644 --- a/include/rendering/vk_pipeline.hpp +++ b/include/rendering/vk_pipeline.hpp @@ -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;