mkeblx / x3d-webvr-demo

x3dom demo using webvr api
https://mkeblx.github.io/x3d-webvr-demo/
1 stars 1 forks source link

Fix field of view #1

Open mkeblx opened 8 years ago

mkeblx commented 8 years ago

Calculate correctly based on HMD parameters returned by WebVR API.

andreasplesch commented 7 years ago

It may be possible to use WebVR API provided view and projection matrixes by introducing a WebvrRenderedTexture node (similar to RenderedTexture.js) which uses these in getProjectionMatrix and getViewMatrix.

andreasplesch commented 7 years ago

I took a stab at extending the RenderedTexture node to directly provide the WebVR view and projection matrixes to the x3dom viewarea for rendering. See the matrix branch of my fork here :

https://github.com/andreasplesch/x3d-webvr-demo/tree/matrix

The extended node in js/ has additional stereo modes 'LEFT_VR' and 'RIGHT_VR' and an additional field 'vrDisplay' which trigger use of the WebVR defined matrixes, after applying any additional local transforms.

With webvr.x3d using the new modes, webvr.js does not need the viewpoint position and orientation mutations. With these changes the classroom then works, in the simulator.

Still need to test in Rift and Valve, and also if wrapping Transforms are correctly multiplied in.

Also probably need to set near and far before getting matrixes from frame data.

But now encouraged since the idea works in principle.