Texture Bombing OSL
Final Test results with some variation
Before we start, there are some basic mathmatics function we need to understand.
To make texture or pattern to rotate, 2D transformation and rotation are the two important concepts to understand
2D Transformation
Transformation is relative simple
Use coordinates to add a transformation vector to get new coordinates.
2D Rotation
2D Rotation is a bit more complicated.
Using trigonometric function we get the relationship from two coordinates to the center of the grid.
I found a youtube video that explains it well
If you find it confusing, please come back to see the graph. I add more labels to help you understand it more comfortably.
"Blend" Function can easily explained by graph
Blend curve
See color match between the curve and math
Smooth-Step Function is a useful function that used both on OSL and HLSL
Smooth-Step Function
It is a function to control the step smoothness
see the graph on left
Use an upper and lower limit to control the clamp
Definition
A good example would be :
using the smooth-step function to control the cosine wave
notice multiple “S“ after “cos(5s)” would achieve the control effects
Use number and multiply factor can control the clamps further
Therefore, the udn function in bombing represents this variation of the smooth-step function
OSL code
Now, we can step into the OSL function
The main function were explained beautifully by Blender Sushi
The link is here:Click me for the redirect
The main logic here is the same as ST pattern. It add variation for each dots’ pivot points and use for loop to overlay layers that has different size of dots
User can use for loop in the function to create as many variation as they like such as radius and color. However, each dot are still limited to move in certain area.
So be careful about variation size.
One place to notice is that each render engine use OSL slightly different
For example, Radarman use S&T while Arnold use UV directly
So be careful about definition at the very beginning