Find Texture map in primitive attributes [Solved]

   4642   3   0
User Avatar
Member
26 posts
Joined: March 2008
Offline
When working with HDK, I would like to access the shader(texture) information. The attributes I am interested in are ‘shop_vm_surface’ and ‘ogl_shop’ at the moment.

I can find each primitive attribute, and get the Surface (/obj/model/shopnet1/v_layered1), but how and where will I get the actual file-adress to the texture file that is being used, and ambient, specular and Diffuse colors?

I looked around in the little documentation that exists, and looked in the ‘TIL_TextureCache’ and ‘TIL_TextureMap’, but they are all empty.

So can I get to the information that ‘shop_vm_surface’ and ‘ogl_shop’ attributes are storing from the HDK?

I am using a standalone *.exe file when working with the HDK
Thanks.


Looking inside a *.hip file, I come across this:

obj/model/shopnet1/v_layered1.parm{
version 0.8
op_folder_tabs ( 0 0 )
std_switcher_0 ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
Ca ( 1 1 1 )
Cd ( 1 1 1 )
Cs ( 1 1 1 )
Cr ( 0 0 0 )
Ct ( 1 1 1 )
Alpha ( 1 )
apara ( 1 )
aperp ( 1 )
aroll ( 1 )
rough ( 0.05 )
lmodel ( phong )
tintedambient ( “on” )
dofresnel ( “on” )
fresnel_eta ( 1.3 )
refl_bias ( 0.01 )
map_base ( JFieldstone.tga )
apply_base ( d )


I dont know if this mean it would be stored somehow in some ‘parm’ or so?
Looking at the long list, it seems to be same information as you would find in “Parms” in the shader network. But I dont really know…
Edited by - April 3, 2008 04:24:22
You cant recycle wasted time
User Avatar
Member
26 posts
Joined: March 2008
Offline
A subquestion that might answer the first one;

How do you access parameter (Parm) information from HDK?

Searching through GuDetail, I dont find any form of function that solves this. And looking through PRM_Parm, PRM_ParmList or OP_Parameters didnt help me much either…
You cant recycle wasted time
User Avatar
Member
26 posts
Joined: March 2008
Offline
So after a long time of trail-and-error and a mail to the Houdini Mailing list, I finally got a answer to howto get this to work (All my thanks to Dave!):

In Houdini SHOP, you must un-check the “use indirect references” option.
By doing this, it will change the Primitive attributes from shop_vm_surface to vm_surface.

And then you can access the much needed data.


// Get the Attribute
GB_AttributeHandle Attribute = GuDetail.getAttribute(GEO_PRIMITIVE_DICT, “vm_surface”);

// Get the string with all the parameters
UT_String ShaderString;
Attribute.getString(ShaderString);


The ShaderString will have all the parameters in one long string.
To get out the information you should use some kind of function that can split up the string. I personally use strtok() function [cplusplus.com]

My way to do that is the following:


// “Steal” the string, so we have it as a char instead of a UT_String
char *pStolenCharString = ShaderString.steal();

// Create a temp char
char *pStrTokChar;
// This shows the function to split when it finds a blankspace (“ ”)
pStrTokChar = strtok(pStolenCharString,“ ”);

while(pStrTokChar != NULL)
{
// Here we get out the current string from the main string, or a “token”
pStrTokChar = strtok(NULL, “ ”);
}


And then you can do whatever you want with the information you get out!
You cant recycle wasted time
User Avatar
Member
29 posts
Joined: Sept. 2007
Offline
Hi, I have a related issue, maybe you have an idea:
I need to move a file with many texture nodes from windows to osx, so the paths (script-generated) for each texture in the uvquickshade sop has to be adapted (basically remove “D” and replace it with “/” to match the root of the mac).
Any idea how to automate this? if it helps, I have JEdit to edit code, so I fire a find&replace “Dfolder/subfolder/” with "/folder/subfolder/' and when I save the file and try to open it again, most of the sops are out.
I also know the exact names of the uvquickshade sops.

Would be great if you'd have an idea..
Thanks!
Gon
  • Quick Links