How to use Neural4D models in WebAR?
Step 1: Export and Optimize GLB for Web Performance
WebAR experiences require high visual fidelity combined with aggressive optimization to ensure fast loading times over mobile networks. The .glb (binary GLTF) format is the industry standard for WebAR.
When exporting from Neural4D Studio, our system automatically implements the following production-ready standards:
| Standard | Benefit |
|---|---|
| Draco Compression | Reduces geometry data size by up to 90% without losing detail. |
| KTX2 Texture Encoding | Optimizes textures for GPU memory, preventing browser crashes on low-end devices. |
Step 2: Implementing the Cross-Platform WebAR Viewer
To provide a consistent experience across Android (Scene Viewer) and iOS (AR Quick Look), we recommend using Google's <model-viewer> library.
First, include the library in your HTML header:
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"></script>
Then, embed the Neural4D model using the following responsive configuration:
<model-viewer
src="path/to/neural4d_model.glb"
ios-src="path/to/neural4d_model.usdz"
ar ar-modes="webxr scene-viewer quick-look"
camera-controls
poster="poster.webp"
shadow-intensity="1"
auto-rotate>
<button slot="ar-button" class="ar-button">View in your space</button>
</model-viewer>Step 3: Ensuring High-Tension Visual Quality
WebAR lighting can often feel flat. To maintain the "High-Tension" aesthetic of Neural4D models, always use an HDR environment map. This ensures that the metallic and glass surfaces of your model reflect the real-world surroundings accurately.
Neural4D models are baked with physically accurate PBR (Physically Based Rendering) materials that are fully compatible with model-viewer's lighting engine.
Try Neural4D for FreeHave a question or ran into an issue not covered here? Visit our Feedback page and let us know – we read every message.