houdini .obj and .mtl files

   33948   22   2
User Avatar
Member
77 posts
Joined: April 2009
Offline
i've purchased a professional 3d model. it is offered in .obj format with a .mtl file. of course the texture and alpha files are also included.

anyway, i cannot find where in the manual how to import an obj file with texture maps placed.

surely sidefx has support for such a common file format. :shock:

so far i can only import the obj without textures.
User Avatar
Member
12429 posts
Joined: July 2005
Offline
Nope, Houdini doesn't support .mtl files. You're going to have to apply your own shader reading those textures to your object, I'm afraid.

Quite honestly, I've never seen an .mtl file with anything of any value in it. How many material assignments do they contain in the case of your file you're trying to import?
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
77 posts
Joined: April 2009
Offline
sigh. i sense elitism.

of obj, textured, is not supported, then what is :?:

for example, turbosquid.com. from their home page

'On average, customers save over 20 hours of modeling time when they buy a 3D model.'

each seller is different, but frequent offerings are 3ds, max, and obj.

what COMMOM formats ARE supported as TEXTURED imports :?:



User Avatar
Member
1390 posts
Joined: July 2005
Offline
The point is that mtl is very limited format merely supporting most basic material properties good for games and maybe viewports, what doesn't fit well into a programmable shading pipeline of Mantra kind.

Implementation would imply a single MTL shader supporting these properties. If you know anything about Houdini's shading pipeline, you noticed how limiting and unpractical such approach is. No use for it for Houdini's users.

Nevertheless FBX importer of Houdini supports materials, even with embedded textures. So there is a hope for you

cheers,
skk.

PS Implementing mtl could be quite easily to achieve by yourself with a little Python scripting
User Avatar
Member
57 posts
Joined: May 2007
Offline
The free Autodesk fbx converter should be able to convert that obj with material file into fbx. The Houdini fbx import will import the resulting file with basic materials.
User Avatar
Member
57 posts
Joined: May 2007
Offline
If you have issues with rendering the fbx file with materials you may want to have a look at the fbx wierdness thread here:

http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=15254 [sidefx.com]
User Avatar
Member
77 posts
Joined: April 2009
Offline
is it inferred that FBX is the only supprted format that will include textures?

i'll give the autodesk converter a shot. thanks for that tip! 8)

i really do not know that much about the rendering pipeline, but the fact remains that commercially sold .bgeo or .geo models or assets are very very scarce.

as a student or hobbyist, ones design team is … limited. :LOL:

given that, if i can purchase a model or two that have the uv pelting complete and include a high and low poly version, THAT I CAN IMPORT, then i am hours or days ahead of the game. period. :roll:

there is a HUGE amount of 3d available, that could be used in houdini if more common formats were supported. digital duct tape and juryrigging aside, this is common sense.

student / hobbyist usage converts to professional usage. what one learns to use in school / spare time is what one eventually uses professionally. the more professional usage of houdini leads to more purchases of houdini which leads to good times for all houdini users! it is an upwards spiral!
sidefx understands this as evidenced by the existence of an ‘apprentice’ version of houdini.

rant complete. think i'll go take my meds now.

now, off to google to find the obj to fbx converter.
User Avatar
Member
12429 posts
Joined: July 2005
Offline
smaugthewyrm
sigh. i sense elitism.

of obj, textured, is not supported, then what is :?:

No, not at all! I've used bazillions of .obj's in Houdini but oddly enough never ever seen or recvd a single one with with texture maps specified in the .mtl file. Generally if I have gotten a texturemap with an .obj, it's been one single map that can be slapped onto the object in Houdini with two clicks. (You know that texture coordinates are properly imported, right?)

Either I've just been lucky, or I'm not educated in the wonders of modern .mtl files.

Out of genuine curiosity I'd like to see what a compound .obj with detailed .mtl files you are wanting to import. Are you using a free model set I can download and just check out?
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
77 posts
Joined: April 2009
Offline
jason_iversen
smaugthewyrm
sigh. i sense elitism.

