This breaks with a perspective projection as then the perspective is also inverted.
- User
This breaks with a perspective projection as then the perspective is also inverted.
Assistant
You're absolutely right. When mirroring in a perspective projection, simply flipping the vertex positions will invert the perspective, causing incorrect rendering. Let's fix this by properly handling the perspective transformation:
shader_type spatial; uniform bool mirror_x = true; void vertex() { // Store original position vec3 original_pos = VERTEX; // Apply mirroring before projection if (mirror_x) { // Mirror the X component VERTEX.x = -VERTEX.x; // Flip normal, binormal, and tangent X components NORMAL.x = -NORMAL.x; BINORMAL.x = -BINORMAL.x; TANGENT.x = -TANGENT.x; } // Let Godot handle the perspective projection normally // The engine will transform VERTEX to clip space after this shader runs }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.