|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Slim Templates |
Learning how to script slim templates open a whole new world for me to explore. For the 1st week of class this assignment was a good start for me. It was something that I was familiar with VSFX 319. The assignment was to improve an existing slim shader, "mixkolor" by adding a mathematic Sine function to combine the colors either in the direction of S or T. Creating the sliders were easy but when I went into the section where I key in all my RSL function I got stuck, maybe for 3 hours. I totally could not make any sense out of Sine Function. I even went to the extent of droping the class as I thought I wasnt ready for this. However I got help, Gaki the famous python programmer + rigger. haha. Well he was patient enough to bring me back to some basic mathematics and the basic of RSL so that I can work my way through this assignment. Well it turn out well. |
|
|||
|
Practically there are 2 input of colors and a blend slider to mix the 2 colors. This is the regular mixKolor slim template. Improvements/ assignment req : a S and T switch and a slider to control the number of cycles or lines. How did I work it out. Not totally me 80 percent of the problem solving I have to give it to Gaki. Well its the 1st. I will PREVIAL in future works. Haha. OK here is how. 1st - seting up the switch. parameter float st_switch {.. s = 0 and t =1 } 2nd - making the switch work: ....s(1- st_switch +1) + t(st_switch).... 3rd - add sine function to this formula : sin (s(1-st_switch+1)+t(st_switch) * 2PI 4th - adding a frequency to this sine wave: sin (s(1-st_switch+1)+t(st_switch) * 2PI * freq WaA la . In just one RSL line. . Nah. Joking |
|
|||
Here is just showing that the template can change the between directions S and T. This is set to S. |
|
|||
|
Ok here! VARIATION B. Gaki tried explaining to me by asking me what is the formula of a Circle. In maths we keep thinking of AREA, so I said " PIE R Square??? "" XXXXX wrong. So wrong. RSL calculates with the circumference, or the boundary. So formula for circumference of circle would be R square = X square + Y square. So 1st. Make a circle. : r = sqrt((pow(s-s_center, 2 ))+(pow(t-t_center, 2))); 2nd - add the sine wave function over it : wave = (sin(r * 2PI * freq) + 1) * 0.5; All I have to get use to is to : sub formulas into other formulas, just like above . Subing r into sine wave formula. |
|
|||
![]() |
And NOW we got to add a Faaaaade off. WOW i did it all on my own. so going through the basic steps. Radial fade = circle. So i create a circle. Fade = smoothstep . So i definitely need a smoothstep function. Haha. Got it. //fade_off-------------------- Well the only problem its that its starting from the center. Thats not what i want. Well thats where i GOT STUCK AGAIN! PANIC......!!!!!!!!! |
|
||
Oh WELL, here is where Gaki just say . " Try putting -1 infront of the function." AND IT WORKS. haha. :) CHEERS . WELL DONE. So the idea is simple. result = mix (C1, C2, blend*wave*1-fadeoff); meaning inversing black to white. somehow it works in the opposite direction as well. I have not really make sense out of the equation but it make sense logically. |
|
|||
![]() |
||||
| Well what u see above is a test and a play around with slim nodes. My intention was to get a marble look but then as i continued playing this is what i got. What i realized is that there is so much variations and possiblities with custom shaders. Well Slim template rocks, RSL rocks too .haha. | ||||
Above is the slim node network that formed the snake shader. |
||||
| Color BY ID Slim Template | ||||
| This SLIM Template is specifically design to handle large number of geometries in one scene. The function of this slim node is to identify with a name within a geometry, the name may be a number or a word. Once the name have been identified, the slim node will give a specific color define by the artist automatically. Hence, in this slim node, many names can be keyed in to allow the script or the node to identify, allowing artist to give variations with color or displacement to a group of many objects. | ||||
| Clcik to see Coding | ||||
![]() |
||||
Well here i did a test to see what this shader can achieve. I used paint-effects in maya to create this crystals. Later converting it to polys from paint-effects and seperating the objects after that. This will allow maya to give default names and different numbers to each poly crystals. The script is set to search for numbers 1 to 10. Each number is given a specific color, hence giving a really nice result to the render on the left.
string name; if(attribute("identifier:name", name)) { // printf("%s\n", name); if(match("1$", name)) result = c1; else (match("2$", name)) result = c2; |
|
|||
Just a simple network to get a crystalized look. |
|
|||
After knowing that it works fine, I wanted to make the crystals more crystal like. Playing around and connecting with other slim nodes to achieve this crystal effect. Well again, this shader have shown its use and power, I can apply this to many different situations. It can give variation to a tree, a corn field, a grass field, etc...! Really amaze to know that slim can achieve this result just by having a fuction name identifier.
|
|
|||
![]() |
||||
The Zebra Image is one that I stumble across while serfing the Net. Using whatever knowledge I gain from this Chapter I wish to generate a Slim Template that could generate the same result. |
|
|||
WORK IN PROGRESS |
|
|||