From 27669fc88446e75a1f11969ba251d94ef71cd6e0 Mon Sep 17 00:00:00 2001 From: adrien Date: Sat, 24 Jan 2026 01:45:26 +0100 Subject: [PATCH] materials --- jsm/Tetrominoes.js | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/jsm/Tetrominoes.js b/jsm/Tetrominoes.js index 06c33b2..c81854b 100644 --- a/jsm/Tetrominoes.js +++ b/jsm/Tetrominoes.js @@ -180,8 +180,8 @@ InstancedMino.prototype.materials = { side: THREE.DoubleSide, transparent: true, opacity: 0.6, - roughness: 0.3, - metalness: 1, + roughness: 0.25, + metalness: 0.8, }), Espace: new THREE.MeshStandardMaterial({ envMap: environment, @@ -192,6 +192,23 @@ InstancedMino.prototype.materials = { metalness: 0.99, }) } +InstancedMino.prototype.materials['Plasma'].onBeforeCompile = +InstancedMino.prototype.materials['Espace'].onBeforeCompile = shader => { + shader.vertexShader = ` + varying vec3 vPos; + ${shader.vertexShader} + `.replace( + '#include ', + ` + #include + vPos = position; + + // Bruit basé sur la position du sommet pour irrégularité + float n = sin(position.x*3.1 + position.y*5.2 + position.z*7.3) * 0.03; + transformed += normal * n; + ` + ); +}; class Mino extends THREE.Object3D { @@ -452,9 +469,9 @@ class Playfield extends THREE.Group { color: COLORS.EDGE, envMap: environment, transparent: true, - opacity: 0.3, - roughness: 0.1, - metalness: 0.67, + opacity: 0.2, + roughness: 0.5, + metalness: 0.9, }) const edgeShape = new THREE.Shape() .moveTo(-.3, SKYLINE) @@ -495,7 +512,7 @@ class Playfield extends THREE.Group { bumpMap: retroEdgeTexture, bumpScale: 1.5, roughness: 0.25, - metalness: 0.9, + metalness: 0.8, }) this.retroEdge = new THREE.Mesh( new THREE.ExtrudeGeometry(retroEdgeShape, {