NVIDIAGameWorks / kaolin

A PyTorch Library for Accelerating 3D Deep Learning Research
Apache License 2.0
4.47k stars 553 forks source link

Bug report on importing mesh. #734

Open sparse-mvs-2 opened 1 year ago

sparse-mvs-2 commented 1 year ago

I'm trying to bring in a mesh into kaolin, but I've discovered an issue with the kaolin.io.obj.import_mesh function. Specifically, import_mesh doesn't currently support OBJ files that include color information. If the OBJ file includes x, y, z, r, g, b values, the vertices in kaolin will contain RGB values.

Caenorst commented 1 year ago

Hi @sparse-mvs-2 , thank you for your interest in Kaolin. I quickly searched online and couldn’t find anything about per-vertex color in obj file format. Are those obj from a dataset?

sparse-mvs-2 commented 1 year ago

Yes. I use my own obj data.

Caenorst commented 1 year ago

Did you use a specific tool to generate those obj? this doesn’t seem to be part of the file format

sparse-mvs-2 commented 1 year ago

Usually it looks like this:

3dScannerApp.com

mtllib textured_output.mtl usemtl material_0 v -0.076 0.029 0.105 v -0.075 0.029 0.106 v -0.075 0.029 0.105 v -0.079 0.032 0.111.

But sometimes we can save the vertex color in each vertex (meshlab for example), then it looks like this:

mtllib test.mtl usemtl test v -56.695043 -8.185406 60.642260 0.082353 0.070588 0.039216 v -56.715019 -8.233994 60.633708 0.054902 0.047059 0.027451 v -56.706481 -8.231190 60.617203 0.121569 0.098039 0.054902 v -56.709433 -8.236841 60.670990 0.054902 0.047059 0.027451 v -56.716883 -8.263700 60.642537 0.066667 0.058824 0.031373 v -56.771020 -8.515039 60.600675 0.149020 0.117647 0.066667 v -56.795522 -8.522240 60.615212 0.086275 0.074510 0.043137 v -56.726744 -8.326732 60.678377 0.066667 0.058824 0.035294 v -56.724959 -8.364430 60.640271 0.070588 0.058824 0.035294.

The first three are the coordinate and the last three are rbg values.

Caenorst commented 1 year ago

I think that's an interesting property to support, to be noted that this is not part of .obj standard. I'll have a look to add support if that's important for the community.