st.Colorization


Source Code (basic)
Cross if( t >= 0.25 && t <= 0.75 ) surfcolor = color(1,1,1);
if( s >= 0.25 && s <= 0.75 ) surfcolor = color(0,0,0);
Circle if( ((t-0.5)*(t-0.5))+((s-0.5)*(s-0.5)) <= 0.1 )
surfcolor = color(0,0,0);
Arc if( (s*s)+(t*t) <= 1 )
surfcolor = color(0,0,0);
if ( s > 0.25 && s < 0.75 && t > 0.25 && t < 0.75)surfcolor = (1,1,1);
else surfcolor = (0,0,0);
Custom Shader
After the basic code was done, i want to try to make something very fun.
i used very simple code ( if( t >= 0.1&& t <= 0.2 ) ) to generate the image of music bar.
The result looks like this:

After i made the RSL script for the music bar,
I have added some parameters to give control in the Maya setting

The controlers gives you the full control over the height of the music bars.
For the final steps, i added some music and made a movie.
Here is the Movie:
FLAME RSL USING SPRITE SYSTEM IN MAYA
After all this was done, i was trying to explore more about RSL.
From the research, i could find out some interesting thing about
SL that i can use for st.Colorization.
It was the noise(p) function in RSL
By using RSL script:
surface
flame( float Kfb = 1,
freq = 6;
color top = color (1,0,0),
lower = color (1,1,0);
string spacename = " shader " )
{
point p = transform (spacename, P );
color surfcolor = mix (top, lower, t );
if ( t > noise (p * freq))
Oi = Os ;
else
Oi = 0;
Ci = Oi * Cs * surfcolor * Kfb;
}
This shader makes the surface shader make the opacity of 0
when the nosie (p) value is less then t.
Since the end of the shader will be 0 opacity,
my idea was to use this shader, to create somewhat looking flame by using sprite in Maya particle system.
In the scripted there is freq parameter i could use to control the frequency of the noise value in maya.
Therefore, i thought it would be suitable for the flame animation by spirite.
But there was a problem.
1. The RSL script only contains the opacity value that applies to t.
so it was not 0 opacity for other side of the shader (the shader was square).
So this time, i could not achieve the goal for my idea of making flame by using RSL shader.
i hope this experience become a great source for my next project!
All CopyRight Reserved 2009 @ mrgentle.net