Skip to content

Write directly to GLB from TGeometries - #6404

Merged
ssheorey merged 23 commits into
masterfrom
errissa/glb-writer
Nov 1, 2023
Merged

ssheorey merged 23 commits into
masterfrom
errissa/glb-writer

Conversation

@errissa

@errissa errissa commented Oct 3, 2023 •

Copy link
Copy Markdown
Collaborator

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

update-docs Bot commented Oct 3, 2023

Copy link
Copy Markdown

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

@ssheorey ssheorey left a comment

Copy link
Copy Markdown
Member

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.

@ssheorey
ssheorey merged commit ed962e4 into master Nov 1, 2023
@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