DALE BUNTEN | FX ARTIST
  • Home
  • Contact
  • BLOG
    • Oil_blowout
    • Personal Work
  • WORK
    • MA Project
    • Nuclear Blastwave Destruction
    • Mock car commercial
    • Spacial Discontinuity
    • Live_Match_particles
    • Boolean-destruction
    • Ammonites
  • R&D
TEMPORARY WEBSITE HERE

OSL  ST  COLORATION  and  displacement 

Picture
These simple objects were created with the Open Shading Language script (OSL).  Basic geometric expressions, user inputs and IF statements established the framework for applying displacements. All shapes are simple 1x1 planes. 

/ OPEN SHADING  language (osl) 
/ renderman 
/maya 

SHORT CLIP: animated  depth  of field test 

CIRCLE:   COPPER


This shape uses the equation of a circle:  X^2 + Y^2 = R^2 and sets the inside vs outside area where the inside displacement is set to "1". 
shader
circle3(
    float s = 0 
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
    float t = 0
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
  
       float radius = 0.5,
       float a = 0.5,
       float b = 0.5,
       output float resultF = 0)
  
{
  
if ((s-a)*(s-a) + (t-b)*(t-b) <= (radius/2)*(radius/2)) {
    resultF = 1;
    }
else
    {
     resultF = 0;
    }
}
  
Picture

WHEEL:  GOLD

This shape used the same equation of a circle, but added some additional rules to set a limited area, creating a hollow interior
shader
circle_double(
    float s = 0 
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
    float t = 0
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
  
       float radius = 0.9,
       float a = 0.5,
       float b = 0.5,
       output float resultF = 0)
  
{
  
if ((s-a)*(s-a) + (t-b)*(t-b) <= (radius/2)*(radius/2) && (s-a)*(s-a) + (t-b)*(t-b) >= (radius/3)*(radius/3))  {
    resultF = 1;
    }
else
    {
     resultF = 0;
    }
}
  
Picture

WAVE  BORDER

The base of this shape (the sine wave) was created in class, and which time I realized it would be a simple rule to establish a border around the shape using tmax/ tmin and smax/smin values for the border with the wave pattern in the center.
shader
wave(
    float s = 0 
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
    float t = 0
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
    float tmin = 0.2, 
    float tmax = 0.8,
    float smin = 0.2, 
    float smax = 0.8,
    float freq = 8,
    float offset = 2,
    output float resultF = 1)
{
if(t >= tmin && s >= smin && s <= smax && t <= tmax)
    resultF =  sin((s + offset) * M_PI*2 * freq); 
    
    else
    resultF = 1;
}
  
  
  
  
Picture

PYRAMID: 


The most difficult pattern to produce, it involved remapping a subrange of values to a 0-1-0 pattern where 1 is the top of the pyramid and zero are the values around the edges. The base expression that achieves this is: newValue = abs (abs((s - b) * 1/ab) - 1);. 
Adapting the expression for OSL was a little challenging require a lot of experimentation. In the end after trying getting some help, and trying some variations (commented out below), I was able to approximate the pyramid effect.

shader
pyramid2(
    float s = 0 
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
    float t = 0
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
    
    float sMin = 0,
    float sMax = 0.5,
  
    float tMin = 0,
    float tMax = 0.5,
    
    output float resultF = 0)
    
{
    //resultF = -abs((s -sMax) * -abs(t - tMax)*5) ;
    resultF = (1-2*abs(s - 0.5)) * (1-2*abs(t - 0.5));
    //resultF = ((1-2*abs(s - 0.5)) + (1-2*abs(t - 0.5)))/2;
}
Picture
  • Home
  • Contact
  • BLOG
    • Oil_blowout
    • Personal Work
  • WORK
    • MA Project
    • Nuclear Blastwave Destruction
    • Mock car commercial
    • Spacial Discontinuity
    • Live_Match_particles
    • Boolean-destruction
    • Ammonites
  • R&D