Skip to content
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

Is there a better way to render an 3D stereoscopic image for VR than create two scenes? #6437

Closed
arturitu opened this issue Apr 21, 2015 · 12 comments

Comments

@arturitu
Copy link
Contributor

I'm reviewing the http://threejs.org/examples/#vr_video and there are two scenes to render a different part of the video corresponding to the left and right eye shot. But I thought if I will need to add some HUD elements, this option would make me hard to include 3D elements over this stereoscopic background.
In this case, the right way would be included in a third scene? or duplicate in both scenes?

What I did (with an image instead a video) is to create 2 meshes (one for each eye) and changed StereoEffect and VREffect to make visible or hide each mesh on every render before "paint" every part of the scene.
Makes sense? or will have a worse performance?

image

Example working > www.unboring.net/lab/image3DPano (Cardboard & Oculus)
Source code > www.unboring.net/lab/image3DPano/image3DPano.zip

@sigmaxipi
Copy link
Contributor

What about adding a "root" Object3D to both scenes and then adding all your common objects to that root? Any eye specific objects can be directly added to the pair of scenes but everything else would be added to the common root.

@mrdoob
Copy link
Owner

mrdoob commented Apr 29, 2015

I think the masking idea in #5562 could solve this. We will then have a single scene with everything and two cameras with different layerMasks. How does this sound?

@arturitu
Copy link
Contributor Author

arturitu commented May 7, 2015

It sounds the best solution but I'll wait for more progress in the implementation of that because I've been trying to understand the #5562 but I do not know if I would be able to help a lot now :(

@ghost
Copy link

ghost commented Dec 17, 2015

I just came accross the same problem, and was about to duplicate each of my meshes. Have you found a better way to solve this problem?

@mrdoob
Copy link
Owner

mrdoob commented Dec 17, 2015

We can now use layers to select if the object should be visible for the left or right eye.

Take a look at the VR video example for reference:
https://github.com/mrdoob/three.js/blob/dev/examples/vr_video.html

@mrdoob mrdoob closed this as completed Dec 17, 2015
@ghost
Copy link

ghost commented Dec 18, 2015

Looks great, but I can't see where you developed the object.layers functions. Is it still work in progress?

@mrdoob
Copy link
Owner

mrdoob commented Dec 18, 2015

Yes, I added it last cycle as THREE.Channels but renamed it to THREE.Layers this cycle.

https://github.com/mrdoob/three.js/blob/dev/src/core/Layers.js

The code is definitely not very easy to understand, but it basically allows us to control what objects a camera is able to see.

@ghost
Copy link

ghost commented Dec 18, 2015

OK thanks, I think I got it working with Channels (for now, will update to Layers with next build). Seems to work fine, thanks for the good job, it'll simplify things!

@curti55
Copy link

curti55 commented Jan 11, 2016

I cant get this to work. With 74dev, the example only shows one half (i think the last added -> right eye)
When i dont add the right mesh, nothing is shown, when bot meshes are added i get the same texture on both eyes. Trying to use THREE.StereoCamera results in "THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera"

And the linked example is dead

@mrdoob
Copy link
Owner

mrdoob commented Jan 11, 2016

@curti55 I reverted the THREE.StereoCamera thing. THREE.PerspectiveCamera works just fine, check the examples.

@curti55
Copy link

curti55 commented Jan 11, 2016

I'm using the webvrmanager to enter vr mode (debug in this case). When i enter VRMode only layer 1 Meshes are displayed. I tried the StereoCamera but as i cant get it to work, i took the perspective cam!

@curti55
Copy link

curti55 commented Feb 1, 2016

ok, i think i found the problem: #7732

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants