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

Allow overriding albedo color on Asset3D #7458

Merged
merged 12 commits into from
Oct 24, 2024
Merged

Conversation

EtaLoop
Copy link
Contributor

@EtaLoop EtaLoop commented Sep 20, 2024

What

The idea is to reproduce behavior of Mesh3D regarding color modification on Asset3D :

  • add albedo_factor
  • add vertex_colors as in Mesh3D

In order to overwrite white default texture of Asset3D loaded from stl and obj (gltf already have albedo_factor in file).

See: #5253

Screenshot from 2024-09-18 16-05-54

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide

To run all checks from main, comment on the PR with @rerun-bot full-check.

Keyvan Goddard added 3 commits September 30, 2024 14:43
- add attribute `albedo_factor` and method `with_albedo_factor` to archetype `Asset3D`.
- update stl/obj loader : `load_stl_from_buffer` and `load_obj_from_buffer` to process `albedo_factor`.
  Remove `albedo_texture_buffer`, `albedo_texture_format` from `Asset3D`
- add attribute `vertex_colors` and method `with_vertex_colors` to archetype `Asset3D`.
- update stl/obj loader : `load_stl_from_buffer` and `load_obj_from_buffer` to process `vertex_colors`.
@EtaLoop EtaLoop marked this pull request as ready for review September 30, 2024 13:03
@Wumpf Wumpf self-requested a review October 1, 2024 09:29
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!! 🙂

AlbedoFactor makes a lot of sense to me since this can be applied on all mesh/model formats, would love to get this in. But I don't see yet how we can add vertex_colors in a tractable & defined way. However, maybe we can come up with some rule for it?
Very relatedly, we have to keep in mind that more model formats may be added in the future and we need to avoid ugly surprises in that context. Therefore, I think all additional properties on Assed3D should be "postprocesses" on the loaded mesh. This makes it more robust against future formats and makes it a lot easier to specify what they do.

crates/viewer/re_renderer/src/importer/obj.rs Outdated Show resolved Hide resolved
crates/viewer/re_renderer/Cargo.toml Outdated Show resolved Hide resolved
crates/viewer/re_renderer/src/importer/stl.rs Outdated Show resolved Hide resolved
@Wumpf
Copy link
Member

Wumpf commented Oct 3, 2024

let me know when you think this is ready for review again! :)
(or use the little "re-request review" button so this shows up in my review queue again)

@EtaLoop EtaLoop force-pushed the color-in-asset3d branch 2 times, most recently from 36c02cd to 87751a4 Compare October 3, 2024 13:52
@EtaLoop EtaLoop requested a review from Wumpf October 3, 2024 13:53
@EtaLoop EtaLoop requested a review from Wumpf October 11, 2024 08:17
crates/store/re_types/src/archetypes/asset3d_ext.rs Outdated Show resolved Hide resolved
crates/viewer/re_renderer/src/renderer/mesh_renderer.rs Outdated Show resolved Hide resolved
crates/viewer/re_space_view_spatial/src/mesh_cache.rs Outdated Show resolved Hide resolved
crates/viewer/re_renderer/src/importer/stl.rs Outdated Show resolved Hide resolved
crates/viewer/re_space_view_spatial/src/mesh_loader.rs Outdated Show resolved Hide resolved
crates/viewer/re_space_view_spatial/src/mesh_loader.rs Outdated Show resolved Hide resolved
EtaLoop added 2 commits October 11, 2024 11:19
- Add #derive[(Clone)] instead of impl Clone for MeshInstance
@EtaLoop EtaLoop requested a review from Wumpf October 11, 2024 15:09
Wumpf added a commit that referenced this pull request Oct 22, 2024
### What

This is mainly a refactor of `re_renderer`'s model loading pipeline, but
as the title (== changelog entry) points out, a nice side-effect that
arose culling unnecessary memory usage which may be important for large
meshes.

@EtaLoop's attempt to add a color option to `Asset3D` (see
#7458) made it clear that the
output of the mesh loaders is really hard to work with:
Prior to this PR, they would eagerly create gpu-sided meshes and then
store them alongside an optional (but always filled-out) "cpu mesh" (in
essence the unpacked model file).

Now instead all model loading goes to a intermediate `CpuModel` which
can be rather easily post processed.
Gpu resources are then created as a separate step, consuming the
`CpuModel` (it should be trivial to create a variant that doesn't
consume if we need this in the future)


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7824?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7824?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7824)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
@Wumpf
Copy link
Member

Wumpf commented Oct 22, 2024

Now that #7824 is in, it should be a lot more straight forward to do this!

@EtaLoop
Copy link
Contributor Author

EtaLoop commented Oct 22, 2024

Thanks a lot 👍

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

alright, let's finally get this in! :)

@Wumpf Wumpf added 🍏 primitives Relating to Rerun primitives include in changelog 🪵 Log & send APIs Affects the user-facing API for all languages and removed 🍏 primitives Relating to Rerun primitives labels Oct 23, 2024
@Wumpf Wumpf changed the title Allow color specification on Asset3D Allow overriding albedo color on Asset3D Oct 23, 2024
@Wumpf
Copy link
Member

Wumpf commented Oct 23, 2024

I wanted to push a fix for the doc issues ci brought up, but I don't have permissions it seems (hum, this usually works, no idea why)
That's my fix, can you cherrypick it in?
5c7bea0

@EtaLoop EtaLoop force-pushed the color-in-asset3d branch 2 times, most recently from b8c12b4 to d46215e Compare October 24, 2024 07:06
@EtaLoop
Copy link
Contributor Author

EtaLoop commented Oct 24, 2024

Done, sorry for the mess up there 😓

@Wumpf Wumpf merged commit 0feef41 into rerun-io:main Oct 24, 2024
31 of 32 checks passed
@EtaLoop
Copy link
Contributor Author

EtaLoop commented Oct 24, 2024

Thank you for your time and advice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include in changelog 🪵 Log & send APIs Affects the user-facing API for all languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants