Jump to content

Matariel export to Unity with FBX


Recommended Posts

  

   Hello mates i have a question... is that only me or does anybody has same promblem too? so , I am trying to export my scene/models to Unity with FBX export but my texture are not coming and i dont wanna deal with giving matariel in Unity for each model. 

I am using Houdini 16.0.504.20 and installed Unity Engine also and using Unity 5.6 and I created digital asset in Houdini on .hda format and aslo tried .otl too and they dont show up on Unity. 

So, i know these are two different questions but primary problem is exporting my models with textures with FBX , does Houdini support that like max? or nah? 

Link to comment
Share on other sites

I haven't done the straight FBX export outside of RBD stuff in a while, so some one else can chime in on that. It should work though...

As far as the HDA transfer of materials via Houdini Engine to Unity. This is what i have been using for the last few years. In H16 there is a "Houdini Engine" Shelf that has a shortcut to drop the Attribute create node, with a primitive string attribute called: unity_material, and the string example or relative/path/to/.mat/within/your/unity/project/including/the/.mat/extension.

The below is a simple tutorial you can skim through for more details on the subject with unity asset creations. There are example files to so you A and B what may be wrong.

 

  • Like 1
Link to comment
Share on other sites

 Hey LaidlawFx thank you for your message man. Actually i am using this method since few years also and i just remembered where i do wrong lol So, normally whenever i installed unity engine i was dragging unity engine script into unity from Houdini folder. I forgot the do that and that way Unity were not recognizing my hda or otl files. Now i solved that. But still having texture problem lol 

Link to comment
Share on other sites

OK this is what did...

Modeled in houdini , gave random uv and textured in substance then created gidital asset on hda format and add substance images also. When i import my hda file , texture is not coming. I have to apply matariel manually which i dont want. 

This way i am giving matariels in Max and exporting fbx from there. But this time i cant use my sliders for model. lol

Link to comment
Share on other sites

Ok so I got unity up and running. For my own amusement this post is for me to keep track of what i am doing, and encase anyone else comes across this.

I tried the straight FBX material method to expose the inherent export bugs/limitations.

I used Maya 2017 as a secondary test program besides Unity 5.6.0f3. For my example scene in Houdini I created a geometry node geo1, placed a testgeometry_rubbertoy1, I set the scale to 100 and TY to 66 (it's small in unity example scene) and began my exports. /obj/geo1/testgeometry_rubbertoy1. I tested with both fbx exporters the one in the File > Export > Filmbox FBX... or through /out/ with a Filmbox FBX rop so /out/filmboxfbx1.  I didn't try the script methods with these test as it's really the same code. I set the output file to $HIP/materialTestHoudini.fbx and selected the Export node to /obj/geo1.

For reference:

http://www.sidefx.com/docs/houdini/ref/windows/import_fbx

http://www.sidefx.com/docs/houdini/ref/windows/export_fbx

http://www.sidefx.com/docs/houdini/nodes/out/filmboxfbx

http://www.sidefx.com/docs/houdini/commands/fbximport

http://www.sidefx.com/docs/houdini/nodes/shop/v_fbx

From Houdini to Maya/Unity:

By default it will export a material link it appears for Maya with a diffuse texture but the material path is still the native HDA reference, plus the spec texture did not come across.

DefaultMaya.png

In Houdini HDA opdef:../..?toylowres.jpg to this in Maya opdef:/Sop/testgeometry_rubbertoy?toylowres.jpg

So I allowed editing on the rubbertoy and saved out the texture to $HIP/toylowres.jpg, and changed the link to that from the above and the color texture comes across.

DefaultMayaHoudiniPath.png

Albeit, while a few textures come across this is certainly not a good material exchange accept for some really basic parameters, the phong shader was selected with houdini specular lighting model, and incandescence was map from subsurface color, this seems to be a bit of material limit. Substance definitely is a better method.

So in unity the material link does come but definitely not materials as you said.

DefaultUnityHoudiniPath.png

So what we did at most studios was write a script that would at least take this materials link and do a look up and replace the material to something pre-built. But that is all ways a pain, and a studio one off.

I tried next to just export this same exact model from Maya to Unity, and it failed too. Which this should work, however... it's lunch time so i'll edit this when I get back.

...OK so I was looking into why the texture issues happens in Maya too with FBX, I found this blender post and it makes sense. 

http://answers.unity3d.com/questions/124817/why-is-my-imported-fbx-file-not-showing-textures.html

Mischa is right, FBX does not export textures and you have to import them into your Unity Scene, but if done right you can reload your FBX and do not have to manually assign them to the materials. They will find the links with the right materials.

I always have my folder setup like this: Assets/MyModels/ModelName/ FBX imported file which creates a materials folder, I add a textures folder, my 3d model also pulled the textures out of a textures folder next to the model. after I dump the textures in the textures folder I reimport the FBX and wolla! all the textures are assigned.

So this will probably work in the end too with Houdini Textures. Need to give it a go, but if I'm thinking right this will be the same with Houdini Engine.

BINGO! Take that FBX! The whole material parameters don't map, but that goes back to common mapping issues, and why substance is the bomb.

FBXMaterialVictory.png

Edited by LaidlawFX
Back from Long Lunch...
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Just to add my $0.02, I have recently been trying to get Houdini to replace Substance Designer so it could be used as a complete one-stop-shop, and came the following conclusions:

1) You need to bake the textures and import them into Unity in order to build a Material.  They won't transfer within the .FBX.

2) Houdini won't bake the correct Metal/Smoothness texture as it's encoded in Unity with metal in red and smoothness in alpha.  In order to get that you need to modify the Principle Shader for each Houdini material.  I built a custom shelf tool to do this and it worked pretty well.

3) To add edge-wear effects and other effects you need to modify the material and it's much harder to do than using SD.

So I gave up.  I now just bake a color id map (unlit basecolor) for use with a Substance using primary colours.  SD can bake additional maps and this allows much more "post production" modification even within Unity (depending on how much you expose from your Substance).

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...