TripoSR icon indicating copy to clipboard operation
TripoSR copied to clipboard

How to dump .obj with texture.png instead of color on vertex?

Open SunzeY opened this issue 11 months ago • 17 comments

Blender only support std .obj format with unwrapped uv in a texture.png file. Is it possible to use trimesh to achieve this?

SunzeY avatar Mar 05 '24 06:03 SunzeY

  1. modify this code
  2. re-fit: fix shape and fit texture, very simple.

yuedajiong avatar Mar 05 '24 11:03 yuedajiong

@yuedajiong Could you show the code of this? I am trying the solution mentioned in here. But I am still having trouble writing the correct code...

SunzeY avatar Mar 05 '24 11:03 SunzeY

you can find code in pytorch3d: fit cube, etc. and you can use any other differentiable render to fit.

yuedajiong avatar Mar 05 '24 14:03 yuedajiong

blender works fine with vertex color models

https://github.com/VAST-AI-Research/TripoSR/assets/78346668/89f6572f-a1d0-435c-8208-99716f9bcf9b

mrbid avatar Mar 05 '24 18:03 mrbid

Do you know how to do it in Unity?

PatricioFernandezF avatar Mar 05 '24 21:03 PatricioFernandezF

Do you know how to do it in Unity?

Most default Unity Shaders do not support vertex colors, but Polybrush comes with sample Shaders which you can import into your Project. For more information, see Importing Polybrush Shaders. https://docs.unity3d.com/Packages/[email protected]/manual/modes_color.html#:~:text=Most%20default%20Unity%20Shaders%20do,information%2C%20see%20Importing%20Polybrush%20Shaders.

Otherwise you will want to project the Vertex Colors to a UV Map before importing to Unity.

mrbid avatar Mar 06 '24 05:03 mrbid

I have recently written a script to convert TripoSR exported .obj file into standard obj file with separated .png for kd_diffuse texture using Blender. Check it out if you have facing the same problem

SunzeY avatar Mar 09 '24 15:03 SunzeY

SunzeY's script works. Thank you for a great script.

stevens-Ai avatar Mar 09 '24 18:03 stevens-Ai

I created a Colab doc for anyone who wants to test the script out. Thanks, @SunzeY https://colab.research.google.com/drive/1-MNGiAnk8f_6mpmJP42OMzS8xGfG-Y39

mlo0352 avatar Mar 13 '24 14:03 mlo0352

I've created a small Unity project for integrating TripoSR in Unity: https://github.com/mapluisch/TripoSR-for-Unity/. It uses a custom obj importer for correctly parsing the vertex colors for a custom shader.

Feel free to check it out 😊

mapluisch avatar Mar 22 '24 20:03 mapluisch

I created a Colab doc for anyone who wants to test the script out. Thanks, @SunzeY https://colab.research.google.com/drive/1-MNGiAnk8f_6mpmJP42OMzS8xGfG-Y39

This one worked great for me! Thanks for sharing! <3

MNeMoNiCuZ avatar Mar 25 '24 13:03 MNeMoNiCuZ

blender works fine with vertex color models

But when i render the image , the color is none.

WuNein avatar Mar 30 '24 04:03 WuNein

blender works fine with vertex color models

But when i render the image , the color is none.

Please refer to this document: https://docs.blender.org/manual/en/2.79/sculpt_paint/painting/vertex_paint/introduction.html

Vertex colors can be painted by switching to Vertex Paint Mode; however, it will not show up in the render unless you check Vertex Color Paint in the Materials Options panel (for Blender Renderer). You can also the use Geometry Node to access vertex color information in the material node tree.

mrbid avatar Mar 30 '24 10:03 mrbid

i believe that 1 line of code would fix this, which is adding the trimesh.to_texture() method.

see https://github.com/VAST-AI-Research/TripoSR/issues/76 for details

rawwerks avatar Apr 11 '24 15:04 rawwerks