of obj, textured, is not supported, then what is :?:

with two clicks. (You know that texture coordinates are properly imported, right?)

Either I've just been lucky, or I'm not educated in the wonders of modern .mtl files.

Out of genuine curiosity I'd like to see what a compound .obj with detailed .mtl files you are wanting to import. Are you using a free model set I can download and just check out?

i did not know that coordinates are imported. DOH! is there a tutorial or breakdown that illustrates the process?

well, hopefully the lawyers will take into account research and development interests when they are drafting their letters… :shock:

-snip-

here is a high poly human female: obj, mtl, and textures.

if this can be imported, with all textures in place, somehow, then all models of lesser complexity will be simple.

one could then place some dynamic clothing, hair and setup an IK network for animation…



additionally, i found a fairly complex, free model offered in fbx and obj. would be good for testing and R&D.

http://www.turbosquid.com/3d-models/spartan-female-amazon-3ds-free/355557 [turbosquid.com]
Edited by - May 27, 2012 11:46:04
User Avatar
Member
710 posts
Joined: July 2005
Online
If the model had groups (that corresponded to the textures) then it would be fairly painless to assign the correct textures to the correct parts, albeit not automatic.
User Avatar
Member
12429 posts
Joined: July 2005
Offline
Thanks for that example! I see what you mean now; I've never seen such a complete delivery using .obj as it's format. Live and learn, huh?

I see how you'd want those “usemtl” statements in the obj to be made into groups, and then those groups materialled correctly. Currently they seem to be ignored, and even looking at the options for the geometry conversion program “gwavefront” don't seem to allow the manual specification of a flag to make that happen.

However, I'd hope that an FBX conversion might make this more likely to work for you, since FBX seems to be the “new standard” for complex assets … it must be hard for SESI to consider upgrading their .OBJ support, unless they hear more requests for it.



USAGE: gwavefront inFile outFile
Where one of inFile/outFile has the extension .obj and
is in Wavefront file format. The other file should be a
format understood by the geometry library
This program will convert the obj file to the other format
or convert the other format to a .obj file
-d Explicitly use the name ‘default’ as the default group.
Fixes problems for other apps which need this (eg. Wings3D).
-l <lod> Uniform level of detail for conversion to polygons
-s <u> <v> Convert to polygons using given divisions per span.
-t Force texture attribute to be attached to points
-u Force points to be unique - this helps with multiple
texture coordinates per point
-r Do not reverse primitives. Primitives are reversed by default.

The -t option is basically equivalent to the -u option
that uniquing will only be done if texture coordinates exist.
This ensures that the attribute will be correctly mapped
NOTE: When converting to .poly or .bpoly format, the -t
option should be used. As well, normals are always attached
per point, which means that the -u option should be used if
there are different normals per position vertex in the .obj
Version 10.0.265

Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
1390 posts
Joined: July 2005
Offline
smaugthewyrm
i did not know that coordinates are imported. DOH! is there a tutorial or breakdown that illustrates the process?

Oh, so more then a properties like specular or diffuse color you were interested with uv coordinates? Than, like already said, they are saved in obj along with groups. We couldn't stand single day without it, since obj remains main exchange geometry format in many studios

cheers,
skk.
User Avatar
Member
77 posts
Joined: April 2009
Offline
SYmek
smaugthewyrm
i did not know that coordinates are imported. DOH! is there a tutorial or breakdown that illustrates the process?

Oh, so more then a properties like specular or diffuse color you were interested with uv coordinates? Than, like already said, they are saved in obj along with groups. We couldn't stand single day without it, since obj remains main exchange geometry format in many studios

cheers,
skk.

so, SYmek, as OBJ is the main exchange geometry format, please see my sample above and, if you please, show use H-noobs the obj. light!



how to import an obj and reveal the textures that came with it.

please….
User Avatar
Member
1390 posts
Joined: July 2005
Offline
smaugthewyrm
SYmek
smaugthewyrm
i did not know that coordinates are imported. DOH! is there a tutorial or breakdown that illustrates the process?

