Using three.js in Expo to build native apps

I’ve been working on bridging three.js into Expo, it works really well and it’s a nice alternative to SceneKit.

Essentially it uses React Native with an Expo.GLView then you pass the gl context into a THREE.WebGLRenderer.

Naturally it has a much wider breadth than running three.js in a web view on a device.

The biggest downside right now is that you can’t load files from local paths.
Assets must be referenced statically or from a remote url.

My hack to get around this is to pass in a callback function that sends the file name back, you can then provide the respective asset.

Here are some examples that I ported into this:

Let me know what you think :blue_heart::grin:

1 Like

Not sure I quite understand - is this a way of getting three.js to run as a mobile app?

Yes, sorry I wasn’t more clear. This lets you code to native opengl es!

2 Likes

Is this faster than with WebGL? Have you done any benchmarks?

After talking with EXGL creator Nikhilesh Sigatapu he informed me that things like shaders will run faster, but scenegraph stuff needs some more improvement. I’m working on putting together some tests that demonstrate the differences.