PDA

View Full Version : Breaking models into parts for texturing



ajith.mk
12-04-2015, 11:20 PM
Hi everyone,
I have a house designed in a 3d modelling software. It has some pillars, walls, a roof and a couple of windows. I plan to export it in .obj format and use in my code.

Now, since the house has different parts, I divided the whole mesh into corresponding parts and set uv coordinates for each of them separately. I have textures ready for them. Just as I was about to export it, it suddenly occured to me that I cant recombine them into a single model without messing UVs. Ofcourse, I can send them without combining and use it in my code, but technically there are 5 models where a single house model is supposed to be. Is this typical or am I doing it terribly inefficiently?

Carmine
12-05-2015, 06:03 PM
Whatever code you are using to do your modeling and UV assignments should be able to export the entire house model as one .obj file. As long as the vertices where 'parts' meet aren't welded, you'll be fine. Thus the model will have multiple vertices at the same location with different UV coordinates. This is standard procedure in modeling. Sounds like you have written your own code to display the .obj model? Is it reading the .mtl file that is generated with the .obj file? The .mtl file specifies which image(s) to use with each material, with different materials assigned to different groupings of polygons (faces in .obj terminology). Good luck.

ajith.mk
12-06-2015, 02:30 AM
Yeah... I am writing my own code to read .obj file. But now I realize I could save a lot of time if there are codes out there to do that. I will google and see if I can find any. Thanks for suggesting it.

Carmine
12-06-2015, 04:41 PM
For the fun of it, I tried to install 'tinyobj' on my iMac at home. Turned out to be pretty easy. Did not play with textures though.