texture to color questions with attributefrommap

   775   9   1
User Avatar
Member
73 posts
Joined: April 2020
Online
Hello Experts,

If I understand the documentation correctly, I should be able to use attributefrommap to sample and transfer colors from a texture to point color. This seems to work for me if the texture is one I load in from the file system but *not* if the object already has texture. Clearly I'm doing something wrong, and the examples I've found online are only for nodes importing textures from the file system.

I include a .hip that uses the pig head as an example of a part with existing texture. I've tried fiddling with settings on the nodes, but no luck yet.

Part of my confusion, I think, is that although I see the shopnet path in the shop_materialpath attribute on the primitives in attributefrommap, I can't find where those materials actually live. I don't see anything in the shop network for instance. Where would I find them?

And finally, as a part of this dreadful situation, it is ultimately glb meshes I'll be importing. They have materials/textures, and I see those displayed correctly when I import them into other programs. But I don't see them in Houdini when I use the gltf node to bring them in. Shouldn't they show up? I'm clearly doing something wrong here too. The toggle for "Import Material Assignments" causes the shop_materialpath attribute to show up, but only with "/obj/materials/principledshader1" which doesn't seem helpful.

Any suggestions you can provide to help me get out of this swamp I seem to be in would be greatly appreciated! I include a .hip file of a small example.

Best wishes,
Mary
Edited by mgbaker - March 6, 2024 17:43:49

Attachments:
2024-03-06_1.png (41.0 KB)
color from texture.hip (309.8 KB)

User Avatar
Member
2537 posts
Joined: June 2008
Offline
The texture map itself does not create a Cd attribute on the pig head, thus the attributefrommap finds nothing. You still have to keep the attributefrommap node in Texture mode, but reference the texture stored in the HDA. Try placing opdef:..?lowres.jpg in the texture map field. This will fetch the texture map embedded in the pighead HDA. Set the Source Color Space to Linear to avoid the color shift.

I'm not sure how that works with glb meshes. Perhaps post one of those meshes that works in other software, but doesn't work in Houdini. You may have discovered a bug, or an unimplemented feature.
Edited by Enivob - March 7, 2024 08:48:50
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
73 posts
Joined: April 2020
Online
Thank you, Enivob! For the pighead I now see that I can view the texture names by going to the Extra Files tab of the Type Properties, since it's an asset, and the opdef reference makes sense. Thank you for helping with that.

However, when I do the attributefrommap using that texture, I still don't seem to map reasonable colors onto the points. I get one solid color, regardless of which of the pighead textures I try to use. Also regardless of whether I try to use a color texture channel or not. So I think I'm still failing to set this up correctly. Perhaps you know the secret?

As you kindly suggested, I also include a simple glb object with a single red texture that imports into things like 3D Builder, but not with the gltf node in Houdini. It should sit in the same folder as the .hip file. With glb I think the texture is embedded.

Any suggestions you might have about why I'm failing to bring in the texture would be most welcome. I am using Houdini version 19.5.435 if that makes a difference.

Thank you again,
Mary
Edited by mgbaker - March 7, 2024 13:03:30

Attachments:
color from texture.hip (417.4 KB)
red box.glb (4.7 KB)

User Avatar
Member
7771 posts
Joined: Sept. 2011
Online
mgbaker
Thank you, Enivob! For the pighead I now see that I can view the texture names by going to the Extra Files tab of the Type Properties, since it's an asset, and the opdef reference makes sense. Thank you for helping with that.

However, when I do the attributefrommap using that texture, I still don't seem to map reasonable colors onto the points. I get one solid color, regardless of which of the pighead textures I try to use. Also regardless of whether I try to use a color texture channel or not. So I think I'm still failing to set this up correctly. Perhaps you know the secret?

As you kindly suggested, I also include a simple glb object with a single red texture that imports into things like 3D Builder, but not with the gltf node in Houdini. It should sit in the same folder as the .hip file. With glb I think the texture is embedded.

Any suggestions you might have about why I'm failing to bring in the texture would be most welcome. I am using Houdini version 19.5.435 if that makes a difference.

Thank you again,
Mary

