aframe-stereo-component
aframe-stereo-component copied to clipboard
Changes to allow stereo images
This is a non compatible change, so probably will never be merged in this state, but for those wanting to use a stereo image the same as a stereo video, here are the changes needed. This fixes #27
#26 proposed the same feature, changing the default split value to empty string. If we want to keep backward compatibility, we could switch to the original geometry (see #43) if split value is empty meaning it's a mono image.
Also the changes break the boxes example, transforming the box to a sphere because a box is a valid BufferGeometry. I'm not sure how we can keep backward compatibility for this case. In the case of the boxes example, the stereo component is just used to set the layer. For this use case, we also have the more generic layers component supporting any layer value, not just 1 (eye:left) and 2 (eye:right).
I actually replaced https://github.com/oscarmarinmiro/aframe-stereo-component/blob/cb94d3a082e65f5d13c05f52a55a0578ae47f459/index.js#L44-L47 by just
const isValidGeometry = object3D.geometry instanceof THREE.SphereGeometry;
in my fork, only handling sphere geometry, and using the layers component combined with the mirror component for example where you can specify the layers you want to render in the mirror.
In #26 the condition if (isValidGeometry && (material_is_a_video || material_is_a_image && !!data.split))
(here) make the boxes example still work I guess, but if you use a texture on the boxes, you will have the same issue of boxes transforming to spheres :)
In this project the aframe-stereo-component was used as basis to show stereo images in JPS format. He did it on top of it instead of doing breaking changes, so it could be of your interest: https://github.com/dpa99c/stereoscopic-slideshow
Thanks @nuess0r you can indeed have two images, one for left and one for right and just use stereo="eye:left
on one, and stereo="eye:right
in the other, that's what your linked example is doing.
I'm using my own changes of stereo component for years now with top/bottom images. A few years back I had top/bottom 360 videos and extracted a single frame from it, so I had a single file and I just did this change to make it work with stereo="eye:left;split:vertical
and stereo="eye:right;split:vertical
.
Here in the different PRs I created I just wanted to contribute back all my changes. If this one is not merged, that's okay, others can still read the changes and discussion here if they want it.