Files
Cortex_Engine/Content/cube.obj
T
emil28092005 d2078f3ee0 fix: cube.obj winding order — all faces now CCW from outside
Root cause: ALL 12 faces in cube.obj had reversed winding order.
This caused every face normal to point inward, breaking:
- Diffuse lighting (NdotL < 0 → no light on any face)
- Shadow bias (slope-dependent bias used wrong NdotL)
- Shadow self-shadowing (both sides rendered with CULL_NONE)

Fix: reversed all face indices to correct CCW winding:
- Back face: f 1 4 3, f 1 3 2 (was f 1 2 3, f 1 3 4)
- Front face: f 5 6 7, f 5 7 8 (was f 5 7 6, f 5 8 7)
- Left/Right/Bottom/Top: all reversed

Now MeshMath.ComputeFaceNormal produces correct outward normals.
Normal flip in shader (dot(N,V) < 0) is still kept as safety for
double-sided rendering, but cubes now have correct normals natively.
2026-06-18 21:57:32 +03:00

34 lines
669 B
Plaintext

# Simple unit cube — consistent CCW winding (viewed from outside)
v -0.5 -0.5 -0.5
v 0.5 -0.5 -0.5
v 0.5 0.5 -0.5
v -0.5 0.5 -0.5
v -0.5 -0.5 0.5
v 0.5 -0.5 0.5
v 0.5 0.5 0.5
v -0.5 0.5 0.5
# Back face (normal -Z, CCW from outside = looking from -Z)
f 1 4 3
f 1 3 2
# Front face (normal +Z, CCW from outside = looking from +Z)
f 5 6 7
f 5 7 8
# Left face (normal -X, CCW from outside = looking from -X)
f 1 5 8
f 1 8 4
# Right face (normal +X, CCW from outside = looking from +X)
f 2 3 7
f 2 7 6
# Bottom face (normal -Y, CCW from outside = looking from -Y)
f 1 2 6
f 1 6 5
# Top face (normal +Y, CCW from outside = looking from +Y)
f 4 8 7
f 4 7 3