Riccardo Brunello Riccardo Brunello - 2 months ago 42
Javascript Question

Creating 3D environment from jsartoolkit and three.js

I am currently working on my graduation. At the time, I build a simple JSARToolkit page that recognises markers and puts objects over it.

My "big project" will be about getting real measures of the walls that stand behind the speakers and calculate their theoric resonances.

I thought to put markers on the walls (right,left, bottom and top), detect them through the camera using jsartoolkit and use them (and their transformation matrix) to build planes with three.js on my canvas. I need now to detect the intersections of the planes to get a 3D space.. and start to get the real measures of the walls behind the speakers.

The next step would be to get speakers positions in space.. But for now I need the dimensions of the walls... It's a hard work I know, I will really appreciate any help.. thanks for the attention..


You could use a pre-existing room capture system such as a Structure Sensor. It takes about 20 seconds to manually scan the room, then exports (i.e. emails, without any developer tools) the mesh as an .obj which can be loaded into Three.js. This would handle the walls and the speakers in one pass.

Or use your existing system to put a cube on each marker in the room, adding all 6 cubes to the Three.js scene. Finally use new THREE.Box3().setFromObject(myScene) to calculate the bounding box around all 6. The bounding box represents your room.