Skip to content

Commit 49bd769

Browse files
tsemachhclaude
andcommitted
3D room: fix card orientation (backfaces were toward the camera)
rotation.y had an extra 180° so every poster faced outward and the front-side-only material rendered nothing; now lookAt(centre) + DoubleSide. Stars exempted from fog; preserveDrawingBuffer on so the canvas is screenshot-able. Verified by pixel readback (51% lit). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent f856d7a commit 49bd769

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

3d/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h1>ATARI <span>ARCADE</span> · 3D</h1>
5050
var canvas = document.getElementById("gl");
5151
var tip = document.getElementById("tip");
5252
var loading = document.getElementById("loading");
53-
var renderer = new THREE.WebGLRenderer({ canvas: canvas, antialias: true });
53+
var renderer = new THREE.WebGLRenderer({ canvas: canvas, antialias: true, preserveDrawingBuffer: true });
5454
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
5555
var scene = new THREE.Scene();
5656
scene.fog = new THREE.Fog(0x05070c, 14, 30);
@@ -70,7 +70,7 @@ <h1>ATARI <span>ARCADE</span> · 3D</h1>
7070
pos[i * 3 + 2] = r * Math.sin(p) * Math.sin(t);
7171
}
7272
g.setAttribute("position", new THREE.BufferAttribute(pos, 3));
73-
scene.add(new THREE.Points(g, new THREE.PointsMaterial({ color: 0x5cc8ff, size: 0.06, transparent: true, opacity: 0.7 })));
73+
scene.add(new THREE.Points(g, new THREE.PointsMaterial({ color: 0x5cc8ff, size: 0.06, transparent: true, opacity: 0.7, fog: false })));
7474
})();
7575

7676
scene.add(new THREE.AmbientLight(0xffffff, 1.0));
@@ -121,10 +121,10 @@ <h1>ATARI <span>ARCADE</span> · 3D</h1>
121121
var col = i % perRow;
122122
var theta = (col / perRow) * Math.PI * 2 + (row * 0.5 * (Math.PI * 2 / perRow));
123123
var geo = new THREE.PlaneGeometry(CARD_W, CARD_H);
124-
var mat = new THREE.MeshBasicMaterial({ color: 0x0d1117 });
124+
var mat = new THREE.MeshBasicMaterial({ color: 0x0d1117, side: THREE.DoubleSide });
125125
var mesh = new THREE.Mesh(geo, mat);
126126
mesh.position.set(R * Math.sin(theta), rows[row] || 0, -R * Math.cos(theta));
127-
mesh.rotation.y = -theta + Math.PI;
127+
mesh.lookAt(0, mesh.position.y, 0); // face the camera at the centre
128128
mesh.userData = { game: g };
129129
group.add(mesh);
130130
pickables.push(mesh);

0 commit comments

Comments
 (0)