<?xml version="1.0" encoding="utf-8"?>
        <?xml-stylesheet type="text/css" href="http://studentpages.scad.edu/~yimchu20/weblog/styles/feed.css"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
>
<channel>
<title>Wesly is dreaming.</title>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/3d_cg/index.html</link>
<description>news, diary, journal, whatever, 個人外部記憶，怎樣都行....</description>
<dc:language>en-us</dc:language>
<dc:creator>Wesly Chu</dc:creator>
<dc:date>2008-11-22T00:44:05-06:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2008/11/22/index.html#e2008-11-22T00_44_00.txt</link>
<title>使用wxGlCanvas的心得</title>
<dc:date>2008-11-22T00:44:00-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
wxPython中的wxGLCanvas可以用OpenGL來顯示3D影像或是利用硬體加速影像的顯示。預設是使用single buffer，要使用double buffer需要在參數裡指定。
<pre>
attribList = (glcanvas.WX_GL_RGBA, # RGBA
    glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered
    glcanvas.WX_GL_STENCIL_SIZE,1) # 24 bit
glcanvas.GLCanvas.__init__(self, -1,attribList=attribList)
</pre>
</p>
<p>
OpenGL中的glDrawPixels()是用來將某矩陣中的資訊，畫到frame buffer的方法。這個矩陣中的資料通常是一個影像圖片，以RGBRGBRGB...的形式存放。當這個影像的寬度不是4的倍數時，螢幕上畫出來的圖片會有奇怪的偏移現象。這可能是由於glDrawPixels要求每行像素是4 Bytes的倍數。如果在影像寬度不是4的倍數的狀況時，glDrawPixels會在一行的最後跳過最後一個像素，而造成每行的像素沒有對齊的情形。簡單的修正方法如下(以python為例)。
<pre>
image = wx.Image()
w = image.GetWidth()
h = image.GetHeight()
if w % 4 == 1:
    w = w -1
elif w % 4 == 2:
    w = w -2
elif w % 4 == 3:
    w = w -3
