- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.4k
Description
🐛 Bugs / Unexpected behaviors
Hello,
I noticed that the 3D plotting function (plot_pointcloud) in the deform_source_mesh_to_target_mesh tutorial uses a confusing visualization setup.
The code plots the Y-up model upside-down (using ax.scatter3D(x, z, -y)) but sets the camera view from underneath (ax.view_init(190, 30)).
This combination of an inverted model and an inverted camera makes the plot appear correct, but it's misleading and causes inverted mouse controls, which is highly confusing for users learning the library.
Instructions To Reproduce the Issue:
The bug is present in the original plot_pointcloud function within the tutorial:
# docs/tutorials/deform_source_mesh_to_target_mesh.ipynb
def plot_pointcloud(mesh, title=""):
    # Sample points uniformly from the surface of the mesh.
    points = sample_points_from_meshes(mesh, 5000)
    x, y, z = points.clone().detach().cpu().squeeze().unbind(1)    
    fig = plt.figure(figsize=(5, 5))
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter3D(x, z, -y)  # <-- Problem: Renders model upside-down
    ax.set_xlabel('x')
    ax.set_ylabel('z')
    ax.set_zlabel('y')
    ax.set_title(title)
    ax.view_init(190, 30)  # <-- Problem: Views from underneath
    plt.show()The exact command(s) I ran:
# 1. Open the tutorial notebook
# (e.g., in VS Code or Jupyter)
# docs/tutorials/deform_source_mesh_to_target_mesh.ipynb
# 2. Run the cells sequentially until the first plot ("dolphin mesh") is generated.What I observed (including the full logs):
The plot of the obj appears to be right-side up. However, interacting with the plot using the mouse reveals that the rotation controls are inverted.
Root Cause:
The model is Y-up, but it's being plotted with ax.scatter3D(x, z, -y), which maps the model's Up (+y) direction to the plot's Down (-z) direction. The ax.view_init(190, 30) then views this upside-down model from underneath, creating an illusion of it being correct.
Proposed Fix:
The plot function should use the correct coordinate mapping (x, -z, y) and a standard view angle (e.g., elev=30, azim=30) for intuitive results.