¡Ø ´ÙÀ½ÀÇ ³»¿ëÀº deathfall¿¡¼ ¿¬ÀçÇÏ´Â BMRT(ÇÁ¸®¼ÒÇÁÆ®¿þ¾î)°Á ³»¿ëÀÇ ¹ø¿ª±Û
ÀÓÀ» ¹àÈù´Ù.
»ç¿ëÅø ´Ù¿î·Îµå : Blue Moon Rendering Tools(BMRT), SlcEditor
¸ÕÀú Notepad ·Î ´ÙÀ½ÀÇ ³»¿ëÀ» ÀÛ¼ºÇÑ´Ù.
surface myShader()
{
Ci = Cs;
Oi = Os;
}
À§ÀÇ ÀÛ¼º ³»¿ëÀ» myShader.sl ¶õ À̸§ÀÇ ÆÄÀÏ·Î ÀúÀåÇÑ´Ù.
Command Prompt window¿¡¼ ´ÙÀ½À» ÀÛ¼ºÇÑ´Ù.
slc myShader.sl
ÀÌÁ¦ BlueMoon¿¡¼ ÄÄÆÄÀÏÀÌ µÇ¾ú´Ù.
slced¸¦ ¿¬´Ù.(¾Æ·¡ÀÇ ±×¸²Àº µ¥½ºÅ©Å¾ÀÇ
¹Ù·Î°¡±âÀÌ´Ù.)
Change Dir ¶õ °÷¿¡¼ myShader.sl¸¦ ã´Â´Ù.
OK¸¦ Ŭ¸¯ÇÑ´Ù.
Surface shaderÀÇ noneÀ̶ó°í ½áÀÖ´Â
¸Þ´º¿¡¼ myShader¸¦
ã¾Æ Ŭ¸¯ÇÑ´Ù.
preview À©µµ¿ì¸¦
Ŭ¸¯ÇÏ¸é ´ÙÀ½°ú °°ÀÌ ÇÏ¾á ¿øÀÌ ³ªÅ¸³¯ °ÍÀÌ´Ù.
the Source...¹öÆ°À»
Ŭ¸¯Çϸé shader code°¡ º¸¿©Áú °ÍÀÌ´Ù. ±×·³ ÀÌÁ¦ ³ëÆ®Æе带 ´Ý¾Æµµ ÁÁ´Ù.
¾Æ·¡ÀÇ µ¥ÀÌÅ͸¦ ÀÔ·ÂÇÏ¿© diffuse¸¦ ÷°¡ÇÑ´Ù.
surface myShader()
{
color clrDiffuse = diffuse(faceforward(normalize(N),I));
Ci = clrDiffuse;
Oi = OS;
}
¾Æ·¡ÀÇ ¾ÆÀÌÄÜÀ» Ŭ¸¯ÇÏ¿© ÀÌ°ÍÀ» ÄÞÆÄÀÏÇÑ´Ù.
ÇÁ¸®ºäÀ̹ÌÁö¸¦ Ŭ¸¯Çϸé diffuse¸¦ °¡Áö°í ÀÖ´Â shader¸¦ º¼ ¼ö
ÀÖÀ» °ÍÀÌ´Ù.
ÀÌÁ¦ diffuse¿¡ color¸¦ ÷°¡Çغ¸ÀÚ. diffuse¿¡ ´Ù¾çÇÑ »ö»óÀÇ º¯È¸¦ ÁÖ°Ô µÉ
°ÍÀÌ´Ù.(¾Æ·¡ÀÇ °æ¿ì RGB°¡ 0,1,0ÀÎ °ªÀÇ ³ì»öÀ» ÀÌ´Ù.)
surface myShader()
{
color clrDiffuse = diffuse(faceforward(normalize(N),I));
color clrGreen = (0,1,0);
clrDiffuse = clrDiffuse * clrGreen;
Ci = clrDiffuse;
Oi = Os;
}
ÀÌ°ÍÀ» ÀúÀåÇؼ ÄÞÆÄÀÏÇÑ´Ù. ±×·³ ´ÙÀ½ÀÇ green shader¸¦ °®°ÔµÈ´Ù.
ÀÌ·¯ÇÑ ¹æ¹ýÀ¸·Î »ç¿ëÀÚ´Â diffuseÀÇ color°ªÀ» ¹Ù²Ü ¼ö ÀÖ´Ù. ¾Æ·¡Ã³·³
¸Ç ÀÁÙÀ» ÀÌ¿ëÇÏ¿© »ö»óÀ» ´Ù¾çÈÇÒ ¼ö ÀÖ´Ù.
surface myShader(color clrGreen=(0,1,0))
{
color clrDiffuse = diffuse(faceforward(normalize(N),I));
clrDiffuse = clrDiffuse * clrGreen;
Ci = clrDiffuse;
Oi = Os;
}
ÀÌ°ÍÀ» ´Ù½Ã ÀúÀåÇؼ ÄÞÆÄÀÏÇÑ´Ù. ±×¸®°í Refresh
Shader ¶õ °÷À» Ŭ¸¯Çؼ ´Ù¾çÈ(variable) ½Ãų ¼ö ÀÖ´Ù.
¾Æ·¡¿Í °°ÀÌ ´Ù¾çÈµÈ À©µµ¿ì(clrGreen)¸¦ º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ÀÌ°ÍÀ» ¼±ÅÃÇÏ¿© color¸¦ ¼±ÅÃÇÑ´Ù.
ÀÌ°ÍÀ» ÇÁ¸®ºäÇÑ´Ù.
ÀÌÁ¦ ´õ¿í °ÇÑ ´Ù¾çȸ¦ ÷°¡Çغ¸ÀÚ.(intDiffuse).
±×·¯¸é »ç¿ëÀÚ´Â intensity¸¦ Á¶ÀýÇÒ ¼ö ÀÖ°Ô µÈ´Ù.
surface myShader(color clrGreen=(0,1,0);
float intDiffuse=1;)
{
color clrDiffuse = diffuse(faceforward(normalize(N),I));
clrDiffuse = (clrDiffuse * clrGreen)*intDiffuse;
Ci = clrDiffuse;
Oi = Os;
}
»õ·Ó°Ô ´Ù¾çÈµÈ °ÍµéÀ» º¸±âÀ§Çؼ ¸Åȸ Refresh
Shader¹öÆ°À» Ŭ¸¯ÇØ¾ß ÇÑ´Ù. ±×·¯¸é intDiffuse¸¦ º¸°Ô µÉ °ÍÀÌ´Ù. 2¸¦ ÀÔ·ÂÇغ¸ÀÚ.
¾Æ·¡´Â 0.5¸¦ ÀÔ·ÂÇÑ °æ¿ìÀÌ´Ù.
¾Æ·¡ÀÇ °ªÀ» º¹»çÇÏ¿© specular (highlite)¸¦
¸¸µé¾î º¸ÀÚ.
surface myShader(color clrGreen=(0,1,0);
float intDiffuse=1;)
{
color clrDiffuse = diffuse(faceforward(normalize(N),I));
clrDiffuse = (clrDiffuse * clrGreen)*intDiffuse;
color highlite = specular(normalize(N),normalize(-I),.1);
Ci = clrDiffuse+highlite;
Oi = Os;
}
ÀÌÁ¦ diffuse¿¡ specularÀÌ ´õÇØÁ³´Ù. (Ci =
clrDiffuse+highlite)
ÀÌÁ¦ specular¿¡ »õ·Î¿î ´Ù¾çȸ¦ °¡Çغ¸ÀÚ.
surface myShader(color clrGreen=(0,1,0);
float intDiffuse=1;
color clrHighlite=(0,0,1))
{
color clrDiffuse = diffuse(faceforward(normalize(N),I));
clrDiffuse = (clrDiffuse * clrGreen)*intDiffuse;
color highlite = specular(normalize(N),normalize(-I),.1);
highlite = highlite*clrHighlite;
Ci = clrDiffuse+highlite;
Oi = Os;
}
diffuse¿¡¼ ÇßµíÀÌ specularÀÇ color¸¦ ´Ù¾çÇÏ°Ô º¯È¸¦ ÁÖÀÚ. (highlite = highlite*clrHighlite), ÀÌÁ¦
»ç¿ëÀÚ´Â specular¿¡ color¸¦ ´õÇÒ ¼ö ÀÖ°Ô µÇ¾ú´Ù.
±×¸®°í ³ª¼ specular¿¡ ÄÁÆ®·Ñ ÆûÀ» ÁÖ¾î¼ intensity¸¦ ¸¸µé°í specularÆû¿¡
roughness ¸¦ ÁÖ¾î intSpecular¸¦ ¸¸µé °ÍÀÌ´Ù. ¾Æ·¡°ªÀ» º¹»çÇؼ »ç¿ëÇغ¸ÀÚ.
surface myShader(color clrGreen=(0,1,0);
float intDiffuse=1;
color clrHighlite=(0,0,1);
float roughness=.1;
float intSpecular=1)
{
color clrDiffuse = diffuse(faceforward(normalize(N),I));
clrDiffuse = (clrDiffuse * clrGreen)*intDiffuse;
color highlite = specular(normalize(N),normalize(-I),roughness);
highlite = (highlite*clrHighlite)*intSpecular;
Ci = clrDiffuse+highlite;
Oi = Os;
}
ÀÌÁ¦ ÃÖÁ¾ ·»´õ·¯(preview) ¸¦ À§Çؼ ÇÁ¸®ºäÀÇ ¿ÀºêÁ§Æ®¸¦ ¹Ù²ãº¸ÀÚ. ¾Æ·¡´Â
coneÀ¸·Î ¹Ù²Û °æ¿ì´Ù.
Pixar RedermanÀ» °¡Áö°í ÀÖ´Ù¸é Command Prompt À©µµ¿ì¿¡¼ ¾Æ·¡¸¦
ÀÔ·ÂÇÏ¿© ÄÞÆÄÀÏ ½Ãų ¼ö ÀÖ´Ù.
shader myShader.sl
ÀÌ·¯ÇÑ ¹æ½ÄÀ¸·Î RedermanÀÇ shader¸¦ ¸¸µé ¼ö ÀÖ´Ù.