New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renderer Plugin to handle stereo rendering and head tracking for VR HMDs... #5015
Conversation
…MDs. It uses the native Firefox API
Looking good! Maybe we can split it to var controls = new THREE.VRControls( camera );
var effect = new THREE.VREffect( renderer );
effect.setFullscreen( true );
effect.render( scene, camera ); |
Hi there. Thanks for the feedback! I have some bandwidth to polish this patch. Do you want to just split it and still offer full functionality through a VRPlugin (or a different abstraction) interface? or Do you mean splitting and let the user manage the details? e.g: keeping the camera in sync with the head rotation I like the former. I like the idea of splitting but it would still be interesting to offer something to encapsulate all the functionality for people that don't want to handle complexity. A college of mine is happy with just exporting collada files from cinema 4D and easily render them without having to worry about any details. |
Yep!
Even if it required 2 classes, it would be easy to write a example that would be ready for your colleague to play with. |
Generally I would actually prefer splitting controls and effect, since I'm much more likely to tweak the former than the later. Diego, some wishlist items from my notes after kicking the tires on this for a bit:
|
@mrdoob I made the requested changes. How does it look now? I want to do one more pass to clean up and add some comments but it would be great to know If you think it's heading in the right direction |
Yeah +1 for splitting the controls and effect. |
+1 for parenting the stereo camera from the mono camera... then things like camera animation will get picked up automatically. |
Another thing to be mindful of is multi-pass rendering. I had to adapt the old Oculus Bridge effect code to handle multiple render passes. Think about it, if not now then for later. |
orientation.w, | ||
orientation.x, | ||
orientation.y, | ||
orientation.z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the rotation reported as [w, x, y, z]? Then it has to get w put back in the right place to build a Quaternion. If this is interfacing with something else, then that something else should have an adapter to put w in the right place in front of it...
+1 @vvuk |
vrState.hmd.rotation[2], | ||
vrState.hmd.rotation[3] | ||
); | ||
camera.setRotationFromQuaternion( quat ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this can be simplified to just this:
camera.quaternion.fromArray( vrState.hmd.rotation );
Then quat
won't be needed.
@mrdoob Thanks! I replaced the way I set the camera orientation |
Sweet! Merged into the |
That's fantastic! What process do you follow to move things from dev to master? |
Chrome build with WebVR support revealed today by @toji with minor changes: mozGetVRDevices unprefixed and returns a promise. |
@dmarcos When you do a PR you need to base checkout the |
.... It uses the native Firefox API
Mr Doob, What do you think?
Online version here:
http://swimminglessonsformodernlife.com/three.js/examples/webgl_plugin_vr.html
The difference boils down to the following lines:
The goal is making it very easy to use.
Links to VR enabled Firefox builds:
http://people.mozilla.com/~vladimir/vr/firefox-33.0a1.en-US.mac.dmg
http://people.mozilla.com/~vladimir/vr/firefox-33.0a1.en-US.win64-x86_64.zip