Can't match coordinates of NWD and POTREE on Forge Viewer

688 views Asked by At

I'm testing the example https://github.com/petrbroz/forge-potree-demo trying to import a NWD and point cloud into the Forge Viewer but can't make them match the coordinates.

I confirmed on Navisworks that both PC and model are aligned at 0,0,0. But they are displaced more than 200' in the Viewer.

What we did tried

  • Point cloud was converter using Potree converted 1.6 and 1.7 https://github.com/potree/PotreeConverter/releases/tag/1.7

  • The point cloud is scaled from meters to feet using let scale = new THREE.Vector3(3.28084,3.28084,3.28084);.

  • The models are being inserted with a global offset of 0,0,0. globalOffset: {x:0,y:0,z:0}

  • We created a sphere at a know point directly in Threejs using coordinates in foots and it matches the location on the NWD.

  • We found that potree converter is not 100% compatible with the sample, a quick fix is needed on the line 464 to read categories created by the converter.
    var pointAttributeName = pointAttributes[i].name.toUpperCase().replaceAll(' ','_');

  • Also we needed to add a new category around line 434 PointAttribute.RGBA = new PointAttribute(PointAttributeNames.COLOR_PACKED, PointAttributeTypes.DATA_TYPE_INT8, 4);

  • Without those two latest fixes we can't load the point cloud.

What are we missing?

We can override the location by hand but the final coordinates doesn't make sense with the project. Too arbitrary. Could the two fixes be the problem? What should be an alternative?

1

There are 1 answers

0
Pablo D. On

We found the problem, potree was using a bounding box based on absolute units from the actual point cloud bounding box.

This makes sense if you want the point cloud to be on the center of the scene. But not at our case.

So, if you override this feature by changing potree.js bounding box set from

boundingBox.min.sub(offset);
boundingBox.max.sub(offset);

tightBoundingBox.min.sub(offset);
tightBoundingBox.max.sub(offset);

to

tightBoundingBox.min.sub(offset);
tightBoundingBox.max.sub(offset);
                
boundingBox.copy(tightBoundingBox);

the point cloud will align with the model.

FYI: The fixes we made where actually making us able to run potree converter 1.7 instead of 1.6 as specified in the demo readme.