"매 ray 와 매 geometry 의 intersection test". 매 1968 Arthur Appel 의 매 first hidden surface paper 매 origin, 매 1992 Wolfenstein 3D 의 매 game engine signature. 매 2026 의 매 universal primitive: mouse picking, hit-test, AR placement, lighting, AI vision-cone, BIM section. 매 Raycasting ≠ Ray Tracing — 매 single ray (no recursion) vs 매 recursive light path.
매 핵심
매 raycasting vs raytracing
Raycasting
Ray Tracing
Recursion
매 single hit
매 reflection / refraction recursive
Cost
매 O(log N) per ray (BVH)
매 50-1000x heavier
Use
Picking, collision
Photorealistic render
매 Ray = origin + t·direction
t > 0: 매 forward.
nearest hit: 매 minimum t > 0.
ray vs primitive: 매 sphere / plane / triangle / AABB / OBB.
매 acceleration structure
BVH (Bounding Volume Hierarchy): 매 dominant 매 2026.
import{computeBoundsTree,acceleratedRaycast}from'three-mesh-bvh';THREE.BufferGeometry.prototype.computeBoundsTree=computeBoundsTree;THREE.Mesh.prototype.raycast=acceleratedRaycast;mesh.geometry.computeBoundsTree();// 매 once
// 매 매 raycast 100x+ faster
언제: 매 3D scene 매 user input mapping (click/touch/AR). 매 line-of-sight / occlusion query. 매 sweep collision 1-shot.
언제 X: 매 2D UI hit-test (DOM event 매 충분). 매 dense per-pixel intersection — 매 GPU rasterization 매 더 fast.
❌ 안티패턴
매 frame 의 brute-force intersect 모든 triangle: 매 100k tri scene 매 60fps 의 X — 매 BVH 필수.
BVH refit 의 X 매 dynamic mesh: 매 stale tree → 매 missed hits.
Far plane 무시: 매 무한 ray 매 매 distant unimportant geom hit.
Ray direction 매 unnormalized: 매 t value 매 distance 의 X — 매 모든 distance compare 매 broken.
Single-precision float 의 self-intersection: 매 origin offset (+ 0.001 * normal) 매 epsilon 처리.