Three.js WebGPU Renderer Now Works in Mystral Native

Three.js WebGPU renderer now runs natively in Mystral Native.js. In the previous blog post, I mentioned how Mystral Native.js is a native WebGPU runtime that can run on any platform that supports WebGPU. Now, we can run Three.js WebGPU code inside of Mystral Native.js!
How it works
1. Write your Three.js code using `three/webgpu`
2. Bundle with esbuild (Three.js uses ES modules)
3. Run with `mystral run your-bundle.js`
That's it. The same Three.js code that runs in Chrome now runs natively on Mac, Windows, and Linux without a browser or Electron.
Quick example
import * as THREE from 'three/webgpu';
const renderer = new THREE.WebGPURenderer({ canvas });
await renderer.init();
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
const cube = new THREE.Mesh(
new THREE.BoxGeometry(1, 1, 1),
new THREE.MeshStandardMaterial({ color: 0x00ff88 })
);
scene.add(cube);
function animate() {
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
We've added a full Three.js guide to the docs with setup instructions, bundling commands, and troubleshooting tips.
Note that this is still a work in progress. The basic functionality works, but Mystral Native is still in alpha release 0.1.0 & we are working on filling in the gaps to make more three.js examples work properly. If you find issues, please report them on the github issues page at https://github.com/mystralengine/mystralnative/issues.
Links:
- Three.js Guide: https://mystralengine.github.io/mystralnative/docs/guides/threejs
- Mystral Native.js github page: https://github.com/mystralengine/mystralnative
- Discord: https://discord.gg/jUYC9dMbu5
Tested with Three.js v0.182.0. The V8 + Dawn build configuration gives the best Three.js compatibility.
Get Sponza in WebGPU
Sponza in WebGPU
Sponza WebGPU Demo in Mystral Engine
| Status | Released |
| Category | Other |
| Author | mystraldev |
| Tags | 3D, demo, html5, PBR (Physically Based Rendering), webgpu |
Leave a comment
Log in with itch.io to leave a comment.