javascript - THREE.js custom vr/cardboard effect -


i'm trying create custom vr panorama viewer using three.js. i've managed create:

  • 2 scenes,
  • 2 materials , meshes (different images loaded left , right eye),
  • renderer scissors (2 perspective cameras).

the result looks this: enter image description here

everything looks fine me add kind of "black vr cardboard frame" both cameras. i'm not quiet sure how effect called, here example:

enter image description here

can please give me tips?

that word looking "barrel distortion". can see working implementation of in webvr-polyfill here. depending on how understand raw webgl might bit difficult read though.

so here basic steps of versatile approach using 2 render-passes:

  • that split-image have rendered framebuffer (see here example) instead of rendering screen. framebuffer used texture in second renderpass.
  • setup scene , camera second renderpass. camera should orthographic camera ranging -1 1 on x-axis (something like this).
  • setup 2 meshes (based on planebuffergeometry) 2 viewports , assign uv-coordinates such left mesh use left half of framebuffer texture , right mesh use right half.
  • add meshes second scene-instance, position them next each other.
  • apply barrel-distortion vertices of meshes. done in code webvrpolyfill.
  • render second scene screen

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -