JamesLMilner / THREEAR

A marker based Augmented Reality library for Three.js
https://jameslmilner.github.io/THREEAR/
172 stars 24 forks source link

Is it possible to use perspective camera? #89

Open imokya opened 5 years ago

imokya commented 5 years ago

currenty the library dosen't work with different size video source. Given a portait video source(height>width), the 3D object gets stretched. When I switch to perspective camera, the stretching issue gone, but the 3D object dosen't perfectly attatch to the marker. Is it possible to use perspective camera in the first place and aslo attatch to the marker correctly ?

martinloretzzz commented 5 years ago

What aspecto ratio do you use for the Perspective camera? Try to use 4/3 or 3/4 as the aspecto for the Camera [If the Source Stream isn't 4/3[or 3/4], maybe you should crop it to 4/3]

imokya commented 5 years ago

hi @0b01001101 thanks for the reply. cause I can only access the camera frame data(fixed size raw bufferarray), there is no way I can crop the display. or Maybe create another canvas to draw and crop, but it can be resource consuming. Why the library only works in ratio 4/3? It is possible to make it work with other aspect ratios?

imokya commented 5 years ago

test perspective camera with 3/4 aspect ratio, 3D model dosen't attach correctly, while 4/3 ratio is fine demo 4/3 https://www.xingway.com/ar2/basic2.html demo 3/4 https://www.xingway.com/ar2/basic.html

imokya commented 5 years ago

is it an issue ralated to camera parameters file?

martinloretzzz commented 5 years ago

I think in the that file the aspecto is set to 4/3 so jsartoolkit expects that aspecto ratio