Jump to content

juggling material paths to get to texture map path [SOLVED]


Recommended Posts

I have a scene with 300+ imported FBX chunks of geometry. There are an associated 200+ unique materials.

 

What I want is to be able to scatter points on that geometry and have those points get the proper color from the texture map. I do get the shop_materialpath on the prims, which is a first step. And they do have proper UVs which is great.

 

But I've been banging my head against the wall trying to figure out how to procedurally get to the texture path from the shop_materialpath attribute.

 

Say the shader is /obj/fbx_import/SHOPS/material_1234

inside there is node /obj/fbx_import/SHOPS/material_1234/t7_pplastic with the attribute map1 (that's what I want).

It's the same simple structure for every material except the node with the texture changes name. Thankfully it's not the node named "shader output", and they're all of node type "v_fbx" if that helps.

 

Edited by kleer001
Link to comment
Share on other sites

if it's not easy to assume the v_fbx node name based on shader name or something, then you would probably have to go with Python SOP and for example get node from first input of material's suboutput node and get it's texture

(if the material was more complex, which I doubt as you are importing fbx, you would need to recursively follow that input till you find one or all v_fbx nodes and get one of their map1 )

 

or you can just use Python to rename surface shaders to correspond to SHOP nodes (which I think FBX exported from houdini already does) and then simply get textures in VEX

Edited by anim
Link to comment
Share on other sites

Thanks Tomas,

 

The shader names are based on the material name. Kicker is that the material names are repeated sometimes with numbers, sometimes without.

The important part of the cliff notes  go something like:

 

import re

re.sub("_materail*\\d*","_material_shader", shop_path)

 

Thats importing the regular expressions , then finding string matches with 0 or more digits behind them and replacing.

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...