{"id":19401031,"url":"https://github.com/google-research/visu3d","last_synced_at":"2025-05-16T05:05:10.629Z","repository":{"id":37797925,"uuid":"471330710","full_name":"google-research/visu3d","owner":"google-research","description":"3d without friction (Torch, TF, Jax, Numpy)","archived":false,"fork":false,"pushed_at":"2024-11-19T14:02:17.000Z","size":8933,"stargazers_count":151,"open_issues_count":7,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-15T01:53:22.691Z","etag":null,"topics":["3d","nerf","plotly"],"latest_commit_sha":null,"homepage":"https://visu3d.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-research.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-18T10:49:28.000Z","updated_at":"2025-04-20T01:34:49.000Z","dependencies_parsed_at":"2024-01-02T18:27:14.297Z","dependency_job_id":"8774876d-f35d-41b6-83cd-7d7ac8d4d3eb","html_url":"https://github.com/google-research/visu3d","commit_stats":{"total_commits":114,"total_committers":8,"mean_commits":14.25,"dds":0.0964912280701754,"last_synced_commit":"f2f44584c8b3f867de841dd4d40c4554ef18f14a"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fvisu3d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fvisu3d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fvisu3d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fvisu3d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-research","download_url":"https://codeload.github.com/google-research/visu3d/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","nerf","plotly"],"created_at":"2024-11-10T11:16:47.368Z","updated_at":"2025-05-16T05:05:05.612Z","avatar_url":"https://github.com/google-research.png","language":"Python","funding_links":[],"categories":["Implementations"],"sub_categories":[],"readme":"# visu3d - 3D geometry made easy\n\n[![Unittests](https://github.com/google-research/visu3d/actions/workflows/pytest_and_autopublish.yml/badge.svg)](https://github.com/google-research/visu3d/actions/workflows/pytest_and_autopublish.yml)\n[![PyPI version](https://badge.fury.io/py/visu3d.svg)](https://badge.fury.io/py/visu3d)\n[![Documentation Status](https://readthedocs.org/projects/visu3d/badge/?version=latest)](https://visu3d.readthedocs.io/en/latest/?badge=latest)\n\n`visu3d` is an abstraction layer between Torch/TF/Jax/Numpy and your program.\nIt provides:\n\n*   Standard primitives for 3d geometry (`Ray`, `Camera`, `Transform`,...).\n    You can combine those standard primitives with your custom ones.\n*   Everything is trivially visualizable with zero boilerplate. Inspect \u0026 debug\n    camera poses, trajectories,...\n*   All primitives are\n    [`dataclass_array`](https://github.com/google-research/dataclass_array),\n    dataclasses which can be reshaped, sliced,... as if they were numpy arrays.\n*   Everything is extensible, you can gradually opt-in only for the features you\n    need, and replace any standard primitive by your custom ones.\n\n### Core features\n\n\u003csection class=\"zippy\"\u003e\n\nEverything is a `v3d.DataclassArray`: **dataclass behave like `np.array`** (with\nindexing, slicing, shape manipulation, vectorization,...).\n\n```python\n# Single ray\nray = v3d.Ray(pos=[0, 0, 0], dir=[1, 1, 1])\nassert rays.shape == ()\n\n# Multiple rays batched together\nrays = v3d.Ray(pos=np.zeros((B, H, W, 3)), dir=np.ones((B, H, W, 3)))\nassert rays.shape == (B, H, W)\n\nrays = rays.reshape('b h w -\u003e b (h w)')  #  Native `einops` support\n\ntop_left_ray = rays[..., 0, 0]  #  (b, h, w) -\u003e (b,)\n\nrays = rays.flatten()\nrays = rays[rays.norm() \u003e 0]  # Filter invalid rays\n```\n\n\u003c/section\u003e\n\u003csection class=\"zippy\"\u003e\n\nEverything is **visualizable interactively**\n\nEvery object has a `.fig` property for interactive visualization:\n\n```python\nrays.fig  # Plot the rays\n```\n\nDisplay multiple objects together:\n\n```python\nv3d.make_fig([cam, rays, point_cloud])\n```\n\nAuto-plot figures with Colab magic:\n\n```python\nv3d.auto_plot_figs()  # Once at the start of the Colab\n\ncam, rays, point_cloud  # Tuple auto-displayed without `v3d.make_fig` call\n```\n\n\u003c/section\u003e\n\u003csection class=\"zippy\"\u003e\n\nSame code seamlessly **works across Torch, Jax, TensorFlow, Numpy**.\n\n```python\nrays = rays.as_jax()  # .as_tf(), as_np(), .as_jax()\nassert isinstance(rays.pos, jnp.ndarray)\nassert rays.xnp is jnp\n\nrays = rays.as_torch()\nassert isinstance(rays.pos, torch.Tensor)\nassert rays.xnp is torch\n```\n\nWith native support for auto-diff, `jax.vmap`, `jax.tree_utils`,...\n\n\u003c/section\u003e\n\n### Privitives\n\n\u003csection class=\"zippy\"\u003e\n\nCommon primitives (`Ray`, `Camera`, `Transform`,...), so user can express\nintent, instead of math.\n\n```python\nH, W = (256, 1024)\ncam_spec = v3d.PinholeCamera.from_focal(\n    resolution=(H, W),\n    focal_in_px=35.,\n)\ncam = v3d.Camera.from_look_at(\n    spec=cam_spec,\n    pos=[5, 5, 5],\n    target=[0, 0, 0],  # Camera looks at the scene center\n)\n\nrays = cam.rays()  # Rays in world coordinates\n\n# Project `(*shape, 3)` world coordinates into `(*shape, 2)` pixel coordinates.\npx_coords = cam.px_from_world @ point_cloud\n```\n\nSee [the API](https://github.com/google-research/visu3d/tree/main/visu3d/__init__.py)\u003c!-- {.external} !--\u003e\nfor a full list of primitive.\n\n\u003c/section\u003e\n\u003csection class=\"zippy\"\u003e\n\nCreating your own primitives is trivial.\n\nConverting any dataclass to dataclass array is trivial:\n\n*   Inherit from `v3d.DataclassArray`\n*   Use\n    [`etils.array_types`](https://github.com/google/etils/blob/main/etils/array_types/README.md)\n    to annotate the array fields (or exlicitly use `my_field: Any =\n    dca.field(shape=, dtype=)` instead of `dataclasses.field`)\n\n```python\nfrom etils.array_types import FloatArray\n\n\nclass MyRay(v3d.DataclassArray):\n  pos: FloatArray[..., 3]\n  dir: FloatArray[..., 3]\n\n\nrays = MyRay(pos=jnp.zeros((H, W, 3)), dir=jnp.ones((H, W, 3)))\nassert rays.shape == (H, W)\n```\n\n`v3d` makes it easy to opt-in to the feature you need by implementing the\ncorresponding protocol.\n\n\u003c!-- See [the tutorial]() for more info. --\u003e\n\n\u003c/section\u003e\n\n### Documentation\n\nThe best way to get started is to try the Colab tutorials (in the\n[documentation](https://visu3d.readthedocs.io/)):\n\n*   [Intro](https://visu3d.readthedocs.io/en/latest/intro.html) ([Colab](https://colab.research.google.com/github/google-research/visu3d/blob/main/docs/intro.ipynb))\n    \u003c!-- {.external} !--\u003e\n*   [Transform](https://visu3d.readthedocs.io/en/latest/transform.html) ([Colab](https://colab.research.google.com/github/google-research/visu3d/blob/main/docs/transform.ipynb))\n    \u003c!-- {.external} !--\u003e\n*   [Create your primitives](https://visu3d.readthedocs.io/en/latest/dataclass.html) ([Colab](https://colab.research.google.com/github/google-research/visu3d/blob/main/docs/dataclass.ipynb))\n    \u003c!-- {.external} !--\u003e\n\nInstallation:\n\n```sh\npip install visu3d\n```\n\nUsage:\n\n```python\nimport visu3d as v3d\n```\n\n## Installation\n\n```sh\npip install visu3d\n```\n\n*This is not an official Google product.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-research%2Fvisu3d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-research%2Fvisu3d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-research%2Fvisu3d/lists"}