Jump to content

painting an attribute to be multiplied by a map instead of overwriting


Recommended Posts

Hi.

I sometimes like to paint an attribute on the geometry and then apply those values to one of the shader parameters...say refr_int, for instance to control refraction.

 

Now, if I do this I´m overwriting anything going on with the shader parameters regarding to that value. If I add a map there it´s not working along with the value.

I understand I can dive into the shader, and from there bring in my original attribute with a bind and multiply it by the map, but is there a direct way of doing this without having to dive into the shader? I don´t think the shader will accept any local attribute from my geometry...

Edited by Netvudu
Link to comment
Share on other sites

You mean like @refr_int*@customattrib at SOPs? Have you actually tried this?

To my understanding this won´t work. I´ve tried it but maybe in a wrong way... I can´t ask for the shader value at SOPs because the shader isn´t evaluated until render time, so if I add @refr_int (the shader attribute) at SOPs I will get an error. If I create such an attribute myself we are back at square one because I´m overwriting the value.

 

I can´t query the result of the shader attribute either because it´s dependant on a map, so once again, it isn´t calculated until render time.

That´s why I asked, if you have tried this yourself....maybe I´m overlooking something or didn´t undertand your idea properly?

Edited by Netvudu
Link to comment
Share on other sites

It´s not that I can´t do it in shader. But I´m using the Mantra Surface shader, and a lot of its options (so doing my custom shader with all that would take a while) but as you know tweaking the mantra surface shader ain´t exactly comfortable. It has gotten better than before (back, when it was an impossible maze) but it still far from elegant.

I guess I will end up doing that and tweaking it.

Link to comment
Share on other sites

It is, but for some reason, when I override the intensity value at SOPs it somehow takes it as the final rendering value and stops multiplying it by the map...or at least that what my tests look like. Is it a bug?

Edited by Netvudu
Link to comment
Share on other sites

you'd have to use a "ch()" function to grab the parm from the shader.  probably easiest to add a spare to your sop called "mat_refr_int" and then do 'ch("mat_refr_int")' in your vex code to query it.  then in your spare, you can reference your material value (ch("material_name/refr_int").  better to do it in two steps so you can make sure you get the reference to your material working properly (ie, it's not "0").

 

if you need to tint the map with a vector, you're probably out of luck.  the refr_int is only a single float so you can adjust overall intensity, but not tint.  when you select a map, you switch off the color parm in favor the map parm, but the intensity should still affect things.

 

You mean like @refr_int*@customattrib at SOPs? Have you actually tried this?

To my understanding this won´t work. I´ve tried it but maybe in a wrong way... I can´t ask for the shader value at SOPs because the shader isn´t evaluated until render time, so if I add @refr_int (the shader attribute) at SOPs I will get an error. If I create such an attribute myself we are back at square one because I´m overwriting the value.

 

I can´t query the result of the shader attribute either because it´s dependant on a map, so once again, it isn´t calculated until render time.

That´s why I asked, if you have tried this yourself....maybe I´m overlooking something or didn´t undertand your idea properly?

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