stable-diffusion-webui-depthmap-script icon indicating copy to clipboard operation
stable-diffusion-webui-depthmap-script copied to clipboard

Loading obj and png in Blender

Open jaggzh opened this issue 2 years ago • 7 comments

Is there a way to load this into blender?

  • I can load the .obj, and the outputs produce the depthmap png.
  • I see the colorized mesh in the 3d mesh tab the webui ...But I don't have a colored texture in the outputs.

So:

  1. How do we get a textured .obj (or the texture itself)?
  2. How do we map it onto the obj? (I am familiar with nodes in blender)
  3. (How do we handle the camera params? I see the .obj has h and vfov)

SS_20231022_222531

SS_20231022_223531

jaggzh avatar Oct 23 '23 05:10 jaggzh

In looking at the code it appears it does infill calculation for each frame of video; so there's not some single-texture to map onto the mesh object.... Darn. :}

jaggzh avatar Oct 23 '23 11:10 jaggzh

you can do it. I have done it. I'm not at Blender right now, but I think you use vertex color to apply your image properly.

mbloflin avatar Nov 13 '23 18:11 mbloflin

You need to select Color Attribute | Color for the Base Color of the mesh (see the red rectangle in the image). ksnip_20231209-010625 For me, this works just fine for the Simple mesh. But for the Inpainted Mesh it does not work as expected (see above). I don't know why, but I found that the trimesh package is used to export to .obj for the Simple mesh, but for the Inpainted mesh a custom written export is used: https://github.com/thygate/stable-diffusion-webui-depthmap-script/blob/b8120b41a9223796ba42393c0c07ba90870cddd0/inpaint/mesh.py#L2160-L2168

KlenM avatar Dec 08 '23 23:12 KlenM

You need to select Color Attribute | Color for the Base Color of the mesh (see the red rectangle in the image). ksnip_20231209-010625 For me, this works just fine for the Simple mesh. But for the Inpainted Mesh it does not work as expected (see above). I don't know why, but I found that the trimesh package is used to export to .obj for the Simple mesh, but for the Inpainted mesh a custom written export is used:

https://github.com/thygate/stable-diffusion-webui-depthmap-script/blob/b8120b41a9223796ba42393c0c07ba90870cddd0/inpaint/mesh.py#L2160-L2168

Hey, did you ever figure this out?

The .ply export option does have correct color mappings, but the .obj mesh option has this glitchy, grainy look to it for me as well.

aulerius avatar Mar 18 '24 12:03 aulerius

Sadly, no, I haven't worked on this issue.

KlenM avatar Mar 18 '24 13:03 KlenM

Sadly, no, I haven't worked on this issue.

Just now I tested importing these .obj into something else (TouchDesigner), and there the colors actually map correctly. So it may be something to do with the blender .obj importer after all.

aulerius avatar Mar 18 '24 13:03 aulerius

i ran into this issue but clearly its a blender only obj bug, ply works. Replicated the issue in blender only, by subdving a cube 3 times and then dupped a few vertices (4 or 5 or 6 vertices) to be faceless-edgeless, vertex painted a bunch, exported and reimported and this is the result. Ill try to open a bug report in blender repo.

*PS. Added a report into that bug. https://projects.blender.org/blender/blender/issues/117367#issuecomment-1257731

objbug

frustaci avatar Aug 03 '24 18:08 frustaci