jtydhr88 / sd-webui-txt-img-to-3d-model

A custom extension for sd-webui that allow you to generate 3D model from txt or image, basing on OpenAI Shap-E.
GNU Affero General Public License v3.0
262 stars 14 forks source link

Texture doesn't seem to be exported in obj #8

Closed laconicdesigns closed 1 year ago

laconicdesigns commented 1 year ago

When I import a model into blender, the texture that's in the preview window doesn't seem to exist. I don't think it's being exported.

AugmentedRealityCat commented 1 year ago

It's not a texture map: the colors are encoded as vertex maps instead. Those basically store RGBA values for each vertex on your model, and those values are then interpolated on the surface of each triangle to determine the color of any given area when rendering the 3d model. That's why you can see those colors even though there is no bitmap, and no UVs.

One advantage of this method is that it does not require any UV mapping coordinates: everyting is stored directly in the vertices themselves.

You can bake those vertex colors into UV texture maps using most 3d softwares out there. In Cinema4d, for example, you can use Bake Texture and Bake Object, as well as the baking set tools for Redshift, to transform vertex colors into proper bitmaps. Depending on the tool, you may have to create your UV coordinates (unwrap process) separately before baking.

The other thing to consider in your workflow is retopology: the mesh generated by the extension are very dense, and this is required to get your colors in high resolution since you are storing them as vertex colors - a bit like if each vertex was a pixel in a texture map: the more vertices you have, the better your vertex color map's resolution is.

jtydhr88 commented 1 year ago

Thanks for @AugmentedRealityCat detailed explaining!

laconicdesigns commented 1 year ago

Thank you. Yes the issue was just my own ignorance.

You can go into Layout tab in blender, then switch to vertex paint mode, and render view, and then you can see the colors.

I'll close the issue with this.