Skip to content

Instantly share code, notes, and snippets.



Last active May 3, 2020
What would you like to do?
A-Frame and Cardboard Camera
license: mit

Displaying Cardboard Camera Stereo Panoramas with A-Frame

Update: for an easier way, see Overunder Panorama Viewer.


  1. Convert original vr.jpg Cardboard Camera image into over-under equirectangular with this webservice.

  2. Split the over-under equirectangular image in two using the following ImageMagick command:

magick convert <IMAGE.png> -crop 1x2@ +repage +adjoin pano_%d.png

Note: replace <IMAGE.png> with the name and format of the image you want to split.

This command will add two new files to your directory. I suggest renaming them to avoid confusion:

  • pano_0.png -> left.png
  • pano_1.png -> right.png
  1. Upload the left and right images to the host of your choice. Beware of CORS issues. Imgur worked for me.

  2. Go to this codepen and hit the "fork" button (or fork this Gist and use bl.ocks).

  3. Replace the links on lines 4 and 5 with your own.

CodePen has a number of different views, "debug" is the cleanest.


Credit for Cardboard panorama: Google.

Example Pen by bryik on CodePen.

<!DOCTYPE html>
<meta charset="utf-8">
<script src=""></script>
<script src=""></script>
<a-scene antialias="true">
<!-- Paths to left and right images -->
<img id="left" src="">
<img id="right" src="">
<!-- Camera -->
<a-entity camera look-controls position="0 0 0" stereocam="eye:left;"></a-entity>
<!-- Sky sphere -->
<a-sky id="sky1" radius="5000" src="#left" stereo="eye:left"></a-sky>
<a-sky id="sky2" radius="5000" src="#right" stereo="eye:right"></a-sky>

This comment has been minimized.

Copy link

@caffeinum caffeinum commented May 3, 2020

Hey, how come I haven't found this a few days ago! :D
But now I built a web-app for this, which does all this automatically. You can upload and view examples here:

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