glDrawPixels(w, h, GL_RGB, GL_UNSIGNED_BYTE, image.GatData())
</pre>
</p>
<p>
參考資料:<br>
<a href="http://wiki.wxpython.org/GLCanvas">http://wiki.wxpython.org/GLCanvas</a><br>
<a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=297351">http://www.gamedev.net/community/forums/topic.asp?topic_id=297351</a>
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2008/11/03/index.html#e2008-11-03T21_59_08.txt</link>
<title>Mental Ray Shade習作</title>
<dc:date>2008-11-03T21:59:08-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
由於個人目前實在沒有用Renderman的機會，於是我想利用閒暇時間，將以前寫過的Renderman shader改寫為Mental Ray shader。目前做完兩個，還有一堆需要改寫並加強。希望能把當初畢業製作用的所有shader都改為Mental Ray版本，這樣要重新算圖也比較有可能。
</p>
<p>
<a
href="http://studentpages.scad.edu/~yimchu20/prman/st_coloration/st_coloration_mr.html">ST Coloration shader</a>
<br>
<a href="http://studentpages.scad.edu/~yimchu20/prman/image_process/image_filter.html">Image filter shader</a>
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2008/04/13/index.html#e2008-04-13T11_23_04.txt</link>
<title>使用Eclipse開發Maya plugin時關於除錯的一些設定</title>
<dc:date>2008-04-13T11:23:04-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
在試著找過文件並且請教朋友之後，終於找到應該設定Degugger的參數的種類。首先，由於我們要進行除錯的Maya plugin是個shared library，這其實表示我們要除錯的應用程式是Maya本身。在使用Eclipse的CDT時，新增一個給Maya的Debug設定，並且是使用C/C++ Local Application的預設設定來修改。以下條列應該修改的設定和環境參數，其餘設定可用預設值。
<li>Main的部份，將C/C++
Application的部份由預設的.so(就是你的plugin)
<pre>
Debug/yourplugin.so
</pre>
改為maya.bin的位置。例如：
<pre>
/usr/autodesk/maya8.5-x64/bin/maya.bin
</pre>
</li>
<li>
在Environment的部份，加入以下Environment variables及其對應的值：
<pre>
LD_LIBRARY_PATH                 /usr/autodesk/maya8.5-x64/lib
MAYA_DEBUG_NO_SIGNAL_HANDLERS   1
MAYA_LOCATION                   /usr/autodesk/maya8.5-x64
</pre>
</li>
</p>
<p>
以上是必要的基本設定，其他部份的設定可參考自己需求修改。<br>參考資料
<a href="file:///usr/autodesk/maya/docs/Maya8.5/en_US/DeveloperResources/Using_a_debugger_to_debug_your_plugins.html">Using a debugger to debug your plug-ins</a>
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2008/04/09/index.html#e2008-04-09T01_14_21.txt</link>
<title>使用Eclipse開發Maya plugin的一些設定</title>
<dc:date>2008-04-09T01:14:21-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
在Linux的環境下，藉由Eclipe也可以直接設定程式專案來開發Maya
plug-in。對程式專案所需要的修改的設定和進行OpenGL專案的部份也很類似，但是稍微複雜些。這是因為在Compiler和Linker的部份參數較多。以下條列我目前發現需要修改的部份。需要注意的是，這只是針對單一plugin的撰寫，並不是建立一個build system。
</p>
<p>
首先當然要新增一個C++程式專案，並選擇專案型態為Shared
Library。在這個新專案中，修改其Project Properties中關於C/C++ Build的Settings部份。主要要增加的有：
<br>
C/C++ Build -> Settings -> GCC C++ Compiler -> Preprocessor:
在Defined symbols(-D)內加入_BOOL，LINUX, REQUIRE_IOSTREAM
<br>
C/C++ Build -> Settings -> GCC C++ Compiler -> Directories:
在Include paths (-I) 內加入Maya include
path（如：/usr/autodesk/maya8.5-x64/include）
<br>
C/C++ Build -> Settings -> GCC C++ Compiler -> Optimization:
在Other optimization flags欄位可加入"-pthread"或其他旗標
<br>
C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous:
在Other flags欄位，要加入"-fPIC"及"-fno-gnu-keywords"
<br>
以上這些是針對Compiler部份。以下則是針對Linker的部份<br>
<br>
C/C++ Build -> Settings -> GCC C++ Linker -> Libraries:
在Libraries(-l)這裡需要增加的項目其實是可多可少。全部都寫上也無不可。目前發現需要加入的有
<pre>
OpenMaya
OpenMayaRender
OpenMayaAnim
OpenMayaUI
OpenMayaFX
GL
GLU
glut
</pre>
在Library serach path(-L)的部份一樣需要加入Maya library
path（如：/usr/autodesk/maya8.5-x64/lib）
<br>
C/C++ Build -> Settings -> GCC C++ Linker -> Miscellaneous:
加入"-D_BOOL -DLINUX -DREQUIRE_IOSTREAM"
</p>
<p>
值得注意的是Debug的部份目前還沒找到好的作法。在Maya官方文件當中所提及的只有利用
<pre>
maya -d ddd
</pre>
的方式來使用ddd作為除錯的工具。
</p>
<p>
參考資料<a href="file:///usr/autodesk/maya/docs/Maya8.5/en_US/DeveloperResources/Writing_a_simple_plugin.html">Writing a Plugin</a>
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2008/04/07/index.html#e2008-04-07T15_22_19.txt</link>
<title>使用Eclipse進行OpenGL程式開發的基本設定</title>
<dc:date>2008-04-07T15:22:19-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
以下內容參考自<a href="http://www.ferdychristant.com/blog/articles/DOMM-72MPPE">Article:OpenGL programming in Eclipse</a>
</p>
<p>
要在Linux下利用Eclipse寫OpenGL相關的程式，可安裝GLUT或是SDL相關的開發套件。如果選用GLUT，需要安裝freeglut3-devel的函式庫。依據參考的那個網頁，在Eclipse新增一個C++的程式專案後，必須在GCC C++ Linker裡面增加一個glut的值。所以最方便的方法就是利用預設的C++專案後，再修改必要的地方。
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2006/12/07/index.html#e2006-12-07T17_18_42.txt</link>
<title>Mountains and Forests</title>
<dc:date>2006-12-07T17:18:42-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
<img src="http://studentpages.scad.edu/~yimchu20/pic/s1_land_rgb.jpg"><br>
This image is rendered by PRman. The shader of cloud is the default somke shader in RAT. The particle animation was baked as disk caches. Because the mountains and trees don't move, I exported them to a RIB archive and used them as instancing object. This made the final Maya binary file to keep a small size.
</p>
<p>
<img src="http://studentpages.scad.edu/~yimchu20/pic/s2_ground.jpg"><br>
This image was generated with three different images. Because I couldn't use Maya paint effects with MtoR, I rendered the paint effect plants by Maya software renderer separately. The ripples on the ground were modified from water drop paint effect. The rain drops is hardware rendered particles. Thanks my friend, Sung-man Pyun, for reminding me the default "particle collision event" function in Maya dynamic. When I made the dynamic rain, I also converted some of the paint effects plants into nurbs or polygon models for simulation.
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2006/10/18/index.html#e2006-10-18T05_19_41.txt</link>
<title>Interesting Reslut From Image Base Lighting </title>
<dc:date>2006-10-18T05:19:41-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
This picture is rendered with image base lighting by PRman. I use a HDRI sky image from Evermotion. This result is not really correct, but I like its abstract pattern with my L-system tree model. It is not photo-real but stylized.<br>
這種風格的東西其實蠻有意思的，某方面來說，是比較接近抽象繪畫的感覺。不過，目前我的畢業製作主要還是作具象的東西。<br>
<img src="http://studentpages.scad.edu/~yimchu20/pic/growing_tree.jpg"><br>
Reference:
<li>
<a href="http://www.evermotion.org/index.php?unfold_exclusive=84&unfold=exclusive">Free HDRI from Evermotion</a>
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2006/10/14/index.html#e2006-10-14T00_29_27.txt</link>
<title>Procedural Eye Ball</title>
<dc:date>2006-10-14T00:29:27-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[<p>
This procedural eye ball shader is modified from Larry Gritz's eyeball.sl and Matt Breit's eye shader. I keep the UV direction from Larry's shader and use Matt's idea for the iris and normal. Larry Gritz's original eyeball.sl can be found in the shader source if you install 3Delight renderer. I studied how they made the pattern for a eye ball and made a new version. This image is rendered by Pixie. There are some small black spots which may not happen in PRman.
<br>
<img src="http://studentpages.scad.edu/~yimchu20/pic/LGEyeBall_modify.jpg">
</p>
<p>
Reference:<br>
<li><a href="http://www.sfdm.scad.edu/faculty/mkesson/vsfx419/wip/best/fall04/matthew_breit/eyeball.html">Matt Breit's eye shader</a>
<li><a href="http://www.3delight.com/">3Delight renderman renderer</a>
<li><a href="http://www.cs.utexas.edu/~okan/Pixie/pixie.htm">Pixie Renderer</a>
</p>]]></description>
</item>
<item>
<link>http://studentpages.scad.edu/~yimchu20/weblog/archives/2006/10/04/index.html#e2006-10-04T23_06_46.txt</link>
<title>Double Side Leaf Renderman Shader</title>
<dc:date>2006-10-04T23:06:46-06:00</dc:date>
<dc:creator>Wesly Chu</dc:creator>
<dc:subject>3D CG</dc:subject>
<description><![CDATA[This is still a work in progress. I may put the shader source code on-line later.
<img src="http://studentpages.scad.edu/~yimchu20/pic/leaf_test07.jpg"><br>
I made this shader for the leaves of my tree models. It can use different textures for front and back sides of the model.<br>
<img src="http://studentpages.scad.edu/~yimchu20/pic/leaf_test10.jpg"><br>The deep shadow map function is already in this shader, and it also has translucent ability.
Reference:<br>
<li><a href="http://www.sfdm.scad.edu/faculty/mkesson/vsfx755/wip/best/spring2006/mayilan_krishnamoorthy/rsl_in_out.html">Mayilan Krishnamoorthy's Inside-Outside Shader</a>
<li><a href="http://www.sfdm.scad.edu/faculty/mkesson/vsfx755/wip/best/spring2006/zabu_stewart/a2/proj2.html">Zabu Stewart's experiments about translucent objects</a>
<br>
最近在建模上的進度實在緩慢，倒是這些shader做得越來越得心應手。]]></description>
</item>
</channel>
</rss>
