Export to GLTF, GLB

   207   5   0
User Avatar
Member
31 posts
Joined: Aug. 2012
Offline
Hi everyone...

There's a note on labs quick material that it's going to be removed in H23, and it'll be replaced by COP Preview Material...

What I am trying to do is export my models to GLTF/GIB format to use in other DCC apps as needed, but right now, I have to go through Blender to put them together.

COP Preview Material isn't showing me the textures correctly...quick material is...

I also tried to create a mtlx gltf material and can't seem to get the materials to show up

Can someone direct me the proper way to export so I don't have to use Blender to get what I want?

glb format preferred, but I can also do gltf as well
-----Neil
User Avatar
Member
15 posts
Joined: May 2025
Offline
Hi Neil,

Here's what I did.
In Houdini 22 there's a new option in the gltf loader. You'll find it under "Load", set it to material.
A new "Bake Material" button appears. Set an output matnet and it will bake a Principled Shader or MatX material in the matnet with all shading properties and textures it could map.

That's the principle. Next I created a HDA that does all the automation for me, and called it gltf_material_builder.
One press of the button builds all the materials and populates a Material Node with the material assignments etc. At that point your geometry has a fully principled shader setup and ROP gltf will work with material assignments.

I can't share it unfortunately, but the above should get you on the right track
User Avatar
Member
31 posts
Joined: Aug. 2012
Offline
johanboekhoven
Hi Neil,

Here's what I did.
In Houdini 22 there's a new option in the gltf loader. You'll find it under "Load", set it to material.
A new "Bake Material" button appears. Set an output matnet and it will bake a Principled Shader or MatX material in the matnet with all shading properties and textures it could map.

That's the principle. Next I created a HDA that does all the automation for me, and called it gltf_material_builder.
One press of the button builds all the materials and populates a Material Node with the material assignments etc. At that point your geometry has a fully principled shader setup and ROP gltf will work with material assignments.

I can't share it unfortunately, but the above should get you on the right track

Hi, thank you!

Here's the scenario...

I created a tree using labs tree generator... and I am wanting to export it.. what is the correct way to do that initial export where I get the textures when I use the gltf rop export before I bring it back in with the loader?

Also, when I switch load to Material, I get an error cannot import material with invalid id 0
Edited by frescalus - yesterday 08:37:04
-----Neil
User Avatar
Member
15 posts
Joined: May 2025
Offline
Maybe the export from labs tree generator isn't great to begin with. Houdini is not very flexible with malformed data. If you can try to export a gltf, with bin/textures separate it would be easier to see what goes wrong perhaps. Also make sure it does load and the possible missing extensions are handled correctly in the loader.
User Avatar
Member
31 posts
Joined: Aug. 2012
Offline
johanboekhoven
Maybe the export from labs tree generator isn't great to begin with. Houdini is not very flexible with malformed data. If you can try to export a gltf, with bin/textures separate it would be easier to see what goes wrong perhaps. Also make sure it does load and the possible missing extensions are handled correctly in the loader.

Ok, so... progress... I was able to create the mtlx gltf materials, and I was able to export them using the rop gltf output node and setting Image Export to Save to External File. It puts the textures in a base directory instead of say, Textures and save it as a .gltf

if I put the extension as a .glb and select Embed in .gltf, it creates a Textures directory, but doesn't put any textures in it, and I get warnings when importing saying cannot use an image embedded in the gltf as file textures. Same thing if the extension was .gtlf

Either way, I have to select Save as External File... and the goal is the embed them like Blender can do...

Once I bake the materials, I tried a 2nd rop, still didn't embed the textures.
-----Neil
User Avatar
Member
15 posts
Joined: May 2025
Offline
Maybe embed in gltf (the json definition) can only happen with base64 encoded strings in the gltf.
GLB is a binary zip file, that holds the gltf.json, bin (geometry blob) and the textures.
A .gtlf file is a text file, and it can reference textures from a folder, but also from embedded (as base64 encoded strings) data.

Not sure if that's the case here, as I always export GLB's where everything is embedded.
  • Quick Links