Netvudu Posted November 25, 2015 Share Posted November 25, 2015 (edited) 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 November 25, 2015 by Netvudu Quote Link to comment Share on other sites More sharing options...
mosssi Posted November 25, 2015 Share Posted November 25, 2015 If you don't want to dive in the shader maybe you should multiply your map value in cops. Quote Link to comment Share on other sites More sharing options...
Netvudu Posted November 25, 2015 Author Share Posted November 25, 2015 (edited) you mean after rendering? ...otherwise I don´t see how to multiply a map by a painted attribute... I don´t like that Edited November 25, 2015 by Netvudu Quote Link to comment Share on other sites More sharing options...
fathom Posted November 26, 2015 Share Posted November 26, 2015 just query the value from your shader and do the multiply when you assign to that attribute in your sops. Quote Link to comment Share on other sites More sharing options...
Netvudu Posted November 27, 2015 Author Share Posted November 27, 2015 (edited) 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 November 27, 2015 by Netvudu Quote Link to comment Share on other sites More sharing options...
Skybar Posted November 27, 2015 Share Posted November 27, 2015 Why exactly can't you just do it in the shader? Definitely the simplest way. Or as above, multiply the map in COPs and point the shader to that new map could work. Quote Link to comment Share on other sites More sharing options...
Netvudu Posted November 27, 2015 Author Share Posted November 27, 2015 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. Quote Link to comment Share on other sites More sharing options...
Skybar Posted November 27, 2015 Share Posted November 27, 2015 Isn't the intensity already a multiplier for the map on the Mantra Surface though? Quote Link to comment Share on other sites More sharing options...
Netvudu Posted November 27, 2015 Author Share Posted November 27, 2015 (edited) 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 November 27, 2015 by Netvudu Quote Link to comment Share on other sites More sharing options...
fathom Posted November 27, 2015 Share Posted November 27, 2015 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? Quote Link to comment Share on other sites More sharing options...
Netvudu Posted November 30, 2015 Author Share Posted November 30, 2015 Hey, Miles. Thank you. I got it working properly. Indeed, referencing the shader channel does work. I didn´t though so but it does. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.