Oh, so more then a properties like specular or diffuse color you were interested with uv coordinates? Than, like already said, they are saved in obj along with groups. We couldn't stand single day without it, since obj remains main exchange geometry format in many studios

cheers,
skk.

so, SYmek, as OBJ is the main exchange geometry format, please see my sample above and, if you please, show use H-noobs the obj. light!



how to import an obj and reveal the textures that came with it.

please….


There is no solution to apply textures automatically on objs. You have to do it by hand or script (select group apply shader with texture).

I meant that OBJ is a geometry exchange format not a material one. I don't know any sufficient material format independent from application. In standard pipeline, you get geometries from different sources, from modeling dep. or animation (baked mesh), then shading/lighting/rendering happens in one environment also for that very reason, that it's hard to translate materials between different apps.

mtl is far less then a shader. it's more them a pallete of values. Since ther is no standard material in Houdini.parsing such file is pretty arbitrary, doable though. I used to did this while had to import 1000 textured planes from XSI. Never again.

skk.
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
I can't see any reason that an .mtl > houdini importer couldn't be written in python…
all the info is there…
the mtl gives you basic shader info:
newmtl myShader
illum 4
Kd 0.63 0.40 0.35
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 1.00
Ks 1.00 0.74 0.59
map_Kd MyTexture.tif
map_Bump MyTexture_Disp.tif


and the obj has references to groups and materials:
g MeshName:GroupName
usemtl myShader
f 88457/125729/171786 88458/125730/171787 88473/125746/171788
f 88458/125730/171787 88459/125731/171789 88473/125746/171788
f 88459/125731/171789 88460/125732/171790 88473/125746/171788
f 88460/125732/171790 88461/125733/171791 88473/125746/171788
f 88461/125733/171791 88462/125734/171792 88473/125746/171788



just run through the mtl file and make a shader every time you see “newmtl” and fill in the parameters…
then make a material(s) and assign it to the groups…
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
77 posts
Joined: April 2009
Offline
arctor
I can't see any reason that an .mtl > houdini importer couldn't be written in python…
all the info is there…
the mtl gives you basic shader info:


just run through the mtl file and make a shader every time you see “newmtl” and fill in the parameters…
then make a material(s) and assign it to the groups…

uh… this is the APPRENTICE FORUM. LOLz

so if i take my cpu to the reptile region of our zoo, they will hiss on the textures?

-droll, i know-

i, and many noobs, are hopeless in python programming language.

i think 1 step of the manual assignment process would be doable. please, if possible use the shared obj example in this thread.

i imagine the process is, read the mtl, look for the shader name and jpe name, create a node of somekind in shop, and place those names in the node… somewhere… i imagine the uv group name should also be in the mtl, and possibly the orientation. then i assume that shader node would have to be dragged over the obj in question. next, repeat. etc…
User Avatar
Member
12429 posts
Joined: July 2005
Offline
I agree you you, Smaug - it should be written by SESI and placing the File>Import menu if it were going to perform a proper import. And yeah, it's not terribly hard (for someone who can code).
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
smaugthewyrm
uh… this is the APPRENTICE FORUM. LOLz

well..new to Houdini doesn't mean new to python….

but Jason is right…this is a very simple thing that SESI should try to implement…Import OBJ + optional .mtl file.
optional for obvious reasons…
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
1 posts
Joined: Aug. 2018
Offline
I'm sorry, but no one has answered the original question with a straight forward direct answer. Does anyone know this, or not?

How do I import an OBJ file with it's textures/materials into Houdini?

For example, I am trying to import an OBJ file of a plant and it's attendant MTL file (available for free from xFrog) and I want it to come in with all of the textures. Is there a straight forward step by step tutorial somewhere on how to do this or not?
User Avatar
Member
20 posts
Joined: Sept. 2012
Offline
I made a quick and dirty script [github.com] for transferring colors from .mtl file to geometry polygon attribute.
  • Quick Links