Anttwo / SuGaR

[CVPR 2024] Official PyTorch implementation of SuGaR: Surface-Aligned Gaussian Splatting for Efficient 3D Mesh Reconstruction and High-Quality Mesh Rendering

Home Page:https://anttwo.github.io/sugar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use PLY exported from NGP?

463f opened this issue · comments

The code below is from gaussian_splatting/scene/dataset_readers.py.

  1. I wonder if this is from colmap or someother places?
  2. I try to use the transforms.json and PLY file exported from NGP as input, and both of them are in nerf coordinate. I check the dataset_readers.py code and find the transforms.json is converted to COLMAP coordinate. Is that means the NGP PLY file is not matched to the converted transforms.json, so I cannot use the NGP PLY file? What if I don't do the coordinate convertion(delete the convertion code of dataset_readers file) and make both json and PLY stay in NeRF coordinate?

Is anyone have some advice? Thanks a lot!!!

def readNerfSyntheticInfo(path, white_background, eval, extension=".png"):
    print("Reading Training Transforms")
    train_cam_infos = readCamerasFromTransforms(path, "transforms_train.json", white_background, extension)
    print("Reading Test Transforms")
    test_cam_infos = readCamerasFromTransforms(path, "transforms_test.json", white_background, extension)
    
    if not eval:
        train_cam_infos.extend(test_cam_infos)
        test_cam_infos = []

    nerf_normalization = getNerfppNorm(train_cam_infos)

    ply_path = os.path.join(path, "points3d.ply")
    if not os.path.exists(ply_path):
        # Since this data set has no colmap data, we start with random points
        num_pts = 100_000
        print(f"Generating random point cloud ({num_pts})...")
        
        # We create random points inside the bounds of the synthetic Blender scenes
        xyz = np.random.random((num_pts, 3)) * 2.6 - 1.3
        shs = np.random.random((num_pts, 3)) / 255.0
        pcd = BasicPointCloud(points=xyz, colors=SH2RGB(shs), normals=np.zeros((num_pts, 3)))

        storePly(ply_path, xyz, SH2RGB(shs) * 255)
    try:
        pcd = fetchPly(ply_path)
    except:
        pcd = None

    scene_info = SceneInfo(point_cloud=pcd,
                           train_cameras=train_cam_infos,
                           test_cameras=test_cam_infos,
                           nerf_normalization=nerf_normalization,
                           ply_path=ply_path)
    return scene_info