jsartoolkitNFT icon indicating copy to clipboard operation
jsartoolkitNFT copied to clipboard

No effect when changing the near and far plane

Open j-era opened this issue 3 years ago • 4 comments

Hey, i believe that i have become aware of an error concerning changing the near and far plane after camera initialization. When i change those after initialization (e.g. arControllerNft.setProjectionFarPlane(..)) the camera matrix will not be updated:

Seems the values are only taken into account in the setup method? https://github.com/webarkit/jsartoolkitNFT/blob/f6390101c2f98fb07ec42d95f73fc72da81028f4/emscripten/ARToolKitJS.cpp#L716 https://github.com/webarkit/jsartoolkitNFT/blob/f6390101c2f98fb07ec42d95f73fc72da81028f4/emscripten/ARToolKitJS.cpp#L514

I try to increase the far plane value, because the augmentation model gets lost when the tracking image is to far away from the camera, but it's still tracked (what i can read from the logs).

Did I get something wrong? Thanks a lot.

j-era avatar Apr 29 '21 11:04 j-era

Hey, i believe that i have become aware of an error concerning changing the near and far plane after camera initialization. When i change those after initialization (e.g. arControllerNft.setProjectionFarPlane(..)) the camera matrix will not be updated:

Seems the values are only taken into account in the setup method?

https://github.com/webarkit/jsartoolkitNFT/blob/f6390101c2f98fb07ec42d95f73fc72da81028f4/emscripten/ARToolKitJS.cpp#L716

Yes i think that is only in setup. But the fact is we get the camera Matrix in the Worker and we send this value with a postmessage https://github.com/webarkit/jsartoolkitNFT/blob/f6390101c2f98fb07ec42d95f73fc72da81028f4/js/artoolkitNFT_ES6.worker.js#L41 that is readed in the threejs_worke_ES6r.js script in the onmessage: https://github.com/webarkit/jsartoolkitNFT/blob/f6390101c2f98fb07ec42d95f73fc72da81028f4/examples/threejs_worker_ES6.js#L85-L101

I think you modified the far plane in these files i think (or something similar i think).

https://github.com/webarkit/jsartoolkitNFT/blob/f6390101c2f98fb07ec42d95f73fc72da81028f4/emscripten/ARToolKitJS.cpp#L514

I try to increase the far plane value, because the augmentation model gets lost when the tracking image is to far away from the camera, but it's still tracked (what i can read from the logs).

Did I get something wrong? Thanks a lot.

But how much Dpi has your NFT Marker?

kalwalt avatar May 03 '21 20:05 kalwalt

Hello, I am getting the same issue. My objects get clipped after a certain distance but the tracker can track the target. I want to increase the far plane or the clipping distance.

anand-dotworld avatar Dec 17 '22 05:12 anand-dotworld

@anand-dotworld this depends not by the far plane of the jsartoolkitNFT camera but by two factors dpi of the NFT marker and the far clipping plane of you render engine Threee.js used in the render engine or what else.

kalwalt avatar Dec 19 '22 20:12 kalwalt

I think when camera settings are changed it's needed to re-run the setCamera method https://github.com/webarkit/jsartoolkitNFT/blob/2bbc6b35db9b1faa8a121d57a436c7efa8fe0ce9/emscripten/ARToolKitJS.cpp#L413-L457 actually is only used in the setup method https://github.com/webarkit/jsartoolkitNFT/blob/2bbc6b35db9b1faa8a121d57a436c7efa8fe0ce9/emscripten/ARToolKitJS.cpp#L704-L716 so it's not available in the final Emscripten export, i will try to add this and see if it make the difference.

kalwalt avatar Feb 11 '23 15:02 kalwalt