← ClaudeAtlas

threejs-lightinglisted

Light types and physical units, shadow maps, HDR environment lighting, light probes, and lighting performance, on WebGL or with WebGPU and TSL. Use when adding or tuning lights, fixing shadow acne, setting up image-based lighting, or dimming an environment map.
ahmedamin20/hmcv-ui-studio-public · ★ 0 · Web & Frontend · score 62
Install: claude install-skill ahmedamin20/hmcv-ui-studio-public
# Three.js Lighting Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer. ## Quick Start ```javascript import * as THREE from "three"; const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); camera.position.set(4, 3, 8); // A single directional light: intensity is a plain multiplier, no distance falloff const dirLight = new THREE.DirectionalLight(0xffffff, 3); dirLight.position.set(5, 10, 5); scene.add(dirLight); const floor = new THREE.Mesh( new THREE.PlaneGeometry(20, 20), new THREE.MeshStandardMaterial({ color: 0x808080 }) ); floor.rotation.x = -Math.PI / 2; scene.add(floor); const mesh = new THREE.Mesh( new THREE.BoxGeometry(1, 1, 1), new THREE.MeshStandardMaterial({ color: 0x3a76c4 }) ); scene.add(mesh); // Shadows need three switches: renderer, light, and the meshes that cast and receive renderer.shadowMap.enabled = true; dirLight.castShadow = true; mesh.castShadow = true; floor.receiveShadow = true; function animate() { renderer.render(scene, camera); } renderer.setAnimationLoop(animate); ``` ## Light Types and Units | Light | Shadows | Intensity | Notes | |---|---|---|---| | AmbientLight | no | multiplier | Flat f