The glb loads for me with a red solid color. I used the gltf hierarchy node to unpack the embedded textures and load the scene graph within.

The attribfrommap scene with the pighead as an invalid image path for the texture map: (opdef:..?lowres.jpg) This is a relative path that is only valid within the pighead asset. When I change it to an absolute path, (opdef:Sop/testgeometry_pighead?lowres.jpg) the colors are correctly loaded from the map.
User Avatar
Member
2537 posts
Joined: June 2008
Offline
From what I can see, using the glft node by itself won't import the materials. For that, use the File/Import menu option. This makes a material subnet for you populated with a principled shader that you'll have to replace if you want to render using Karma XPU.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
73 posts
Joined: April 2020
Online
Thanks, jsmack and Enivob!

The pighead example now works perfectly and makes sense to me. That is much appreciated.

And using the info from you both I can now obtain the red cube and export it as 3mf with vertex color. Phew!

It seems I need to learn more about what goes on at the scene level. (I would never have thought of looking for a gltf import node outside of the geo node.) Since I use Houdini for creating parts to 3D print, I've never had to worry about how things render, lighting, etc.

Enivob, when you suggest using the File/Import menu option, is this the regular File sop? Or an option I'm not finding on one of the other nodes?

I will have to play with this, though, because all of the assets I create for automated workflows have been in the /obj/geo level. I've never tried to create an asset that includes nodes at the scene level.

My thanks again to both of you!
Mary
User Avatar
Member
73 posts
Joined: April 2020
Online
Oops -- I spoke too soon. The gltf node now imports the part with the red texture. But I'm still not referring to the texture correctly in the following attributefrommap. On the primitives in the gltf node I see the shop_materialpath "/obj/gltf_hierarchy1/materials/Single_Color_Texture" But that's the material, not the texture. How do I locate the name of the texture itself? The exported part merely looked reddish because that's some kind of default that is pinkish-red.

Thanks again for your help -- I hope I'm not driving you batty...

Mary
User Avatar
Member
7771 posts
Joined: Sept. 2011
Online
mgbaker
Oops -- I spoke too soon. The gltf node now imports the part with the red texture. But I'm still not referring to the texture correctly in the following attributefrommap. On the primitives in the gltf node I see the shop_materialpath "/obj/gltf_hierarchy1/materials/Single_Color_Texture" But that's the material, not the texture. How do I locate the name of the texture itself? The exported part merely looked reddish because that's some kind of default that is pinkish-red.

Thanks again for your help -- I hope I'm not driving you batty...

Mary

The gltf hierarchy node is an object level tool you can use to import gtlf/glb files. It's used at scene level, not geometry level. Pressing the build scene button will extract the textures in the glb file and save them next to it or in a custom location if set. Houdini cannot read the textures directly from the glb file, this is probably why you see missing texture pink. If you go to the material node, you should see the texture path on the material node in one of the parameters.
User Avatar
Member
73 posts
Joined: April 2020
Online
I see... It actually unpacks them as files into that folder. Since I get to set the folder name, and it seems the materials are given the name of the glb file (at least for these parts), I should be able to work with that for automation.

But I'm not sure about the general case, because I'm not sure I understand the bit about finding the texture path on one of the material node parameters. The material network node doesn't seem to have any parameters at all. And there is no material node -- unless I should add one? But I don't need to add more materials. I see the shop_materialpath on the primitive attribute for the principledshader, but that's not a filename. So I'm still confused about where Houdini actually keeps the file names of the textures it has unpacked.

Thanks again,
Mary
User Avatar
Member
7771 posts
Joined: Sept. 2011
Online
mgbaker
But I'm not sure about the general case, because I'm not sure I understand the bit about finding the texture path on one of the material node parameters. The material network node doesn't seem to have any parameters at all. And there is no material node -- unless I should add one? But I don't need to add more materials. I see the shop_materialpath on the primitive attribute for the principledshader, but that's not a filename. So I'm still confused about where Houdini actually keeps the file names of the textures it has unpacked.

The material node exists inside the gltf hierarchy subnet in the materials matnet. The texture path is right on the parameters of the principled shader.

Attachments:
redbox.png (876.0 KB)

  • Quick Links