와이어프레임

Wireframe

면을 채우지 않고 폴리곤의 모서리 선만 그려서 메시의 구조를 드러내는 렌더링 방식.

다른 이름: THREE.WireframeGeometryEdgesGeometrymaterial.wireframe
···
js
import * as THREE from 'three';
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
document.body.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x0b0b14);
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 0.8, 6);
const geo = new THREE.TorusKnotGeometry(1.15, 0.38, 140, 16);
const fill = new THREE.Mesh(geo, new THREE.MeshBasicMaterial({ color: 0x2a2a52, transparent: true, opacity: 0.35 }));
scene.add(fill);
const wire = new THREE.LineSegments(new THREE.WireframeGeometry(geo), new THREE.LineBasicMaterial({ color: 0x8ecbff, transparent: true, opacity: 0.85 }));
scene.add(wire);
function resize() { renderer.setSize(innerWidth, innerHeight); camera.aspect = innerWidth / innerHeight; camera.updateProjectionMatrix(); }
addEventListener('resize', resize); resize();
renderer.setAnimationLoop((t) => {
  const r = t * 0.00022;
  fill.rotation.set(r * 0.6, r, r * 0.15);
  wire.rotation.copy(fill.rotation);
  renderer.render(scene, camera);
});

가장 쉬운 방법은 material.wireframe = true지만, 이건 삼각형을 이루는 대각선까지 전부 그려서 지저분합니다. THREE.WireframeGeometry(geometry)는 같은 방식으로 모든 삼각형 변을 LineSegments로 뽑아내고, THREE.EdgesGeometry(geometry, thresholdAngle)는 인접한 면 사이 각도가 임계값보다 클 때만(즉 "눈에 보이는 모서리"만) 선을 남깁니다.

데모는 형태를 채운 반투명 면 위에 WireframeGeometry 선을 겹쳐서, 선이 표면의 삼각분할(트라이앵글레이션) 자체를 어떻게 드러내는지 보여줍니다.

실무에서는 로딩 placeholder, 3D 편집기의 편집 모드, 저해상도 프리뷰, 블루프린트/설계도 느낌의 스타일링에 씁니다. 폴리곤이 아주 많은 메시에서는 선이 너무 촘촘해져 오히려 안 보이니 주의하세요.

언제 쓰나

구조 진단, 로딩 상태, 편집 모드 표시에. 고밀도 메시에는 EdgesGeometry로 임계각을 조절하세요.