Karma MaterialX Curvature in Houdini

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi there this is Brian Ray we're going to be talking today about the karma curvature node this is a new feature in Houdini 19.5 starting here in the stage Solaris environment so let's start with a material Library and I'm going to make a Karma subnet Karma material X subnet and this not only makes it easy to copy and paste materials keep things organized but it also has an additional benefit then real quick just delete all of these nodes that I'm not going to be using has an additional benefit of filtering this tab menu so you can see I don't have my entire list of vops here I have only the ones that are appropriate to building a material x a Karma material X Shader so I'm going to start with an unlit surface and I like to use this as a debug Shader so I can at any time pop this into my output and see you know the results of whatever it is that I'm putting into it I'm going to call my Shader chipped paint and go back out here and set my display flag and then I'm going to first of all autofill material so I get my my paths and if I assign this to Crag you'll see that nothing happens and that's because Crag comes with his own material and if I look at one of his transforms here you'll see I've got this material binding with a principled Shader on it and then you can see the the resolved material result full material is that principled Shader now up here I have the result full material being the chipped paint you can see in the material binding and Chip paint but the way USDA is going to tend to work is that a specific will override a general so if I've assigned my material to my top level object and I want to be able to override some individual piece in order to be able to do that I need the individual pieces to be stronger in opinion but there are ways to override the overrides so if I turn off the assigned to Geometry here just so we can keep things clean if I add an assigned material down here and I pull my chipped paint in there and my Crag we still don't see anything happening unable to find primitive slash Crag what do you mean it's right there well I did that opposite Crag goes here paint goes there we still don't see anything happening but if I spin down material binding and change the strength I can say stronger than descendants um make sure I'm in CPU mode so now because it's stronger than descendants it's going to override the lower level stuff so I come over here and I look at abdomen min mid and I see that my material binding is still the principled Shader but the resolved material is the chipped paint because it is stronger than descendants okay so let's go back into the material library and we're going to start actually setting up a real Shader so first of all we're talking about the karma curvature node again this is new in Houdini 19.5 at present it only works in CPU mode it doesn't work for xpu yet that is coming so if I take my K output and I plug that into emission color here we get something that we don't expect I mean this is this is worthless this is isn't doing anything and no matter what I I twiddle with my my sliders here it's never going to be anything interesting and that's because it needs to know a little bit about this geometry it needs to know the position and it needs to know the normals so I'm going to come over here and make a position material X position node my material looks normals node so now we can see okay curvature is doing something it's going to be black where we've got convex surf concave surfaces and white where we have convex surfaces so with the tops of the horns where this is rounded we're going to get white in the eyeballs and all of these crevices we're going to get black and then anywhere that is flat will get a mid gray and then it'll fall off in either direction but it looks pretty nasty I mean it's all triangulated this is because the Crag model is not a subdiv surface and the curvature node it can only shade whole polygons so what we need to do is we need to subdivide this now you could you know make a subdivide sop and make it finer and finer and your geometry would become very heavy and hard to use but we're going to take advantage of Karma's ability to dice the dice the geometry at render Time by making a real subdiv surface so I'm going to spin down any one of these and just grab the mesh and over here in the scene graph details this tells me everything that USD has on this uh this mesh I scroll down here and I find subdivision scheme I can see it's set to none so I'm going to right click that and choose edit property and that'll make a new edit properties Lop that is already pre-loaded with the property that I'm going to want to change which is subdivision scheme of course it's aimed just at the Primitive that I was looking at the abdom and mid so I'm going to change this path say everything under Crag and all of the geometry under those transforms so I'm going to get all of the meshes now if I change the subdivision scheme to catmel Clark everything turns smooth and you can see down here in the scene graph details that's up to updated okay and I'm going to change the name of this thing say edit Crag subdiv just so I know what it's doing when I look at it later oops that is not what I wanted on my material Library all right so now we're ready to actually start shading the guy obviously you know we don't want to be looking at the curvature we want a surface of some kind I'm going to make a standard surface called Paint and uh let's make this guy like a one of those uh Die Cast toys we'll make him a nice bright fire engine red because that'll be nice and obvious what when things are happening um this kind of paint is probably you know we want this to be an old toy so he's not real shiny we're gonna take this spec roughness up plug that into my Surface output and see uh maybe a little less roughness he's still a little shiny so now I've got red paint guy so now let's make another surface and this will be that die cast metal that's underneath um it's a little rough let's take a look at it and we'll make a uh a dome line out here just so that we get a better idea of what this looks like in our in a real environment uh let's get a texture see Skylight garage we'll play with our toy indoors all right so then this is metal so we need to take metalness all the way up and now if he were unpainted does that look like steel that die cast stuff I think that color needs to come down a bit and maybe a little bit more roughness yeah that looks like one of those toys all right so here we've got our dude so what we want to do is we want to mix between these two surfaces pedal actually let's call this die cast just so we're more specific and we'll call this red paint so you want to mix between these two surfaces and fortunately there is a very convenient material X mix node and this is another one that doesn't currently work in xpu we know it's very important it will happen but right now it doesn't work and the mix node if you don't have anything in the mix it's gonna zero is the the background and oops one is the foreground so we're going to plug our curvature into that mix control and see what happens so now we've got uh our red paint on the most convex areas and the metal in the concave areas and this actually looks kind of cool but it's not quite what we want so in order to reverse that I'm just going to add an invert so now we have flipped that around so we've got metal being rubbed away and the concave areas are are painted but this is this is maybe a little bit too much we want it to be just like a little bit of chipping on those those edges not not quite so uh ridiculous so taking a look at the karma curvature its space is zero to one uh zero is concave areas the cavities one is the most convex areas and then the flat areas are going to be 0.5 um that's great and all but I don't want to deal with with the concave areas at all right now if I change this space to minus one to one now we're going to have the convex areas are still one but the concave areas are are minus one and the flat areas are zero um so having done that what I can do is I can just throw away all of my concave information by using a Max node and this is going to take two inputs the uh the curvature node and then the second input is I'm just going to leave it as a number so it's always going to be the highest of either my curvature node or zero so if in effect I'm just throwing away everything below one and Below Zero you could do the same thing with a clamp just max was the first thing I thought of so I do that and now all of my concave areas are are zeros but I don't wanna anything on the uh the 0.5 I wanted to take just the the highest values so how would I go about that I think I want to say if a remap there we go let's plug this into the Shader the debug Shader and take a look at it um and so I want to get rid of these these areas that would be flat gray so let's say if coming in is 0.9 just the top 10 percent then it's going to be zero and then the output is and I would imagine that I'm probably getting super brights here plug this back in and see how this changes things when I plug it in yeah see I'm getting like super Metal so I probably want to clamp at this point just to make sure I'm not getting anything outside of the zero to one range there we go so now it looks naturalistic again um so what I can do at this point is if I change the convex scale I can pull this in so that I'm getting less and less theoretically yeah has to be pretty small numbers looks like so I'm getting just the edges where the paint's been rubbed off all right so that's that's that's looking okay it's pretty regular though um I can change the bias I think to adjust the fall off so that I'm getting something more contrasty that pushes it out again so let's change bias up to like there and then change this down to like 0.001 even smaller it's too small oops let's split the difference there okay there we go right so these are really small numbers and this is getting kind of Twitchy I think we're okay the way we've got it right now what I want to do is I want to make this a little less regular this looks kind of eroded as if it's been weathered by wind and sand or something um but I instead want to to mix some noise in this so I'm going to take some cell noise I'm choosing cell noise because it's got a kind of a squarish aspect to it that makes it look uh chipped and noise also requires a position as an input so let's take a look at this in the debug Shader just to find out what cell noise looks like and what we need to do to it so immediately we can see it's probably too big this isn't going to get us a noisy appearance at all but we can modify the position values going in if I make a multiply there we go and I like to just use a constant for this so I get a nice slider instead of having to deal with uh that Vector input um and we're multiplying so multiplying by zero makes everything zero so I'm just going to set it back to one so we get back to where we were and so if I raise this I am multiplying the position values the position vectors and in essence I'm making the entire world bigger so that the noise appears smaller on the object if I take this up to 60 then we'll start to see we've got this this pattern and that's going to look a little bit chippy like but I don't want to see these mid gray patterns I think I want to uh to make this more contrasty so I'm going to add another remap here not on remap um let's make it a color correct and I'm gonna whoa color correct did not do what I expected it to to do because it plugged into the hue set it to the input there we go let's just stay contrast up to like 10. just so we got solid black and white and then of course we do need to clamp again because now we've got values that are above zero or above one and Below Zero so I'll clamp that and so then this I still got a little bit of Grays in here um I think that'll be okay that'll just be so let's plug this into my actually first let's plug this back into the the surface and take this thing and plug it into my curvatures convex scale and now we can see we've got okay well that looks as is chipped paint like but now it's splattered everywhere um because this is now overriding that a very small number that I put in the scale to begin with I come back here I can see it grayed out .0004 so if I multiply this thing by another constant I'm going to put that value in here .005 was it three four three zeros or two zeros three zeros very small number plug that in here then I should get back to where we were but just with the noisy breakup and so now this is looking like you know it's been smacked against things and and paints chipped off instead of it being worn worn away um but whenever you're using procedural noise like this you tend to get something that looks very regular and uniform um and so you kind of need to to mix several noises together in order to make things look more more organic I'm gonna make some space for myself here I think all of this stuff so what was I doing I was gonna mix some more noise into this so let's get a uniform noise material X noise 3D and I'm gonna grab this little structure here again and I think I'm gonna need a much oh this is oh okay so the the noise I believe has a uh goes into negatives that shouldn't matter for this purpose but uh sometimes you might want to uh clamp I think I will clamp it so I'm going to leave the clamp out and see if it makes a difference when I plug it in later but I'm going to take this value down to like three because I want to get this nice uh I'm going to need to increase its contrast and once again it goes into the Hue for some reason that was really weird clamp and increase contrast like 10. oh getting it down I'm Gonna Get It Up there we go so now I've got this uh kind of Holstein cow look and it's going to make sure that the the the breakup only happens in the areas that are white instead of all over so I can come over here and I can multiply this noise let's switch my debug Shader multiply that by this and when I plug this into convex scale we'll see now that we're we're limiting where that chip chip went off to kind of more random areas so it's not everywhere I think this is looking pretty nice in terms of of what I wanted to do I could mix some more noises into this I think I'd probably want to uh to take some of the straight lines off of the chips and mix a little bit of that high frequency standard noise into those I'm not going to bother with that right now because I kind of want to get to another part of this which is using the other half of the curvature to put some dirt in the grooves because this toy as we said is old has been played with it's it's picked up some some grime so then first let's uh get the grime color now take my red paint here um and I'm going to copy its base color and I'm going to make it constant set of two color and just paste that value here and then bring that in and I'm changing the base color or the red paint for the same thing that I had but now I can do a color correct on this there we go now let's fed into the end instead of the hue and you can take the saturation down a little bit and I can take the gain down quite a bit just make this this kind of dirty looking and uh give me a gamma gamma doesn't really it's just a solid color um can I change the Hue at all I've got a hue control here let's see what happens if I uh feed a constant into it yeah I can swing that just a little a little warmer yeah so there's our dirt color I'm gonna make another mix node and this is going to be the foreground color because it's on top of the original color and I'll put that in there and we should see this change back to our fire engine red excellent all right so now we need another karmic curvature node once again we need our position and normal oh it doesn't detect the name it detects the order okay make sure I hit the P then well it's not quite as smart as I thought it was but that's probably better in many cases all right so I have my karma curvature um and I want to again make this from minus one to one but this time I want the concave areas so I'm going to remap and say input here my input low is -1 and my input High is one as before but now I want to reverse the colors that they result in one to zero no one to minus one okay so this is actually I wonder if I can just invert it's hard to test it I think these two things should be the same where'd my debug Shader go it's hard to know because I can't see the the negative colors that and this should be equivalent they're not quite the same I think I trust my remap more because I I understand mathematically what it's doing so my negative ones that are coming in are being transformed into ones and my ones are being transformed into negative ones so now I can take the same Max and invert and remap and clamp plug the into here and now I should see bright colors in cavities and blacks everywhere else it only took the remap okay so I didn't do not want to invert this one what is this remap doing now that's doing the limiting there we go so there is the results of this curvature and that is going to be plugged into my mix if I turn my debug Shader back off I see black why is that yci black there we go I changed the wrong thing what did I change I changed my emission to zero instead of the switch let's make sure that this still works yep okay choose the correct note Brian all right so now if I plug this into the mix I should see that's better so the eye cavities get dark some other things get dark that maybe I don't want but uh I can address that with the concave scale you know dirt you know it won't have this uh these nice clean edges uh we'll make some noise into it first of all but I also want to do a blur let's make this a gaussian blur just turn the size up see what happens here hmm it is not doing what I expect it to do feed the blur into debug Shader blur is not appearing to do anything hmm that is most unexpected maybe what I need to blur is a position that'll be weird no that's not it why isn't that working the way I wonder if blur simply doesn't work oh you know what that that is the case we can't do a blur we can't do any convolution in the material X Shader okay so what I need to do is I need to maybe change the bias give that a try yeah so bias is going to control a fall off which is going to be the only way we're going to get blurriness Okay so I want to make some noise into this um and I don't want the chipped looking noise I want just a regular noise grab my position and a multiply and a constant plug this into the debug Shader I think it makes sense to put the debug switch here or not oops because I haven't set this to one yet there we go that's what I was expecting all right so let's just get this uh go and once again I need to remove my uh value out to here concave scale multiply by this all right let's look at the results there we go let's kind of look at this uh this area over here and just add some breakup to it and makes it a little less uniform yeah I'm liking that and then another noise with a lower scale this one's down to let's make this like nine and multiply the final result by that so now I got some irregularly spaced grunge and we've got our chipped paint and this looks like an old toy could uh go a little further and and do more and more on it of course you can always go further but uh hopefully this will give you an idea of how to build a Shader of this kind and we come back out here and we see oh wow that is a lot of nodes it looks intimidating and you wonder would I ever be able to to understand and do that that kind of thing but hopefully you saw as we were building it up just step by step solving problems as they came up um and just stopping to think about the math a little bit that uh it's not really as as Troublesome as it looks and at the very end we're going to want to bypass this thing with the debug Shader um and probably even delete it so that it's not part of our our Network that's getting saved out in USD and so there we go we have our chipped paint toy Shader see you next time
Info
Channel: Bryan Ray, Visual Effects
Views: 6,287
Rating: undefined out of 5
Keywords:
Id: 8gOuyXOW6uA
Channel Id: undefined
Length: 36min 35sec (2195 seconds)
Published: Fri Nov 25 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.