◎照先前介紹的方式,先在slim裡新增一個Ensemble,再接一個Delux,並在Delux裡新增一個v1。

◎從Colors -> Utility -> SLBox來新增一個type為color的SLBox。

◎可以從底下的SL code欄位裡,看到預設的result為(1,1,1),也就是全白。

◎將其接到Delux的v1上,可以看到Delux的preview也是全白。

◎在Parameter欄位,可以從下拉的選單中,看到有幾種type的變數。選擇所需要的type後,按下旁邊的+號,即可新增此種type的變數。

◎先在Parameter選擇color,按下+號;再選擇float,然後再按一次+號,即可新增兩個type分別為color和float的變數(v1和v2)。

◎新增一個Imagefile node,將其接到SLBox的v1上。

◎在SLBox裡,將 result=(1,1,1); 改成 result=v1;

◎preview即可看到Imagefile裡的貼圖。

◎接著按下v2旁的方塊->float->Pattern->Noise。可以將v2連到一個type為float的Noise node。

◎將noise的frequence調成8,然後在SL code裡改成 result=v1*v2; preview即可看到noise對剛才的貼圖產生了作用。

◎如果希望這個shader會隨著燈光而有明暗變化以及反射的話,就先新增兩個type為color的變數。在變數名稱上點兩下,即可更改變數名稱。這裡是分別改成diff與spec。然後從shading component新增一個Diffuse和Specular,分別將其接到SLBox的diff以及spec上。

◎把SL code改成 result=v1*v2*diff; 即可看到除了剛才的noise外,也有了和diffuse一樣的明暗變化。

◎再把變數spec加上去,即可做出如specular的反射效果。

如果不知道什麼時候要用乘的,什麼時候要用加的.....只能說先K點計算機圖學會比較有概念。
沒有留言:
張貼留言