Skip to content

Conversation

@RongLiu-Leo
Copy link
Contributor

Recording.2025-05-25.172251.mp4
  • This PR adds support for running 2DGS with the latest version of nerfview, ensuring compatibility and functionality. Without this update, 2DGS cannot be executed properly. Render mode supports rgb, depth, normal, and alpha.

  • Replaced the use of colormap with apply_float_colormap. While both provide similar logic, colormap triggers runtime errors in my environment. Suggest to unify the function usage and stick to apply_float_colormap.

@AlexMorgand
Copy link

Nice!

I did something similar in #540 adding a backend option if you guys want to keep the simple_viewer as one file. The branch is a bit old but just a reference for further discussion

@liruilong940607
Copy link
Collaborator

This looks cool! But the depth rendering is pretty weird -- doesn't look like depth map at all. Is the viewer accessing the correct depth data?

@RongLiu-Leo
Copy link
Contributor Author

Let me double check.

@RongLiu-Leo
Copy link
Contributor Author

Recording.2025-05-27.194934.mp4

Looks good now! Thanks for pointing it out.

Copy link
Collaborator

@liruilong940607 liruilong940607 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks for fixing 2DGS viewer (and trainer)!

@liruilong940607 liruilong940607 merged commit 0b4dddf into nerfstudio-project:main May 28, 2025
2 checks passed
@Chuan-10
Copy link

Hi, thank you for the great work on gsplat!

I noticed a small bug in examples/simple_trainer_2dgs.py, which seems to be related to the recent Arbitrary batching feature. The current implementation of the depth and normal rendering logic may cause bugs in some cases.

It could be modified as follows:

if render_tab_state.render_mode == "depth":
    # normalize depth to [0, 1]
    depth = render_median[0]
    if render_tab_state.normalize_nearfar:
        near_plane = render_tab_state.near_plane
        far_plane = render_tab_state.far_plane
    else:
        near_plane = depth.min()
        far_plane = depth.max()
    depth_norm = (depth - near_plane) / (far_plane - near_plane + 1e-10)
    depth_norm = torch.clip(depth_norm, 0, 1)
    if render_tab_state.inverse:
        depth_norm = 1 - depth_norm
    renders = apply_float_colormap(depth_norm, render_tab_state.colormap).cpu().numpy()
elif render_tab_state.render_mode == "normal":
    render_normals = render_normals[0] * 0.5 + 0.5  # normalize to [0, 1]
    renders = render_normals.cpu().numpy()
elif render_tab_state.render_mode == "alpha":
    alpha = render_alphas[0, ..., 0:1]
    renders = apply_float_colormap(alpha, render_tab_state.colormap).cpu().numpy()

This small change fixes the depth and normal rendering bugs.

Thanks again for the excellent repo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants