Jump to content

have point attributes control shader parameters?


mstarktv

Recommended Posts

Like the title says. I'm trying to kind of make my way through the SHOP context, but my biggest problem is accessing information from the actual geo.

I made a fairly simple scene where I am running a sin over the sphere's @pscale. In this case I'm just trying to have the @pscale control the principal shader's emission amount. 

I tried making an attribute VOP where I bind the @pscale to a bind export and then named it "lit".

After this point I can't fin an answer online how to access and connect that attribute to the emission. I know it has to be the easiest and most obvious node, but I can't seem to find the answer. All help is much appreciated!Screen Shot 2016-10-03 at 5.26.42 PM.png

size_lit.hipnc

Link to comment
Share on other sites

From just playing around with it briefly, change your naming from lit to emitint (it will point to the emission intensity in your shader since that is the name of the parameter). Also, turn off pack geometry on your copy....It doesn't seem to work with that on.

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, rbowden said:

From just playing around with it briefly, change your naming from lit to emitint (it will point to the emission intensity in your shader since that is the name of the parameter). Also, turn off pack geometry on your copy....It doesn't seem to work with that on.

 

Ah, okay, so doing this method I don't even have to dive into the subnetwork(of the shader) if I'm doing something this simple. I can just use the shader's attribute name (or whatever you would call it). 

Thanks, Ryan! 

1 hour ago, davpe said:

in shop network put down a parameter node. type in the name you want to access and select the type from dropdown menu. that's it. then you can connect it to whatever you want.

Dave, I tried doing this but I need a little more guidance, when you say "name" what do you mean? Also, thanks for the reply!

Link to comment
Share on other sites

well I mean, you have created an attribute with some name, right? like "lit" in your case.

now it should be part of your geometry. you can check whether it really exists in Geometry spreadsheet. if it does it means you can call its name to access the data.

when the name is called in shader (by creating a parameter node and typing its name into a box called "name") it is picked up and you can use it. Also, your attribute can be several types. integer, float, vector, string - those are most common. so you have to know what type have you created and specify that in parameter node (because you may have more attributes of the same name but different types).

check the attached scene.

read_attribute_in_SHOP.hip

  • Like 1
Link to comment
Share on other sites

23 minutes ago, davpe said:

well I mean, you have created an attribute with some name, right? like "lit" in your case.

now it should be part of your geometry. you can check whether it really exists in Geometry spreadsheet. if it does it means you can call its name to access the data.

when the name is called in shader (by creating a parameter node and typing its name into a box called "name") it is picked up and you can use it. Also, your attribute can be several types. integer, float, vector, string - those are most common. so you have to know what type have you created and specify that in parameter node (because you may have more attributes of the same name but different types).

check the attached scene.

read_attribute_in_SHOP.hip

Ahh, this cleRadars things up. I guess you answered what I was doing a terrible job at asking - as long as I create an attribute, the shader can read it (as long as I specify which attribute). I was assuming that the shader was essentially blind unless I did some other step. Just to clarify, does this work as long as have an attribute? Or do I have to use the bind export to be able to pass it along?

Link to comment
Share on other sites

you need to have an existing attribute to use it, of course. but you don't have to use bind export. many attributes are called in the shader automatically because they are existing on any geometry by default (like position, normal, point color, depth, etc.). these are collected in node called "surface globals". so these are "for free" and ready to use without any steps in between. but if you want to create your own attribute, you have to use bind export (or one of many other ways how to create an attribute) which basically allows exporting values outside of the current VOP network so you can see them in Geometry spreadsheet and call them.  

  • Like 1
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...