Back to articles
Bridging 8th Wall AR and React Three Fiber: How Pose Data Flows into Three.js

Bridging 8th Wall AR and React Three Fiber: How Pose Data Flows into Three.js

via Dev.to Reactj1ngzoue

What I Built I created a React Three Fiber (R3F) wrapper library for the 8th Wall open-source AR engine, called @j1ngzoue/8thwall-react-three-fiber . It lets you add image-tracking AR to a React app with minimal boilerplate: < EighthwallCanvas xrSrc = "/xr.js" > < EighthwallCamera /> < ImageTracker targetImage = "/targets/marker.json" > < mesh > < boxGeometry /> < meshStandardMaterial color = "hotpink" /> </ mesh > </ ImageTracker > </ EighthwallCanvas > Point your phone camera at the target image, and the 3D object appears anchored to it. Two Canvases, One Screen The trickiest part of the architecture is layering XR8's camera feed with R3F's 3D scene. They run on separate canvases stacked on top of each other: ┌─────────────────────────────┐ │ R3F Canvas (alpha=true) │ ← 3D objects, transparent background ├─────────────────────────────┤ │ XR8 Canvas │ ← camera feed └─────────────────────────────┘ Both canvases are position: absolute and fill the container. R3F renders with alpha: true

Continue reading on Dev.to React

Opens in a new tab

Read Full Article
2 views

Related Articles