2010年11月20日星期六

Using Mental Ray to Implement The Skin Diffusion of GPU Gems 3



















(File of this head is from ICT's website)

I have implemented this method by using Lighting/Shading → Batch Bake from Mental Ray for Maya to bake light maps of each frame. And I wrote script to produce Gauss Blur maps of each light maps of each frame. Then for each frame, I wrote a mental ray node to combine
those maps with the magic values from Skin Diffusion method of GPU Gems 3. But the performance of this way is very poor. Because if any parameter of light has changed, it is need to
bake those light maps again, and will waste time.

So I started to find another way to implement this method and more efficiency. After I referred the sample code of light map of Mental Ray for Maya, I had wrote a light map node for Mantal Ray for Maya. Through this way, it could produse the light map and those Gauss Blur maps and then combine these maps with the magic value automatically while rendering.

I downloaded the face data from ICT's website. This file is provided for Hybrid Normal Map method, so it provide R-channel, G-channel and B-channel normal maps. But I had used only the G-channel normal map for this blog.

The specular of each pictures below is also using the method from the chap.14 of GPU Gems 3.







Just using the G-channel normal map as this face's normal. The shadow is sharp.


















Using the Skin Diffusion method of chap.14 of GPU Gems 3. It is more redness of the skin and the shadow is more soft.











If it just render the diffuse part with white color and without using color texure, White Diffuse 2 is more redness of the skin than White Diffure 1.







(White Diffure 1)


















(White Diffure 2)














Now, I start to describe what I have done step by step.

Step1. I wrote a mental ray node and used Lighting/Shading → Batch Bake to bake a stretch map. (Please refer the Figure 14-21 of GPU Gems 3)


























Step2. Using my light map node to produee the light map and using this light map to make other Gauss Blur maps.

























The operation of my light map node is like mib_lightmap_write of Mental Ray for Maya. But beside bake the light map(Texture), I used this light map and the stretch map(Sretch Map) to produce those Gauss Blur maps(Texture 2 ~ 6). Here the Stch Scale is a weight of the stretch map and Input is Diffuse with white color. Note: It is need to use 6 maps and those maps will be wrote by one light map and five Gauss Blur maps. But it will be combined with those magic values to render final image, so, initially, these maps can not be used with workless data.

























Step3. Step2 will produce one light map and five Gauss Blur maps.





































Step4. I had written a mental ray node to combine these maps with the magic value in Chap.14 of GPU Gems 3.


























The final network of shading nodes will have the form below.

























Assigning this network to that face and rendering, it will produce the image like the below.

2010年10月28日星期四

Export Polygon from Maya to PBRT


























I haven't update this blog in almost one year.....It's time to write something down XD.

Recently, I start to read this book → Physically Based Rendering, 2/e : From Theory To Implementation. And I want to test something by Maya, so I start to study Maya API.
This is my first program by using Maya API. It's very simple and just exports the polygon objects from Maya to the format of PBRT's geometry. And I have refered to a Maya API example, say polyRawExporter, to write this exporter.

(We can downlad the source code of PBRT in this website : http://www.pbrt.org/)


I chose a scene file provided by PBRT's source code, say metal.pbrt. Rendering this file and it will generate a image as below. (I think this file format likes the *.rib of RenderMan :) )


























Since I want to replace the teapot by some polygon objects that I modeled in Maya.



















I wrote a plug-in to export those objects to the format of PBRT's geometry.


















In metal.pbrt, replacing the teapot by what I had export. And that will generate the image below.
























2009年11月1日星期日

鯉魚山親山步道

今天睡到下午才起床~想說上午下過一場雨,不知道鯉魚山親山步道會不會有什麼新奇好玩的東西出現,就跑去逛了一下,也當作是週末的運動囉!


從大湖街走到底的入口進去,可以看到刻著"清景大湖"的石頭~






















沿著旁邊的階梯走上去,可以看到這樣的景色~感覺心曠神怡:)























再沿著階梯走下去....有著小溪一條(記得是叫"大溝溪")






















人可以在溪兩旁的石頭上面走,感覺很有趣內!






















再往裏面走~






















小橋流水


































































旁邊有一條路是往鯉魚山






















有下過雨果然有差~水明顯的比較大!





















上次有帶幾個同學這裡泡腳





















~~~忍~~~





















十幾年前來這裡時,是沒有這座橋的喔!
是有一次颱風把這段路給沖走了,才又加蓋這座橋的!





















這是竹節蟲嗎?
在這裡只要留意小地方,可是處處有驚奇的呢!











































圓覺瀑布





















沾滿水珠的蜘蛛網





















親山又親水的步道





















往鯉魚山的階梯











































往上走還有橋喔~
這在我小時候來的時候是沒有的,也是後來修建的!





















幾乎每次來都會看到的----人面蜘蛛 (可愛內~~>/////<)





















鯉魚山上面還有小人國喔!不知道這裡在半夜會不會很熱鬧 XD





















山上所看到的台北盆地~但今天的天氣狀況不好....





















山上的小涼亭




















內湖真是個好山好水的地方呢!

2009年10月26日星期一

立體相機

在現在這間公司,除了3D動畫的技術&知識外,我想另一個不小的收穫就是stereo的部份吧!(當然最大的收穫還是~認識很多非常nice的同事!!)

某次RD meeting時,我們的頭頭--Drake--帶了台朋友借他的stereo相機(富士的FinePix REAL3D),當下就有幾個同事把玩了起來。






















想說在離職前,也寫一篇跟stereo攀的上邊的東西,當作個小小的紀念囉~

立體影像的原理很簡單。從早期用的紅藍眼鏡(讓左右眼分別接收不同色系的影像來達到立體的效果),到現在一般戲院戲院用的偏光眼鏡(讓左右眼分別接收不同頻率的影像來達到立體成像),都是一樣的目的---左右眼分別接收不同的影像。

但是要把畫面做的協調好看,又不會讓觀眾看到頭暈看到吐,可是非常需要技術&經驗的累積~不過....不再這篇討論的範圍 ~XD

這篇只是單純的想秀一下用那台stereo相機拍出來的效果。

這是拍出來的左眼影像:





















這是拍出來的右眼影像:






















這是麻煩同事--柏納--幫我用Nuke合出來的影像,戴上紅藍眼鏡就可以看出stereo效果。(新版的Nuke已經可以做出用紅藍眼鏡就能看出立體效果的功能,很有趣吶~)






















當然,還是用偏光眼鏡看到的stereo效果會比較好~但現在一般螢幕只能看紅藍的......

2009年10月4日星期日

PTT內湖鄉民中秋烤肉版聚[趴兔](20091004)





















內湖人團○
千里共嬋娟




















眼尖的版友在玻璃上發現趴了隻青蛙(kero~kero~~)






















座位表





















可愛又有趣的名牌





































專業內!!






















































忘了開閃光...整個黑掉 @@




















又是忘了開閃光...orz






















































最右邊那位的表情...
good job! XD


























































我們第六組的幾位正妹~


















以下幾張是去每組偷拍的









































我們第六組的David和S.H.E.(我亂取的啦 XD)

























































































































↖煞气a粉腸↘























粉腸跟David烤的香腸超讚的呢!!!
在內湖開一間鐵定會賺~























































讓自己也入鏡一下 XD