From 92710b3fc2db9b16e27e3f8911642044fbc39e8a Mon Sep 17 00:00:00 2001 From: Azeem Fidahusein Date: Mon, 28 Jul 2025 23:14:29 +0100 Subject: [PATCH] updated material + lighting --- app/src/lighting.ts | 7 +++++++ app/src/model-loader.ts | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/app/src/lighting.ts b/app/src/lighting.ts index f12cca2..bf7c566 100644 --- a/app/src/lighting.ts +++ b/app/src/lighting.ts @@ -38,5 +38,12 @@ export class LightingManager { const pointLight2 = new THREE.PointLight(0xff4444, 0.3, 25) pointLight2.position.set(5, -5, -8) scene.add(pointLight2) + + // Purple backlight for atmospheric effect + const purpleBacklight = new THREE.DirectionalLight(0x8844ff, 0.8) + purpleBacklight.position.set(0, 0, -15) + purpleBacklight.target.position.set(0, 0, 0) + scene.add(purpleBacklight) + scene.add(purpleBacklight.target) } } diff --git a/app/src/model-loader.ts b/app/src/model-loader.ts index 18100ef..fc7b2dd 100644 --- a/app/src/model-loader.ts +++ b/app/src/model-loader.ts @@ -254,10 +254,20 @@ export class ModelLoader { // Create multiple instances of the loaded model const numInstances = 20 + // Create polished gun metal material + const gunMetalMaterial = new THREE.MeshStandardMaterial({ + color: 0x2C3E50, + metalness: 0.9, + roughness: 0.3, + envMapIntensity: 1.5 + }) + gltf.scene.traverse((child) => { if (child instanceof THREE.Mesh) { child.castShadow = true child.receiveShadow = true + // Apply the gun metal material to all meshes + child.material = gunMetalMaterial } }) @@ -265,6 +275,15 @@ export class ModelLoader { // Clone the model const modelClone = gltf.scene.clone() + // Apply gun metal material to cloned meshes + modelClone.traverse((child) => { + if (child instanceof THREE.Mesh) { + child.material = gunMetalMaterial.clone() + child.castShadow = true + child.receiveShadow = true + } + }) + // Start objects close to the attraction point for immediate clustering const x = (Math.random() - 0.5) * 6 // Reduced from 25 to 6 const y = (Math.random() - 0.5) * 6 // Reduced from 25 to 6