How to use Google Cardboard with three.js

webvr
cardboard

#1

Hello,

A way to make https://threejs.org/examples/#webgl_loader_json_claraio compatible with cardboard by Google ?

Thank,


#2

You’re welcome!
Could you provide more information?


#3

Im trying to see my webgl_loader_json_claraio whit my cardboard. I dont know how to make it, im new user of three.js :s

Ex: you can see a 3D model on screnn computer and if you click on cardboard you can see in VR :slight_smile:

Link share code : https://codeshare.io/5z6JMO


#4

Basically you have to integrate StereoEffect and DeviceOrientationControls into your three.js scene.

These official examples might be interesting for you:

https://threejs.org/examples/#webgl_effects_stereo
https://threejs.org/examples/#misc_controls_deviceorientation

BTW: You can find many interesting tutorials and articles if you just google “three.js cardboard” :wink:


#5

The stereo effects works fine but not my controls device …

I replace

controls = new THREE.OrbitControls( camera );
controls.target.set( 2, 1, 0 );
controls.minDistance = 5;
controls.maxDistance = 30;
controls.update();

by

controls = new THREE.DeviceOrientationControls( camera );
controls.update();

and nothing appears

Its possible to make same result https://borismus.github.io/webvr-boilerplate/ ? because
I am not convinced by stereos effect :s


#6

This phrase explains nothing. What do you expect to see?

This example was made with r84 (as it logged in the browser console), so you can press Ctrl+U and have a look at the source code of the page, thus you will know how the things work there.


#7

my 3D model disappears when à replace my controls.

Ok.

Thx


#8

Replacing of controls can lead to different position/rotation of the camera. So maybe your camera just doesn’t look at the object or its position coincides with the position of the object (it means the camera is inside of the object).


#9

When i use OrbitControls i can see my 3D model (with a lot warning on my console - texture, resize jpg …) and with DeviceOrientationControls my warnings disappears my scene is here but not my model.

when i use my phone for 360° nothing appear.

Thx for your awnser :slight_smile: