Skip to content

Handle face subsets for OBJ #52

@andrewkaufman

Description

@andrewkaufman

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

Feature Description

OBJ/MTL supports per-face material assignment. I have attached an example cube with a different material for each face. Were this to be referenced in a URDF we should see those same face-colors via UsdGeom.Subset bindings.

Additional context or alternatives

cube.obj:

# Simple cube with 6 colored faces
mtllib cube.mtl

o color_cube

# Vertices
v -0.5 -0.5 -0.5
v  0.5 -0.5 -0.5
v  0.5  0.5 -0.5
v -0.5  0.5 -0.5
v -0.5 -0.5  0.5
v  0.5 -0.5  0.5
v  0.5  0.5  0.5
v -0.5  0.5  0.5

# Normals
vn  0  0 -1
vn  0  0  1
vn  0 -1  0
vn  0  1  0
vn -1  0  0
vn  1  0  0

# Bottom face -Z (red)
usemtl red
f 1//1 4//1 3//1 2//1

# Top face +Z (green)
usemtl green
f 5//2 6//2 7//2 8//2

# Front face -Y (blue)
usemtl blue
f 1//3 2//3 6//3 5//3

# Back face +Y (yellow)
usemtl yellow
f 4//4 8//4 7//4 3//4

# Left face -X (cyan)
usemtl cyan
f 1//5 5//5 8//5 4//5

# Right face +X (magenta)
usemtl magenta
f 2//6 3//6 7//6 6//6

cube.mtl:

# Cube materials - one color per face

newmtl red
Kd 1.0 0.0 0.0

newmtl green
Kd 0.0 1.0 0.0

newmtl blue
Kd 0.0 0.0 1.0

newmtl yellow
Kd 1.0 1.0 0.0

newmtl cyan
Kd 0.0 1.0 1.0

newmtl magenta
Kd 1.0 0.0 1.0

Code of Conduct

  • I agree to follow urdf-usd-converter Code of Conduct
  • I have searched the open issues and have found no duplicates

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

Status

In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions