Page 1 of 1

FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 6:36 am
by MathiasJ
Just started using this great tool and it has made my instancing so much easier. Thanks!
Ran into an issue when instancing FBX files with UV textures though (e.g. Megascans plants, rocks etc.) which I've tried to fix for a few hours now with no luck.
The material displays in the viewport after instancing, but then in the final render it just displays a basic material with no diffuse, roughness, normals, alpha etc.

Are FBX files not supported by MOPs or am I doing something wrong?

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 7:36 am
by toadstorm
I haven't worked much with Megascans assets so I'd just need to know a few more details about how you're handling the instancing.

How are you importing the FBX data? Are you importing the file to /obj first and then merging it into SOPs, or are you doing it some other way? Where is the material assignment being done... do the FBX object containers have materials assigned, or do you have a shop_materialpath attribute on the primitives?

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:13 am
by MathiasJ
Heya. Thanks for the reply.
Tried attaching a simple HIP file to show you but it was too big to upload.
I import the FBX into a Geometry node, then setup Principled Shaders pointing to texture maps and use the shop_materialpath to apply materials to primitives using the Material node and wire it into the MOPS_Instancer node.

I've previously tried doing the object merge as well. Also tried using the MOPS_Convert node before the Instancer but dunno if that's even what's it used for. Also tried a regular Pack node before.

Before finding MOPs I used the regular H18 instancing method using the Copy to Points node with 'variants' where I had the same issue so not sure if I am doing it wrong, or if it's an FBX limitation in Houdini, but that would just seem like way too big an issue for studios etc.

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:17 am
by toadstorm
Try this... on your Mantra ROP there should be an option called "Declare Materials". Set that to declare all materials in your IFD. It's possible Mantra just can't figure out what materials should be included in the IFD because of the way they're applied. Let me know if that changes anything.

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:25 am
by MathiasJ
Attached an image to make sure I got the right option?
I tried setting it to 'Save All Materials and Shaders.' Didn't work sadly.

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:31 am
by MathiasJ
I got it working! You were right about Declare Materials. Houdini just didn't cook it, so I had to disable/enable the node and the textures are there now :) You have no idea how relieved and happy that made me hah. Thanks!

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:35 am
by toadstorm
Ah, perfect! Yeah this is a bit of a flaw in the packed primitive workflow... if it isn't obvious to Mantra where your material definitions are, it'll just skip them unless you embed everything. You can also dodge this problem a little more efficiently by using stylesheets to assign materials, but you'll have to learn that whole system.

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:39 am
by MathiasJ
Right, that makes sense.
What do you think I should search for, for that stylesheet technique?
I've used them before to apply a default shader to all objects for lighting scenes but not like this.

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:43 am
by toadstorm
If you want the deep dive: https://vimeo.com/262883554/description

Re: FBX displays material in viewport but not in render

Posted: Tue Jun 02, 2020 8:44 am
by MathiasJ
Cheers :) I'll be sure to recommend MOPs to others.