Prompt specification
Build or customize the Three.js 3D scene "Horizon ring and one reference star" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Horizon ring and one reference star
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/horizon-ring-and-one-reference-star-x2245
Scene Description Prompt:
I'd like to see this as a voxel Three.js scene: Horizon ring and one reference star. Build a small horizon ring around a boat silhouette with a marked reference star. Specify the assumed latitude and avoid presenting one sky marker as universal. Use cdnjs and return one self-contained HTML file.
Working Three.js Starter (horizon-ring-and-one-reference-star-x2245):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Voxel Horizon — Local Reference Star</title>
<style>
:root {
color-scheme: dark;
--ink: #eaf8ff;
--muted: #91aabd;
--cyan: #73dff2;
--gold: #ffc45d;
--panel: rgba(7, 19, 30, 0.78);
--border: rgba(115, 223, 242, 0.22);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background:
radial-gradient(circle at 50% 40%, #14334a 0%, #081522 46%, #03080e 100%);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#app, #labels {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active { cursor: grabbing; }
#labels {
z-index: 2;
pointer-events: none;
overflow: hidden;
}
.panel {
position: fixed;
z-index: 3;
border: 1px solid var(--border);
background: var(--panel);
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
backdrop-filter: blur(12px);
}
#intro {
top: 22px;
left: 22px;
width: min(370px, calc(100vw - 44px));
padding: 18px 19px 17px;
border-radius: 14px;
pointer-events: none;
}
.eyebrow {
margin: 0 0 7px;
color: var(--cyan);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(22px, 3vw, 32px);
line-height: 1.05;
letter-spacing: -0.035em;
}
#intro .summary {
margin: 9px 0 14px;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.data-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.datum {
min-height: 63px;
padding: 10px 11px;
border: 1px solid rgba(145, 170, 189, 0.15);
border-radius: 9px;
background: rgba(255, 255, 255, 0.025);
}
.datum span {
display: block;
margin-bottom: 5px;
color: var(--muted);
font-size: 9px;
font-weight: 750;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.datum strong {
display: block;
font-size: 15px;
letter-spacing: 0.01em;
}
#latitude-control {
margin-top: 13px;
padding-top: 13px;
border-top: 1px solid rgba(145, 170, 189, 0.14);
pointer-events: auto;
}
.range-label {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 9px;
font-size: 11px;
}
.range-label span {
color: var(--muted);
letter-spacing: 0.09em;
text-transform: uppercase;
}
#latitude-value {
color: var(--cyan);
font-size: 15px;
font-weight: 800;
font-variant-numeric: tabular-nums;
}
input[type="range"] {
width: 100%;
height: 4px;
margin: 0;
accent-color: var(--cyan);
cursor: ew-resize;
}
.caution {
margin: 12px 0 0;
color: #b8c8d3;
font-size: 11px;
line-height: 1.48;
}
.caution strong { color: #f1d6a0; }
#legend {
left: 22px;
bottom: 22px;
padding: 11px 13px;
border-radius: 10px;
color: var(--muted);
font-size: 10px;
line-height: 1.7;
pointer-events: none;
}
.legend-row {
display: flex;
align-items: center;
gap: 8px;
}
.swatch {
width: 9px;
height: 9px;
border-radius: 2px;
box-shadow: 0 0 10px currentColor;
}
.swatch.horizon { color: var(--cyan); background: var(--cyan); }
.swatch.star { color: var(--gold); background: var(--gold); }
.swatch.boat { color: #253b49; background: #253b49; }
#controls {
right: 22px;
bottom: 22px;
display: flex;
align-items: center;
gap: 12px;
padding: 9px 10px 9px 13px;
border-radius: 10px;
color: var(--muted);
font-size: 11px;
}
button {
border: 1px solid rgba(115, 223, 242, 0.3);
border-radius: 7px;
padding: 7px 10px;
background: rgba(115, 223, 242, 0.08);
color: var(--ink);
font: inherit;
font-size: 11px;
cursor: pointer;
}
button:hover {
background: rgba(115, 223, 242, 0.16);
border-color: rgba(115, 223, 242, 0.5);
}
.marker {
position: absolute;
left: 0;
top: 0;
transform: translate(-50%, -50%);
white-space: nowrap;
transition: opacity 120ms linear;
will-change: left, top, transform;
}
.marker.cardinal {
display: grid;
place-items: center;
width: 26px;
height: 26px;
border: 1px solid rgba(115, 223, 242, 0.42);
border-radius: 50%;
background: rgba(4, 15, 24, 0.82);
color: var(--muted);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.08em;
}
.marker.cardinal.north {
width: 31px;
height: 31px;
border-color: var(--cyan);
color: var(--cyan);
box-shadow: 0 0 18px rgba(115, 223, 242, 0.25);
}
.marker.star {
min-width: 178px;
padding: 10px 12px;
border: 1px solid rgba(255, 196, 93, 0.48);
border-left: 3px solid var(--gold);
border-radius: 8px;
background: rgba(20, 14, 7, 0.9);
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}
.marker.star .tag {
display: block;
margin-bottom: 3px;
color: var(--gold);
font-size: 8px;
font-weight: 850;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.marker.star strong {
display: block;
font-size: 14px;
}
.marker.star small {
display: block;
margin-top: 4px;
color: #c8b898;
font-size: 9px;
letter-spacing: 0.05em;
}
#loading {
position: fixed;
inset: 0;
z-index: 10;
display: grid;
place-items: center;
background: #06111d;
color: var(--cyan);
font-size: 11px;
letter-spacing: 0.16em;
text-transform: uppercase;
transition: opacity 350ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 720px) {
#intro {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 14px;
}
#intro .summary,
.caution,
#legend {
display: none;
}
.data-grid {
grid-template-columns: 1fr 1fr;
}
#controls {
right: 12px;
bottom: 12px;
}
.control-copy { display: none; }
.marker.star {
min-width: 150px;
transform: translate(-12%, -115%);
}
}
</style>
</head>
<body>
<div id="app"></div>
<div id="labels" aria-hidden="true">
<div class="marker cardinal north" id="label-n">N</div>
<div class="marker cardinal" id="label-e">E</div>
<div class="marker cardinal" id="label-s">S</div>
<div class="marker cardinal" id="label-w">W</div>
<div class="marker star" id="label-star">
<span class="tag">Reference star · local model</span>
<strong>Polaris</strong>
<small>AZ 000° · ALT <span id="star-alt">45.0°</span></small>
</div>
</div>
<section id="intro" class="panel" aria-label="Scene assumptions">
<p class="eyebrow">Voxel celestial study</p>
<h1>Horizon ring<br>& one local star</h1>
<p class="summary">
A schematic observer-and-boat view with one marked reference star.
The ring is the local horizon; north is highlighted.
</p>
<div class="data-grid">
<div class="datum">
<span>Assumed latitude</span>
<strong id="latitude-readout">45.0° N</strong>
</div>
<div class="datum">
<span>Reference marker</span>
<strong>Polaris</strong>
</div>
</div>
<div id="latitude-control">
<label class="range-label" for="latitude">
<span>Change assumed latitude</span>
<output id="latitude-value">45.0° N</output>
</label>
<input
id="latitude"
type="range"
min="0"
max="70"
step="0.5"
value="45"
aria-label="Assumed northern latitude"
>
</div>
<p class="caution">
<strong>Not a universal sky marker.</strong>
Polaris is used only for this local north-latitude example.
Its ideal altitude is approximately the observer’s latitude;
exact position also depends on date, time, refraction, and observing site.
Southern observers may not see it above the horizon.
</p>
</section>
<aside id="legend" class="panel" aria-hidden="true">
<div class="legend-row">
<span class="swatch horizon"></span><span>360° local horizon ring</span>
</div>
<div class="legend-row">
<span class="swatch star"></span><span>the one marked reference star</span>
</div>
<div class="legend-row">
<span class="swatch boat"></span><span>central boat silhouette</span>
</div>
</aside>
<div id="controls" class="panel">
<span class="control-copy">Drag to orbit · wheel to zoom</span>
<button id="reset" type="button">Reset view</button>
</div>
<div id="loading">Building voxel scene…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const app = document.querySelector("#app");
const loading = document.querySelector("#loading");
const SCENE = {
radius: 7,
horizonY: 0.36,
initialLatitude: 45,
initialYaw: 0.72,
initialPitch: 0.46,
initialDistance: 16.5,
target: new THREE.Vector3(0, 1.35, -0.55)
};
let assumedLatitude = SCENE.initialLatitude;
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor(0x000000, 0);
renderer.domElement.setAttribute(
"aria-label",
"Interactive voxel scene of a boat, a circular horizon, and one marked local reference star"
);
app.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
100
);
const hemisphere = new THREE.HemisphereLight(0x8dc9e8, 0x06111c, 1.45);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xd7efff, 2.5);
keyLight.position.set(7, 12, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -13;
keyLight.shadow.camera.right = 13;
keyLight.shadow.camera.top = 13;
keyLight.shadow.camera.bottom = -13;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 35;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x3a99c7, 1.25);
rimLight.position.set(-8, 5, -9);
scene.add(rimLight);
const cubeGeometry = new THREE.BoxGeometry(1, 1, 1);
const voxelBuckets = new Map();
function addVoxel({
x, y, z,
sx = 1, sy = 1, sz = 1,
color,
emissive = 0,
opacity = 1,
rotationY = 0
}) {
const key = `${color}|${emissive}|${opacity}`;
if (!voxelBuckets.has(key)) {
voxelBuckets.set(key, {
color,
emissive,
opacity,
entries: []
});
}
voxelBuckets.get(key).entries.push({
x, y, z, sx, sy, sz, rotationY
});
}
function makeInstancedMesh(entries, material) {
const mesh = new THREE.InstancedMesh(cubeGeometry, material, entries.length);
const matrix = new THREE.Matrix4();
const quaternion = new THREE.Quaternion();
const position = new THREE.Vector3();
const scale = new THREE.Vector3();
const euler = new THREE.Euler();
entries.forEach((entry, index) => {
position.set(entry.x, entry.y, entry.z);
scale.set(entry.sx, entry.sy, entry.sz);
euler.set(0, entry.rotationY || 0, 0);
quaternion.setFromEuler(euler);
matrix.compose(position, quaternion, scale);
mesh.setMatrixAt(index, matrix);
});
mesh.instanceMatrix.needsUpdate = true;
return mesh;
}
function buildBucket(bucket) {
const material = new THREE.MeshStandardMaterial({
color: bucket.color,
emissive: bucket.emissive,
emissiveIntensity: bucket.emissive ? 1.25 : 0,
roughness: 0.7,
metalness: 0.08,
transparent: bucket.opacity < 1,
opacity: bucket.opacity,
depthWrite: bucket.opacity >= 0.99
});
const mesh = makeInstancedMesh(bucket.entries, material);
mesh.castShadow = bucket.opacity >= 0.99;
mesh.receiveShadow = true;
scene.add(mesh);
}
// A broad, low cube acts as the dark water base.
addVoxel({
x: 0, y: -0.12, z: 0,
sx: 38, sy: 0.18, sz: 38,
color: 0x041018
});
// Quiet voxel water tiles keep the scene visibly block-built.
for (let gx = -12; gx <= 12; gx++) {
for (let gz = -12; gz <= 12; gz++) {
const x = gx * 1.08;
const z = gz * 1.08;
if (Math.hypot(x, z) > 13.4) continue;
addVoxel({
x,
y: 0.005 + ((gx + gz) & 1) * 0.008,
z,
sx: 1.02,
sy: 0.055,
sz: 1.02,
color: (gx + gz) & 1 ? 0x071a27 : 0x0a2030
});
}
}
// Circular horizon made from small tangential blocks.
const ringSegments = 72;
const segmentAngle = (Math.PI * 2) / ringSegments;
const segmentLength = (Math.PI * 2 * SCENE.radius) / ringSegments;
function angularDistance(a, b) {
return Math.abs(((a - b + Math.PI * 3) % (Math.PI * 2)) - Math.PI);
}
for (let i = 0; i < ringSegments; i++) {
const theta = i * segmentAngle;
const x = Math.sin(theta) * SCENE.radius;
const z = -Math.cos(theta) * SCENE.radius;
const isNorth = angularDistance(theta, 0) < segmentAngle * 0.65;
const isEast = angularDistance(theta, Math.PI / 2) < segmentAngle * 0.55;
const isSouth = angularDistance(theta, Math.PI) < segmentAngle * 0.55;
const isWest = angularDistance(theta, Math.PI * 1.5) < segmentAngle * 0.55;
const color = isNorth
? 0x73dff2
: isEast || isSouth || isWest
? 0x4c9daf
: 0x397c8d;
const emissive = isNorth ? 0x1d7183 : 0x092b35;
addVoxel({
x,
y: SCENE.horizonY,
z,
sx: segmentLength * 0.61,
sy: 0.13,
sz: 0.19,
color,
emissive,
opacity: isNorth ? 1 : 0.88,
rotationY: -theta
});
}
// Larger cardinal ticks.
[
{ a: 0, color: 0x9af1ff, emissive: 0x21829a },
{ a: Math.PI / 2, color: 0x5caec0, emissive: 0x0b3542 },
{ a: Math.PI, color: 0x5caec0, emissive: 0x0b3542 },
{ a: Math.PI * 1.5, color: 0x5caec0, emissive: 0x0b3542 }
].forEach(({ a, color, emissive }) => {
addVoxel({
x: Math.sin(a) * SCENE.radius,
y: SCENE.horizonY,
z: -Math.cos(a) * SCENE.radius,
sx: 0.23,
sy: 0.19,
sz: 0.54,
color,
emissive,
rotationY: -a
});
});
// Dotted north-to-zenith altitude meridian. The star moves on this arc.
for (let altitude = 6; altitude <= 84; altitude += 6) {
if (Math.abs(altitude - 45) < 3) continue;
const radians = THREE.MathUtils.degToRad(altitude);
addVoxel({
x: 0,
y: SCENE.horizonY + Math.sin(radians) * SCENE.radius,
z: -Math.cos(radians) * SCENE.radius,
sx: 0.095,
sy: 0.095,
sz: 0.095,
color: 0x66bdcf,
emissive: 0x123e49,
opacity: 0.58
});
}
// Boat silhouette: a stepped voxel hull, deck, cabin, and short mast.
const hullRows = [
{ y: 0.40, from: -4, to: 2 },
{ y: 0.80, from: -4, to: 4 },
{ y: 1.20, from: -3, to: 3 }
];
for (const row of hullRows) {
for (let ix = row.from; ix <= row.to; ix++) {
for (const z of [-0.40, 0, 0.40]) {
addVoxel({
x: ix * 0.40,
y: row.y,
z,
sx: 0.395,
sy: 0.395,
sz: 0.395,
color: 0x071018
});
}
}
}
for (let ix = -3; ix <= 3; ix++) {
addVoxel({
x: ix * 0.40,
y: 1.43,
z: 0,
sx: 0.395,
sy: 0.11,
sz: 1.18,
color: 0x1a2d39
});
}
for (const x of [-1.2, -0.8, -0.4, 0]) {
for (const y of [1.68, 2.05]) {
addVoxel({
x,
y,
z: 0,
sx: 0.39,
sy: 0.36,
sz: 0.82,
color: 0x0c1822
});
}
}
addVoxel({
x: -0.8,
y: 2.72,
z: 0,
sx: 0.11,
sy: 1.02,
sz: 0.11,
color: 0x050b11
});
// The only celestial marker is this single local reference star.
const starGroup = new THREE.Group();
scene.add(starGroup);
const rayEntries = [];
const coreEntries = [];
for (const axis of ["x", "y", "z"]) {
for (const direction of [-1, 1]) {
rayEntries.push({
x: axis === "x" ? direction * 0.19 : 0,
y: axis === "y" ? direction * 0.19 : 0,
z: axis === "z" ? direction * 0.19 : 0,
sx: axis === "x" ? 0.17 : 0.12,
sy: axis === "y" ? 0.17 : 0.12,
sz: axis === "z" ? 0.17 : 0.12
});
}
}
for (const dx of [-1, 1]) {
for (const dy of [-1, 1]) {
rayEntries.push({
x: dx * 0.145,
y: dy * 0.145,
z: 0,
sx: 0.10,
sy: 0.10,
sz: 0.10
});
}
}
coreEntries.push({
x: 0, y: 0, z: 0,
sx: 0.30, sy: 0.30, sz: 0.30
});
const starRayMaterial = new THREE.MeshStandardMaterial({
color: 0xffb33d,
emissive: 0xff8c18,
emissiveIntensity: 1.7,
roughness: 0.48,
metalness: 0.05
});
const starCoreMaterial = new THREE.MeshStandardMaterial({
color: 0xffefb1,
emissive: 0xffb83d,
emissiveIntensity: 2.2,
roughness: 0.35,
metalness: 0
});
starGroup.add(makeInstancedMesh(rayEntries, starRayMaterial));
starGroup.add(makeInstancedMesh(coreEntries, starCoreMaterial));
function updateStarPosition() {
const altitude = THREE.MathUtils.degToRad(assumedLatitude);
starGroup.position.set(
0,
SCENE.horizonY + Math.sin(altitude) * SCENE.radius,
-Math.cos(altitude) * SCENE.radius
);
const latitudeText = `${assumedLatitude.toFixed(1)}° N`;
document.querySelector("#latitude-readout").textContent = latitudeText;
document.querySelector("#latitude-value").textContent = latitudeText;
document.querySelector("#star-alt").textContent = `${assumedLatitude.toFixed(1)}°`;
}
updateStarPosition();
// Build all remaining voxel batches.
voxelBuckets.forEach(buildBucket);
// Camera controls implemented directly, without addons.
let yaw = SCENE.initialYaw;
let pitch = SCENE.initialPitch;
let distance = SCENE.initialDistance;
let dragging = false;
let pointerX = 0;
let pointerY = 0;
function updateCamera() {
const horizontal = Math.cos(pitch) * distance;
camera.position.set(
SCENE.target.x + Math.sin(yaw) * horizontal,
SCENE.target.y + Math.sin(pitch) * distance,
SCENE.target.z + Math.cos(yaw) * horizontal
);
camera.lookAt(SCENE.target);
}
function resetView() {
yaw = SCENE.initialYaw;
pitch = SCENE.initialPitch;
distance = SCENE.initialDistance;
}
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
yaw -= dx * 0.006;
pitch = THREE.MathUtils.clamp(pitch + dy * 0.005, 0.16, 1.24);
});
function stopDragging(event) {
dragging = false;
if (event?.pointerId !== undefined &&
renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
distance = THREE.MathUtils.clamp(
distance * Math.exp(event.deltaY * 0.001),
9.5,
25
);
}, { passive: false });
document.querySelector("#reset").addEventListener("click", resetView);
document.querySelector("#latitude").addEventListener("input", (event) => {
assumedLatitude = Number(event.target.value);
updateStarPosition();
});
window.addEventListener("keydown", (event) => {
if (event.target instanceof HTMLInputElement) return;
if (event.key === "ArrowLeft") yaw -= 0.08;
if (event.key === "ArrowRight") yaw += 0.08;
if (event.key === "ArrowUp") pitch = Math.min(1.24, pitch + 0.06);
if (event.key === "ArrowDown") pitch = Math.max(0.16, pitch - 0.06);
if (event.key === "+" || event.key === "=") distance = Math.max(9.5, distance - 1);
if (event.key === "-" || event.key === "_") distance = Math.min(25, distance + 1);
if (event.key.toLowerCase() === "r") resetView();
});
const labels = {
n: document.querySelector("#label-n"),
e: document.querySelector("#label-e"),
s: document.querySelector("#label-s"),
w: document.querySelector("#label-w"),
star: document.querySelector("#label-star")
};
const labelPoints = {
n: new THREE.Vector3(0, SCENE.horizonY, -SCENE.radius - 0.63),
e: new THREE.Vector3(SCENE.radius + 0.63, SCENE.horizonY, 0),
s: new THREE.Vector3(0, SCENE.horizonY, SCENE.radius + 0.63),
w: new THREE.Vector3(-SCENE.radius - 0.63, SCENE.horizonY, 0)
};
const projected = new THREE.Vector3();
function placeLabel(element, worldPoint, offsetX = 0, offsetY = 0) {
projected.copy(worldPoint).project(camera);
const visible = projected.z > -1 && projected.z < 1;
element.style.opacity = visible ? "1" : "0";
const x = (projected.x * 0.5 + 0.5) * window.innerWidth + offsetX;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight + offsetY;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
}
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
updateCamera();
const clock = new THREE.Clock();
renderer.setAnimationLoop(() => {
const elapsed = clock.getElapsedTime();
updateCamera();
// A restrained breathing pulse keeps the marker findable.
const pulse = 1 + Math.sin(elapsed * 2.2) * 0.035;
starGroup.scale.setScalar(pulse);
starCoreMaterial.emissiveIntensity = 2.05 + Math.sin(elapsed * 2.2) * 0.35;
placeLabel(labels.n, labelPoints.n);
placeLabel(labels.e, labelPoints.e);
placeLabel(labels.s, labelPoints.s);
placeLabel(labels.w, labelPoints.w);
placeLabel(labels.star, starGroup.position, 66, -42);
renderer.render(scene, camera);
loading.classList.add("hidden");
});
</script>
</body>
</html>
```