Megan Letos's profile

Blueberry OSL Shader

OSL | Organic Shader | Blueberries
I created a script using the open shading language to make a custom organic shader for blueberries. The shader controls and defines random color washes and specs to create a realistic shader; including adjustable parameters to create different patterns for numerous blueberries.
The Code
I designed the code to be fully customizable once loaded into Maya. The code below defines the parameters that will be available to the user in the attribute editor's gui. The user will have control over the colors used on the blueberry: the base color, the spots/color washes on the berry, the halo around the color washes, and different dots or specs found on the berry. 

After the color parameters, the controls for the size, frequency, amplitude, and so on for both the color washes and various specs are defined.
Next the global variables are defined, they will be used throughout the script to layer various components on top of one another in order to achieve the look of a blueberry. For the first layer I created the base color with some large spots.
The second layer applies blotches of different a different color on top of layer one. This will give the blueberry that difference in color, shifting from a dark blue to a light blue in large washes. The parameters will be passed up to the user so that they may determine how frequent and large these color washes are.
The third layer applies a random set of specs/dots on top of the comp. When I was observing blueberries to decide what layers needed to be created, I noticed that there were small dots in a range of different colors. This layer imitates the brown specs that can sometimes be found on the berries. The parameters for the specs will also be passed up to the user so that they may alter the size of the specs as well as the color.
The final layer creates a second layer of specs/dots. As I mentioned above, I noticed that there were different colored specs on the blueberry. This layer allows for a second set of dots that can be colored differently; to give some variation to the specs on the berry.
Result
The image below is a screen-grab from the hypershade that illustrates the parameters that are passed up to the user in the gui.
Blueberry OSL Shader
Published:

Blueberry OSL Shader

Custom organic shader for a blueberry, script created using the open shading language (OSL).

Published: