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

.obj colors look like points

Open f-rank opened this issue 1 year ago • 9 comments

Hi. Been using the extension for a while for the 3D inpainted mesh option, I used to import the resulting .ply into blender and colors looked ok. Did an update today and now it exports to .obj and I can't seem to be able to display the colors correctly. Probably missing something simple but a) the .obj is loading in another orientation, b) when I create a shader for it, it looks like pointillism.

Am using the wavefront importer, not the legacy one.

Can't figure out what I am missing exactly. Any help is much appreciated.

Here's an example of what I am getting.

image

f-rank avatar May 07 '23 20:05 f-rank

OBJ import works fine for me in blender 3.3 .. you can enable additional PLY generation like discussed in the other thread : https://github.com/thygate/stable-diffusion-webui-depthmap-script/discussions/210 and go back to importing the PLY file like before..

thygate avatar May 07 '23 20:05 thygate

OBJ import works fine for me in blender 3.3 .. you can enable additional PLY generation like discussed in the other thread : #210 and go back to importing the PLY file like before..

Thanks @thygate, just for reference case anyone happens to find what is off.

Am using blender 3.3.4, I enable the ply generation and it works. Didn't use the legacy importer. The mesh renders correctly using the generate videos option. Enabled the additional PLY and it loads ok in blender 3.3.4, damn shame the .obj loads way faster but not getting the color info to display straight, it looks sorta ok around the edges but borks out in the middle. It's like some weird UV thing going through a dishwasher black hole.

f-rank avatar May 07 '23 21:05 f-rank

Strangest part is I use the binary format for the PLY file, while Wavefront OBJ is ASCII. So the PLY is like 1/3 the size of the OBJ, and the read values can be copied straight into memory, yet it takes longer to load ..

The official Wavefront OBJ spec also doesn't include the option to store vertex colors, so the OBJ format the extension is outputting was based on how blender re-exports the PLY file ...

But the information stored in both files is the same, a list of vertices with color, and a list of faces indexing those vertices..

I'm still on blender 3.3.1, I should probably upgrade ..

thygate avatar May 08 '23 01:05 thygate

Same Issue in blender 3.5.1

image

Solved it also by using PLY files. Just for everyone who is new to this (like me): In your web ui go to Settings > Depthmap Extension > Save additional PLY file with 3D inpainted mesh. and tick the box. Don't forget to hit Apply Settings. After that you will get your PLY files, which work :)

image

wujood avatar May 08 '23 20:05 wujood

Both .ply and .obj don't have colors, only mesh in my blender, tried whole night, no result,

LanceGao97 avatar May 22 '23 16:05 LanceGao97

motherfuckers Oh, I got it OK, spend about 3 hours finding whats wrong, Just in case someone is not familiar with blender,
you have to set viewport lightning Flat, and Color---Attribute, so you can see the Colors from points, otherwise, you can only see MatCap or material color in viewport .

I tried OBJ and PLY, .PLY has colors, but that simple OBJ don't show any colors in Blender, I don't know if that (not simple) OBJ will have colors, but importing that one is waiting 5mins each, not very time friendly

LanceGao97 avatar May 22 '23 17:05 LanceGao97

@LanceGao97 Thanks for this, you saved me hours of time I'm sure.

If anyone comes along after this, if you are using the side by side photos instead of the .ply file, make sure you have viewport shading either rendered or material preview. Those buttons are in the top right and look like circles.

cbolich avatar May 23 '23 21:05 cbolich

@thygate How can the OBJ possibly work? I looked at the ASCII file and only Vertices and Faces are defined as best I can see. There is no color data in the file.

EDIT: Ahh I see what it is doing: "Some applications support vertex colors, by putting red, green and blue values after x y and z (this precludes specifying w). The color values range from 0 to 1"

This is what it is doing.

jwvanderbeck avatar Jun 26 '23 19:06 jwvanderbeck

@jwvanderbeck Yes, I know it's not part of the wavefront standard, but it is how blender exports vertex colors in obj too.

thygate avatar Jun 26 '23 21:06 thygate