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

Write directly to GLB from TGeometries #6404

Merged
merged 23 commits into from
Nov 1, 2023
Merged

Write directly to GLB from TGeometries #6404

merged 23 commits into from
Nov 1, 2023

Conversation

errissa
Copy link
Collaborator

@errissa errissa commented Oct 3, 2023

The following script can be used to test this PR:

import open3d as o3d

# Load the Monkey and give it some material properties
d = o3d.data.MonkeyModel()
mesh = o3d.t.io.read_triangle_mesh(d.path)
img = o3d.t.io.read_image(d.path_map['albedo'])
roughness = o3d.t.io.read_image(d.path_map['roughness'])
metallic = o3d.t.io.read_image(d.path_map['metallic'])
normal = o3d.t.io.read_image(d.path_map['normal'])
mesh.material.material_name = 'defaultLit'
mesh.material.texture_maps['albedo'] = img
mesh.material.texture_maps['roughness'] = roughness
mesh.material.texture_maps['metallic'] = metallic
mesh.material.texture_maps['normal'] = normal
mesh.material.scalar_properties['metallic'] = 1.0
o3d.visualization.draw(mesh)

# Save mesh as GLB and reload it as a triangle mesh to check geometry
o3d.t.io.write_triangle_mesh('/home/renes/development/intel_work/test_scripts/monkey.glb', mesh)
mesh_test = o3d.t.io.read_triangle_mesh('monkey.glb')
o3d.visualization.draw(mesh_test)

# Read into legacy as model which supports loading materials and embedded texture from GLB
model = o3d.io.read_triangle_model('/home/renes/development/intel_work/test_scripts/monkey.glb')
o3d.visualization.draw(model)

NOTE: The resulting monkey.glb should also be importable in Blender and look like:
2023-10-17-095734_1914x1026_scrot


This change is Reviewable

@errissa errissa requested a review from ssheorey October 3, 2023 01:45
@update-docs
Copy link

update-docs bot commented Oct 3, 2023

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

@errissa errissa marked this pull request as ready for review October 17, 2023 14:13
Copy link
Member

@ssheorey ssheorey left a comment

Choose a reason for hiding this comment

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

Looks good. 2 minor comments and we can merge.

cpp/open3d/t/io/file_format/FileASSIMP.cpp Outdated Show resolved Hide resolved
cpp/open3d/t/io/file_format/FileASSIMP.cpp Show resolved Hide resolved
@ssheorey ssheorey merged commit ed962e4 into master Nov 1, 2023
38 of 42 checks passed
@ssheorey ssheorey deleted the errissa/glb-writer branch November 1, 2023 21:57
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.

2 participants