From the course: 3ds Max: Tips, Tricks and Techniques

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Iterating a for loop in OSL

Iterating a for loop in OSL

of offering a procedural map in open shading language, let's add a four loop to repeat this noise pattern multiple times and add the results together. The first order of business is to create a couple of variables in the statements of our code in order to keep track of the current frequency and the current amplitude of the noise We previously created a point variable which was used to scale the incoming coordinates according to the user input parameter base wavelength. Right after that line, let's create a new variable which is going to be a float. And we'll call it currentfreq, or current frequency, and set it equal to a value of 1.0 and close that line with a semicolon, add another carriage return and create another float variable and call it currentAmp or current amplitude. And its starting value or initializing value will be the base amplitude, which is the user input parameter that we previously created, here it is. Base amplitude, select that, and we can right click and copy it,…

Contents