Intro To Functions - 01 Values and Lerps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] so in this video i want to demystify the function graphs and the value processor nodes which are going to make the whole process a little bit easier but why would you want to use function graphs functions give us further control over our projects and help us streamline graph behavior however traditionally the values that are output by our functions have not been easy to see outside of the function graphs themselves and so with the value processor node which i have here in my graph we can see that we're going to very easily be able to see the output information of our function graph behind the scenes so with this value processor selected we can go ahead and click on its only parameter which is going to bring us into our function graph and so we can see here that i've gone ahead and created essentially what is going to equal out to be a calculator so right now our final output is going to be 0 because we're not actually outputting any of this information from our function so say i want this addition between these two float numbers to be our output i can go ahead and right click this node here and set that as our output and that's going to highlight at orange and we can see that now we're going to get the final sum or the result of that node and again if i come back into our graph here we can see that i'm going to very easily be able to see that final result and will be the same thing for our multiplication again multiplying that by 2 and we can also go ahead and set the output as this note here which is going to then divide six by three now while calculators are certainly cool we'll notice that the previous graph that we had taken a look at is not really flexible on the user end and we'll have to go back into that graph to actually manipulate some of the values instead what we can do is take a look at injecting our own custom parameters into these function graphs to make them a little bit more robust so i'm going to double click on our graph here to come into our graph properties and i want to come under input parameters and let's go and add a custom input so we'll notice that it's going to be of float 1 and this is where i want to take the opportunity to kind of talk about data types and we'll see this little drop down right over here every value in a program has a data type integer values are full numbers floating point values are numbers with a decimal point integers and floats can be positive or negative so i'm going to go ahead and leave this as a type of float 1 with a slider editor however i do want to go and change the identifier just so that we know this is something that we've custom made so now that this custom property has been made let's go back into our value processor into our function graph and the first node that i want to take a look at is going to be get float and now we'll see that we have a ton of different options but remember that we're using a float 1 or just float so let's go ahead and get float and we can see that it's going to give us a bit of an error because it's not drawing any information from anywhere but if i come up into its properties we can see that we're going to get the identifier my underscore input so i'm going to create another float node and let's go ahead and just add these together so now when i go ahead and right click set this as output i'm also going to change this from 0 because obviously adding to 0 is just going to be our input let's go ahead and set this to 0.5 so now we can see that when i go ahead come back into our master graph here and play around with the default of our parameter we can see that i'm actually changing it right so if i go ahead and set our default to be 0.5 we're actually going to get one because we're also adding a value of 0.5 so it's important to remember that information that we are providing within this function graph is going to be local to the graph itself however information that we're going to be creating in our graph properties here is actually going to be global and so we can just use this information to broadcast globally across this project and we're going to be able to receive this information and use it in various graphs and so that's how i'm able to go ahead and actually receive this input value in this function graph here now that we can go ahead and access user input let's go ahead and use this function graph in a node scenario so i'm going to keep our value processor here and i'm going to add a gaussian noise node and so i want to use the output value from our value processor and go ahead and directly connect that to the disorder of this node here and so you'll notice that we aren't really going to be able to access this node right because we don't have a socket on the left side but what you might not have noticed is that if we go ahead and click on this we can actually create input values so i'll create a little input value down here and you can see that that's going to add a socket onto the left side of this gaussian noise so i can go ahead and just plug this in and now nothing's going to happen immediately but we're going to have to do a couple things first so again in this gaussian noise i want to come and just change the name now it's not super important what you change the name to but i generally try and make it descriptive as to what this value is affecting so in this case it's going to be the disorder and remember that we're also going to be using a float type for this data so we're going to keep it on float 1. but you can see that we can use a whole range of different data types so now while this value is set up we actually have to connect it to the parameter that we want to alter which is going to be our disorder so i'll come up to the disorder and we'll have this little drop down here and if i click on that you'll see that we can use this hash disorder value that we're going to get from the input that we've plugged in so now when i go ahead and select that you can see that if i go ahead and double click back into my master graph here right using our input parameter we can actually play around with the disorder which is going to go through our value processor and ultimately end up altering real tangible data in our pixel nodes which is going to be really really cool let's look at a more practical example as to why you'd probably want to use this in your graphs so we can see here i've got a brick 1 and a gaussian noise just plugged into this warp node and so if i go and change the scale on this gaussian noise we'll notice that the intensity is going to remain the same and it's actually going to be a little bit too intense the smaller that we actually make this noise and so it would be nice if we could go ahead and somehow link the scale to the intensity of this warp node so that as we scale it up we actually kind of decrease the intensity to preserve really the foundation of the node that we're plugging in and so how we'll go about doing that is by using two different value processors and one custom parameter for this graph so let's go and create the custom parameter first again just clicking this little plus and i'm going to call this my distortion and just as a refresher we're making sure that identifier is what we'll be looking for in our function graphs and label is what we're going to be calling this on the user side so i'm going to create this as a float 1 because i just want to use a slider like this which we're going to go from a value of 0 to 1 here and that's going to be pretty handy on the user side of things but it's not necessarily going to be the best from the functionality side and what i mean by that is that if we take a look at the gaussian noise you can see that a value of zero well is not really even possible with this node right if i go ahead and hit zero it's just going to be black and a value of one is going to be this kind of mid gray color so for the sake of functionality and usability we're going to have to find a way to kind of remap these values to a range of 0 to 1. and for the sake of this demonstration i found that a value of 4 being our minimum and a value of 32 being our maximum to be probably a good range that we can use so let's quickly create this in our value processor here so now in our graph we've got our minimum value we've got our maximum value and let's go ahead and quickly just snag that custom value that we've created my distortion and we're going to be using that as kind of the range that the user is going to have access to so how do we actually use these values to redefine a range well we can go ahead and start to type in lerp or linear interpolation but chances are you probably call it lerp a linear interpolation node remaps a control value to a custom range in this example 0 will return the a input or minimum value and 1 will return the b input or maximum value values in between will interpolate between a and b so i can plug our minimum value into a here i can plug our maximum value into b and x is going to be essentially the range that we're going to be remapping this out to that's pretty good so far but we actually have one more quick little fix we need to do and that's going to be casting this data type to an integer so if we recall right we'll note that these are float values but if i go ahead and take a look at our gaussian noise notice that we're actually working with integers so that's a little bit of a an extra hiccup or obstacle that we have to be aware of but now if i go ahead and set this as output you'll see that we're going to get just an integer value and that's actually going to change the output socket for this node whereas before we've seen it's green because that's been a float value so let's go and quickly create an input value here and i'm going to call this hash scale making sure that it's also of integer one so that these colors are going to match here and let's use this to go ahead and just control our scale so now if i go ahead and preview our distortion here we can see that a value of 1 is going to be 32 and a value of 0 is actually going to be a value of 4. now we're going to be using that same functionality for our intensity albeit it's going to be just slightly different because now when we go up to a value of 32 or our distortion slider is at one we actually want the intensity to decrease in order to kind of match that scale and inversely if we go ahead and decrease this we want to increase the intensity because our noise is going to be a little bit larger so if i come into our value processor here for these floats we're actually just going to kind of invert them where if our distortion slider is at zero we actually want the intensity to be a value of one and when it's at 1 we want the intensity to be around 0.1 and i'll go ahead and set this as output again because we're going to be using a float value so we're not going to need to cast this to an integer and finally let's go ahead and just quickly connect this to our intensity input here so that now if i go ahead and play around with our distortion at a value of one we can see that it's actually remapping it to 32 for the scale and it's remapping it to 0.1 for the intensity and as i go ahead and bring this down it's going to decrease our scale but actually increase our intensity so this has been a quick look into defining functions in graphs using custom input values and finally looking at real-world situations where we can use function-specific nodes such as the linear interpolation node
Info
Channel: Adobe Substance 3D
Views: 7,714
Rating: undefined out of 5
Keywords: materials, procedural, PBR, Physically based rendering, Scans, Photogrammetry, scanning, environment art, 3D support, 3D design, 3D painting, 3D texturing, realistic, hyper-realistic, texturing, 3D material
Id: ajyp8Z26UsA
Channel Id: undefined
Length: 12min 56sec (776 seconds)
Published: Fri May 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.