Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene3D #41

Open
wants to merge 167 commits into
base: main
Choose a base branch
from
Open

Scene3D #41

wants to merge 167 commits into from

Conversation

mhuebert
Copy link
Collaborator

@mhuebert mhuebert commented Dec 12, 2024

This PR introduces a new 3D visualization module in src/genstudio/scene3d.py.

It brings in our first set of interactive scene components using WebGPU, including:

  • Components for 3D Visualization: Functions to easily create various 3D primitives:
    • PointCloud: For rendering point clouds with customizable positions, colors, sizes, and transparency.
    • Ellipsoid & EllipsoidAxes: To render solid ellipsoids or their wireframe bounds.
    • Cuboid: For drawing cuboids with position, size, and optional color/alpha settings.
    • LineBeams: For connecting points into beams based on grouping.
  • Decorations: The deco function helps create standard decoration dictionaries (indexes, color, alpha, scale) to style scene components uniformly.

Usage notes

  • Arrays for columnar data (eg. sizes, alphas, positions and so on) should be flattened, due to javascript not having support for multidimensional arrays. Some effort is made to due this in our python api but it won't handle the common/recommended cases where data is specified within Plot.initialState (we don't know statically how this data is used, so we can't automatically reshape)
  • Dense vs Sparse data: if you are specifying an attribute for ALL instances of a component, specify it directly using alpha (same alpha for all) or alphas (an array with one value per instance). Eg. PointCloud(positions=[...], sizes=[...], alpha=...). If you want to specify an attribute for a small number of instances, use a decoration, eg PointCloud(..., decorations=[deco([..indexes..], alpha=...]).

Review/Doc notes

  • there are a large number of notebook/scene3d_* example files
  • a brief introduction to the system (for the website) is found in docs/learn-more/scene3d.py

@mhuebert mhuebert force-pushed the huebert/3d branch 3 times, most recently from d6e013f to 2e231e0 Compare January 31, 2025 10:30
@mhuebert mhuebert changed the title Points3D Scene3D Jan 31, 2025
@mhuebert mhuebert marked this pull request as ready for review February 6, 2025 09:44
@mhuebert
Copy link
Collaborator Author

mhuebert commented Feb 6, 2025

I've tagged a few people for review, if you have time/interest. This is large PR, and for workflow purposes I'd like to merge it today so that the scene3d docs make it into the website, and we can follow up with further review/changes later.

Copy link
Contributor

@sritchie sritchie left a comment

Choose a reason for hiding this comment

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

Happy to approve and debug later based on a view of the mkdocs files... @chi-collective/gen , @littleredcomputer , if anyone else wants to stare at this please do!

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

Successfully merging this pull request may close these issues.

2 participants