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

Fix the textures loading in .glb file #5443

Merged
merged 12 commits into from
Aug 26, 2022
Merged

Fix the textures loading in .glb file #5443

merged 12 commits into from
Aug 26, 2022

Conversation

ZhengyuDiao
Copy link
Contributor

@ZhengyuDiao ZhengyuDiao commented Aug 17, 2022

Now both .png and .jpg textures are supported.


This change is Reviewable

@update-docs
Copy link

update-docs bot commented Aug 17, 2022

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

Copy link
Collaborator

@errissa errissa left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 4 files at r1.
Reviewable status: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @errissa and @ZhengyuDiao)


cpp/open3d/io/ImageIO.h line 55 at r1 (raw file):

/// The function calls read functions based on format of image.
/// \return return true if the read function is successful, false otherwise.
bool ReadImageFromMemroy(const std::string &image_format,

Spelling error with Memroy -> Memory


cpp/open3d/io/ImageIO.cpp line 114 at r1 (raw file):

}

bool ReadImageFromMemroy(const std::string &image_format,

Same spelling error - see above.

Copy link
Contributor Author

@ZhengyuDiao ZhengyuDiao left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @errissa)


cpp/open3d/io/ImageIO.h line 55 at r1 (raw file):

Previously, errissa (Rene) wrote…

Spelling error with Memroy -> Memory

Done.


cpp/open3d/io/ImageIO.cpp line 114 at r1 (raw file):

Previously, errissa (Rene) wrote…

Same spelling error - see above.

Done.

Copy link
Collaborator

@yxlao yxlao left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @errissa and @ZhengyuDiao)


cpp/open3d/io/ImageIO.h line 55 at r2 (raw file):

/// The function calls read functions based on format of image.
/// \return return true if the read function is successful, false otherwise.
bool ReadImageFromMemory(const std::string &image_format,
  • Use the \param tag to describe each parameter.
  • I would also specify what image_format can be in the doc strings.

cpp/open3d/io/file_format/FileASSIMP.cpp line 27 at r2 (raw file):

// ----------------------------------------------------------------------------

#include <png.h>

we can move this header to the image reader function, it should be possible to remove the header in fileassimp.cpp


cpp/open3d/io/file_format/FileASSIMP.cpp line 101 at r2 (raw file):

                    auto image = io::CreateImageFromMemory(
                            "png",
                            reinterpret_cast<const unsigned char*>(

Pointer cast can be static_cast. If static_cast works, prefer static_cast to reinterpret_cast.

Copy link
Contributor Author

@ZhengyuDiao ZhengyuDiao left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 5 files reviewed, 5 unresolved discussions (waiting on @errissa and @yxlao)


cpp/open3d/io/ImageIO.h line 55 at r2 (raw file):

Previously, yxlao (Yixing Lao) wrote…
  • Use the \param tag to describe each parameter.
  • I would also specify what image_format can be in the doc strings.

Done.


cpp/open3d/io/file_format/FileASSIMP.cpp line 27 at r2 (raw file):

Previously, yxlao (Yixing Lao) wrote…

we can move this header to the image reader function, it should be possible to remove the header in fileassimp.cpp

Done.


cpp/open3d/io/file_format/FileASSIMP.cpp line 101 at r2 (raw file):

Previously, yxlao (Yixing Lao) wrote…

Pointer cast can be static_cast. If static_cast works, prefer static_cast to reinterpret_cast.

static_cast doesn't work here.

@yxlao
Copy link
Collaborator

yxlao commented Aug 19, 2022

  1. Find jpg and png data from GLTF samples (clone the sample repo, find all .glb files, read all glb files and see if one of them is using jpg)
  2. Upload dataset to https://github.com/isl-org/open3d_downloads/releases/tag/20220301-data
  3. Add two datasets to cpp/open3d/data/Dataset.h cpp/pybind/data/data.cpp
  4. Add docs for loading this dataset in docs/tutorial/data/index.rst
  5. Add a unit test to load this dataset cpp/tests/data/Dataset.cpp, add additional test to ensure the texture is loaded

@yxlao yxlao merged commit f62d741 into master Aug 26, 2022
@yxlao yxlao deleted the zhengyu/mesh_io branch August 26, 2022 05:43
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.

3 participants