How to use "OculusRiftEffect.js" in the examples "webgl_interactive_cubes"

I was very excited when I first saw this example ( webgl_geometry_minecraft_oculusrift ) in mrdoob / three.js Β· GitHub . Sure, it's pretty amazing!

But I'm curious how to apply this effect to other examples? Therefore, I am trying to implement this effect in "webgl_interactive_cubes". However, the experimental result is worse than expected.

My problem is that I can’t precisely align the cursor with a specific cube so that it changes color, it seems to be a problem with the projection function? Then I adjusted the screen width coefficient, like this

window.innerWidth * 2

throughout the program. But still can not improve this problem.

My problem summary:

  • If I want to apply the Oculus Rift effect on any example , how do I do it? in my opinion, I added only the following code

    effect = new THREE.OculusRiftEffect( renderer ); effect.setSize( window.innerWidth, window.innerHeight ); // Right Oculus Parameters are yet to be determined effect.separation = 20; effect.distortion = 0.1; effect.fov = 110; 

    in the initialization of the init(); block init(); and the final added effect.render( scene, camera ); in render();

  • I am very curious to find out how

    var vector = new THREE.Vector3( mouse.x, mouse.y, 1 ); projector.unprojectVector( vector, camera );

    working. Why pass parameter 1? what if i change mouse.x to mouse.x * 2

  • The need to use two monitors can be fully represented only by this effect?

Note: my English is not very good, if I described it unclear, please ask your doubts, I will reply as soon as possible.

This is my DEMO link:

My folder: https://googledrive.com/host/0B7yrjtQvNRwoYVQtMUc4M1ZZakk/

+7
source share
1 answer

The third is your example?

This will help you use OR-Effect more efficiently: https://github.com/carstenschwede/RiftThree

And your examples all work, only the third is the problem with the controls. If I drag a transition from Stats-DIV (FPS), it will work.

0
source

All Articles