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

Add YouTube Equi-Angular Cubemap (EAC) projection #179

Merged
merged 1 commit into from
Aug 27, 2019
Merged

Add YouTube Equi-Angular Cubemap (EAC) projection #179

merged 1 commit into from
Aug 27, 2019

Conversation

zhuyifei1999
Copy link
Contributor

Description

YouTube has been using this projection since 2018 (see
ytdl-org/youtube-dl#15267), and most YouTube downloaders will get
EAC format when attempting to retrieve YouTube 360° videos. This
patch adds ability to render videos in this projection. Formulas
for the shader are derived from Google's blog [1], and pixel
truncation done by trial and error with a bit of pixel inspection
on a single frame of a downloaded video. Without turncating the
pixels, seams appear on cube borders where the textures are
discontinuous.

Two videos downloaded from YouTube, in both EAC projection and
Equirectangular projection, has been added to the repo, along with
relevant HTMLs to demonstrate the rendering. During the testing I
found that split Equirectangular projection to not render at all,
and that has been fixed along with this patch.

[1] https://blog.google/products/google-ar-vr/bringing-pixels-front-and-center-vr-video/

Specific Changes proposed

  • EAC projection rendering support added (with and without side-by-side)
  • EAC projection examples added (with and without side-by-side)
  • Split Equirectangular projection rendering fixed
  • README updated to reflect the change

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Unit Tests updated or fixed
    • Docs/guides updated
  • Reviewed by Two Core Contributors


this.movieGeometry = new THREE.BufferGeometry().fromGeometry(geometry);
this.movieMaterial = new THREE.MeshBasicMaterial({ map: this.videoTexture, overdraw: true, side: THREE.BackSide });

this.movieScreen = new THREE.Mesh(this.movieGeometry, this.movieMaterial);
this.movieScreen.rotation.y = -Math.PI / 2;
this.movieScreen.scale.x = -1;
this.movieScreen.quaternion.setFromAxisAngle({x: 0, y: 1, z: 0}, -Math.PI / 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do these changes do?

Copy link
Contributor Author

@zhuyifei1999 zhuyifei1999 Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from 360 projection. This transforms the geometry so that it maps the texture correctly. The geometry is rotated by pi/2 and flipped.

The version on master is completely broken, resulting in a blank canvas, IIRC. You can test that with a 360_LR or 360_TB video.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can test that with a 360_LR or 360_TB video.

coriolis_rect.webm is one ;)

Copy link
Contributor

@brandonocasey brandonocasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need more than one eac example video in the repo?

package.json Outdated
@@ -82,6 +82,7 @@
},
"dependencies": {
"global": "^4.3.2",
"natives": "^1.1.6",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I had some build failure at some point. Don't remember what exactly. I'll revert it.

Copy link
Contributor Author

@zhuyifei1999 zhuyifei1999 Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted during rebase.

Edit: Uh, didn't happen. Now it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think https://travis-ci.org/videojs/videojs-vr/builds/575075840 is the build failure.

21 08 2019 21:50:35.760:ERROR [config]: Invalid config file!
  ReferenceError: internalBinding is not defined
    at internal/util/inspect.js:31:15
    at req_ (/home/travis/build/videojs/videojs-vr/node_modules/natives/index.js:140:5)
    at require (/home/travis/build/videojs/videojs-vr/node_modules/natives/index.js:113:12)
    at util.js:25:21
    at req_ (/home/travis/build/videojs/videojs-vr/node_modules/natives/index.js:140:5)
    at require (/home/travis/build/videojs/videojs-vr/node_modules/natives/index.js:113:12)
    at fs.js:42:21
    at req_ (/home/travis/build/videojs/videojs-vr/node_modules/natives/index.js:140:5)
    at Object.req [as require] (/home/travis/build/videojs/videojs-vr/node_modules/natives/index.js:54:10)
    at Object.<anonymous> (/home/travis/build/videojs/videojs-vr/node_modules/unzip/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)

@zhuyifei1999
Copy link
Contributor Author

Do we need more than one eac example video in the repo?

This is to demonstrate LR rendering capabilities. I can remove that if you want; however, not having an example for LR 360 could be an indirect cause of its failure IMO.

@gkatsev
Copy link
Member

gkatsev commented Aug 21, 2019

Where do the new sample videos come from?

@zhuyifei1999
Copy link
Contributor Author

zhuyifei1999 commented Aug 21, 2019

Where do the new sample videos come from?

YouTube, downloaded via youtube-dl

I'm pretty sure they were downloaded using format code 248 (1080p VP9), downloaded using both Equirectangular method and EAC method, and no transcoding / muxing / transforming happened on my side.

Had to find some 360 videos that isn't too long or too short and is explicitly allowing reuse.

@gkatsev
Copy link
Member

gkatsev commented Aug 21, 2019

Cool, I can see that both are creative commons licensed, so, shouldn't be a problem to include in the repo.

YouTube has been using this projection since 2018 (see
ytdl-org/youtube-dl#15267), and most YouTube downloaders will get
EAC format when attempting to retrieve YouTube 360° videos. This
patch adds ability to render videos in this projection. Formulas
for the shader are derived from Google's blog [1], and pixel
truncation done by trial and error with a bit of pixel inspection
on a single frame of a downloaded video. Without turncating the
pixels, seams appear on cube borders where the textures are
discontinuous.

Two videos downloaded from YouTube, in both EAC projection and
Equirectangular projection, has been added to the repo, along with
relevant HTMLs to demonstrate the rendering. During the testing I
found that split Equirectangular projection to not render at all,
and that has been fixed along with this patch.

[1] https://blog.google/products/google-ar-vr/bringing-pixels-front-and-center-vr-video/
@zhuyifei1999
Copy link
Contributor Author

I reverted the changes to package-lock.json as well.

@eyydamn
Copy link

eyydamn commented May 24, 2024

i dont understand i have the same issue
Uploading image.png…
screen split in half and same video playing over the other i tried everything in the pasts thread
nothing worked is there a soultion ? ive been searching for 3 days should i give up??

@jamesryan-dev
Copy link

+1 following

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

Successfully merging this pull request may close these issues.

5 participants