TomRaynor Posted June 26, 2014 Share Posted June 26, 2014 Calling all shader making wizards... I am trying to make a simple shadow catching material like the shadowMatte material that has the option to be able to toggle on and off "enable self shadows". If this tickbox is on, then each object can cast a shadow on itself. If it is off, then each object cannot cast a shadow on itself. As a bonus it would be great to have something like an "object scope" parameter similar to the occlusion vex node, where I could pass in a list of objects that the shader would use to enable or disable self shadowing. I have attached a file showing where I have got to. This works for enabling or disabling self shadows on a single object but it seems to require one shader per object to work properly if I want to apply the shadow catcher to multiple objects. I would prefer to do this by wiring vops together than writing in vex but whatever works Thanks in advance! shadowCatchingShader_v01.hip Quote Link to comment Share on other sites More sharing options...
Serg Posted June 30, 2014 Share Posted June 30, 2014 Hi Tom, You can try fastshadow or filtershadow since they have scope inputs. Then make: - inline vop and put "$objname = getobjectname();" in the code window - set "objname" in the Output 1 Name - set the Type to string. - plug result into both inputs of a compare vop, to check if objname == objname. - plug into a switch - add 2 string constant vops and plug into the switch - set the first constant to scope everything "*", or make this a parameter. - set the second to empty - plug into scope of filter shadow. Hopefully it works because I haven't tried it! Cheers S Quote Link to comment Share on other sites More sharing options...
Serg Posted June 30, 2014 Share Posted June 30, 2014 ermm... just thinking about it again, not sure my logic is sound... you might need the second input to not be empty. I think needs to be another inline vop where you composite a string attribute to give * ^getobjectname() Quote Link to comment Share on other sites More sharing options...
TomRaynor Posted July 1, 2014 Author Share Posted July 1, 2014 Hmmm. I have tried plugging a few nodes together and am not getting too far. Are you saying that I can use the fast/filter shadow vops mimic the behaviour of the shadowMatte vop or do I need this vop in my shader network as well. If you get any time to throw together an example scene that would be really helpful, as I am a bit lost at the moment. Quote Link to comment Share on other sites More sharing options...
Serg Posted July 1, 2014 Share Posted July 1, 2014 Unfortunately I'm too busy today, but I can look at it tomorrow evening if that still works for you? Quote Link to comment Share on other sites More sharing options...
TomRaynor Posted July 1, 2014 Author Share Posted July 1, 2014 That would be amazingly helpful! Thanks Quote Link to comment Share on other sites More sharing options...
Serg Posted July 2, 2014 Share Posted July 2, 2014 (edited) Hi there,My logic was laughably flawed from the outset, but its sorted now Turned out more complicated than I first thought as it also needs an illuminance loop and some extra stuff to match the output of the shadow matte shader. It could do with somebody with more advanced vex experience/time to figure out how to split a string with multiple object paths into an array or something, because at the moment it requires one field per object that you want to turn off self shadows. Its fairly obvious how to add more if you need to exclude more than the 10 I added... but that could get out of hand. Hope it works for you. Cheers Sergio shadowCatchingShader_v02.hip Edited July 2, 2014 by Serg 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.