Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c-frame/aframe-stereo-component
aframe.io component to enable separate eye rendering of objects, plus stereo video rendering (full 360 or half dome)
https://github.com/c-frame/aframe-stereo-component
Last synced: 13 days ago
JSON representation
aframe.io component to enable separate eye rendering of objects, plus stereo video rendering (full 360 or half dome)
- Host: GitHub
- URL: https://github.com/c-frame/aframe-stereo-component
- Owner: c-frame
- License: mit
- Created: 2016-02-28T22:55:13.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T12:14:17.000Z (8 months ago)
- Last Synced: 2024-10-22T16:55:21.071Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://c-frame.github.io/aframe-stereo-component/
- Size: 69.3 MB
- Stars: 135
- Watchers: 14
- Forks: 52
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## aframe-stereo-component
A stereo component for [A-Frame](https://aframe.io) VR.
This component builds on the ['layer' concept of THREE.js] (https://github.com/mrdoob/three.js/issues/6437) and is really two components in one:
- **'stereocam' component**, with tells an aframe camera which 'eye' to render in case of monoscopic display (without 'Entering VR'). The camera will render all entities without the stereo component, but if it encounters an entity with the 'stereo' component active, it will render only those in the same eye as defined here.
- **'stereo' component**, which tells aframe to include an entity in either the 'right' eye or 'left' eye (you can also specify 'both', but this has the same effect as not using the 'stereo' component. *The component also enables stereoscopic video rendering projected on spheres*, so if a sphere (see example below) has the 'stereo' component enabled, if will only project half of the video texture (which one depends on the 'eye' property), so the result is stereoscopic video rendering, if you include two spheres. The component expects videos in side-by-side equirectangular projection (see the video example below).If a video is used in a sphere with the 'stereo' component active, **the component will also enable playback in mobile devices, by attaching a 'click' event on the rendering canvas**. Thus, in mobile devices you must click on the screen (via cardboard v2.0 button or with your finger) for the video to start playing. This can be disabled by setting the `playOnClick` variable to false.
**NOTE: for some reason (?) if the video element is put inside scene 'assets' tag, a cross-origin issue is raised **
You can see demos for both examples below [here] (http://oscarmarinmiro.github.io/aframe-stereo-component)
### 'stereocam' component properties (only for camera)
| Property | Description | Default Value |
| -------- | ----------- | ------------- |
| eye | which eye is enabled in monoscopic display ('left' or 'right') | 'left |### 'stereo' component properties (for other entities)
| Property | Description | Default Value |
| -------- | ----------- | ------------- |
| eye | in which eye the entity is render VR mode ('left' or 'right') | 'left |
| mode | this property is for spheres holding a video texture. mode can be 'full' or 'half', depending if the original video is full 360 or only spans 180 degrees horizontally (half-dome)| 'full' |
| split | this property indicates whether to split the video texture horizontally (left and right hemispheres), or vertically, (top and bottom hemispheres) | 'horizontal'
| playOnClick | this property indicates whether the video will automatically be played on clicking on the canvas | true### Usage
!["Stereoscopic video"](/video_stereo.png?raw=true "Stereoscopic video")
#### Browser Installation. 360 stereoscopic video example
Install and use by directly including the [browser files](dist):
```html
My A-Frame Scene
```
!["Stereoscopic images"](/foto_stereo.png?raw=true "Stereoscopic video")
#### Browser Installation. Stereoscopic panoramas (images)if you have an over/under stereo panorama file, you can follow [this instructions](http://bl.ocks.org/bryik/4bf77096d3af66b11739caaf01393837) to split it
Install and use by directly including the [browser files](dist):
```html
My A-Frame Scene
<-- or alternatively -->
```
!["Two cubes in a scene, each one for each eye"](/cubes_stereo.png?raw=true "Two cubes in a scene, each one for each eye")
#### Browser Installation. Two cubes, each one for each eye
Install and use by directly including the [browser files](dist):
```html
My A-Frame Scene
```
#### Stereoscopic videos that are split vertically - Top and Bottom
Install and use by directly including the [browser files](dist):
```html
My A-Frame Scene
```#### NPM Installation
Install via NPM:
```bash
npm install aframe-stereo-component
```Then register and use.
```js
var AFRAME = require('aframe');
var stereoComponent = require('aframe-stereo-component').stereo_component;
var stereocamComponent = require('aframe-stereo-component').stereocam_component;AFRAME.registerComponent('stereo', stereoComponent);
AFRAME.registerComponent('stereocam', stereocamComponent);
```#### Credits
The video used in the examples is from http://pedrofe.com/rendering-for-oculus-rift-with-arnold/, from the project http://www.meryproject.com/
Boilerplate code from https://github.com/ngokevin/aframe-component-boilerplate
Code for adjusting sphere face vertex is from https://github.com/mrdoob/three.js/blob/master/examples/webvr_video.html
Stereo images from [Dougstar02](https://www.reddit.com/r/oculus/comments/4yrmm2/i_took_some_360_ansel_stereo_screenshots_from_the/)