Jump to content

texture information from Shader/primitive attributes [Solved]


Recommended Posts

Is it possible to find what file a Shader SOP is pointing to (using as texture map)?

I want to get information from a shader, which I would be able to put into my HDK standalone application. The attributes I am interested in using are 'shop_vm_surface' and 'ogl_shop' at the moment.

What I would want to access, is the texture map and information like Specular-, ambient- and diffuse-color.

When I look into each attribute above, all information I can get out of it, is '/obj/model/shopnet1/v_layered1', which, I assume, points to where the shader is held.

I looked around in the little documentation that exists, and looked in the 'TIL_TextureCache' and 'TIL_TextureMap', but they arent any help in this case, atleast as far as I can see.

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

[EDIT]

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   [ 0   locks=0 ] (   1   1   1   ) 
Cd   [ 0   locks=0 ] (   1   1   1   ) 
Cs   [ 0   locks=0 ] (   1   1   1   ) 
Cr   [ 0   locks=0 ] (   0   0   0   ) 
Ct   [ 0   locks=0 ] (   1   1   1   ) 
Alpha   [ 0   locks=0 ] (   1   ) 
apara   [ 0   locks=0 ] (   1   ) 
aperp   [ 0   locks=0 ] (   1   ) 
aroll   [ 0   locks=0 ] (   1   ) 
rough   [ 0   locks=0 ] (   0.05   ) 
lmodel   (   phong   ) 
tintedambient   (   "on"   ) 
dofresnel   (   "on"   ) 
fresnel_eta   [ 0   locks=0 ] (   1.3   ) 
refl_bias   [ 0   locks=0 ] (   0.01   ) 
map_base   (   J:/Fieldstone.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 CodeMasterMike
Link to comment
Share on other sites

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

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!

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