Open Clodo76 opened 8 months ago
For your second question, for 360 stereo video, you can look at https://github.com/oscarmarinmiro/aframe-stereo-component and there is actually also a half mode for 180 videos but I never used it. I used it mainly with videos and single image with top=left eye and bottom=right eye.
Feel free to submit a PR with doc improvements.
For first question. It would be possible to playback 180 degrees video but we haven't seen much demand. What's the format / special about it? 180 video is not just equirectangular too? Can always be supported via 3rd party component.
Answering the first question for future generations, for non-equirectangular but spherical projection (like a 180 fisheye) as such:
Using a custom shader on a videosphere:
<script>
AFRAME.registerShader('fisheyesphere', {
schema: {
src: { type: 'map', is: 'uniform' }
},
vertexShader: `
varying vec3 vNormal;
void main() {
vNormal = normal;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`,
fragmentShader: `
uniform sampler2D src;
varying vec3 vNormal;
void main() {
vec2 uv = normalize( vNormal ).xy * 0.5 + 0.5;
vec3 color = texture2D( src, uv ).rgb;
gl_FragColor = vec4( color, 1.0 );
}
`
});
</script>
<a-videosphere src= "#fishvideo" play-on-click geometry="phiLength: 180; phiStart: 0;" rotation="90 0 0" position="0 0 0" material="shader: fisheyesphere"></a-videosphere>
this approach can be adapted to dual fisheye lenses 360 thus answering the second question aswell. ref: eye projection in three.js
https://aframe.io/docs/1.5.0/primitives/a-videosphere.html#equirectangular-video
<a-videosphere rotation="0 -90 0" src="#video" play-on-click></a-videosphere>
Thanks