<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7112900122767691871</id><updated>2011-11-19T00:54:39.913-08:00</updated><category term='rendering'/><category term='aov'/><category term='jdbc'/><category term='renderman'/><category term='java'/><category term='mysql'/><category term='cygwin'/><category term='python'/><category term='slim template'/><category term='rib'/><category term='slim'/><category term='vim'/><category term='gnu'/><category term='slim scripting'/><category term='rat'/><category term='data base'/><category term='ipython'/><title type='text'>Will-Y</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-7108240884621096534</id><published>2010-04-04T01:36:00.000-07:00</published><updated>2011-11-01T06:53:37.494-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='ipython'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Vim plus IPython</title><content type='html'>&lt;span class="Apple-style-span" style="font-size: 29px; font-weight: bold;"&gt;Goal :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. &lt;/span&gt;Via &lt;b&gt;Vim&lt;/b&gt; to uniformize coding style for myself or a team.&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. &lt;/span&gt;Use &lt;b&gt;IPython&lt;/b&gt; to construct an integrated coding envieroment in CG film production. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;For uniformizing coding style(or building a rule), I use a simple &lt;b&gt;Vim&lt;/b&gt; &lt;b&gt;plug-in&lt;/b&gt; &lt;b&gt;&lt;a href="http://linux.softpedia.com/get/Text-Editing-Processing/Others/snippets-vim-36743.shtml"&gt;snippets.vim&lt;/a&gt;&lt;/b&gt; to design some useful &lt;b&gt;code snippets&lt;/b&gt;, such as main function formats for &lt;b&gt;python&lt;/b&gt;, &lt;b&gt;mel&lt;/b&gt; and &lt;b&gt;rfs(RealFlow script)&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Take a &lt;b&gt;mel&lt;/b&gt; snippet for example:&lt;br /&gt;&lt;pre style="background-color: #444444; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;"&gt;&lt;code&gt;// -*- coding: utf-8 -*-&lt;br /&gt;&lt;br /&gt;/*#&lt;br /&gt;&amp;nbsp; # Name :&lt;br /&gt;&amp;nbsp; # Author : &lt;br /&gt;&amp;nbsp; # Dep : &lt;br /&gt;&amp;nbsp; # Org : &lt;br /&gt;&amp;nbsp; # Date :&lt;br /&gt;&amp;nbsp; # Version :&lt;br /&gt;&amp;nbsp; #&lt;br /&gt;&amp;nbsp; # Description :&lt;br /&gt;&amp;nbsp; #&lt;br /&gt;&amp;nbsp; #*/&lt;br /&gt;&lt;br /&gt;global proc main () {&lt;br /&gt;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;&amp;nbsp; &lt;br /&gt;// vim: set sw=4 sts=4 et hls is si nu:&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is easy to get information of a python module in &lt;b&gt;IPython&lt;/b&gt;, just via &lt;b&gt;?&lt;/b&gt; and &lt;b&gt;??&lt;/b&gt; or &lt;b&gt;help&lt;/b&gt;. It is really helpful to write &lt;b&gt;docstrings&lt;/b&gt; for every module. But, what if we want to know something about &lt;b&gt;mel, rfs&lt;/b&gt; or &lt;b&gt;some other languages&lt;/b&gt;? &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;Once we build the rule for coding in any language, we can design a &lt;b&gt;IPython magic command&lt;/b&gt; to&lt;b&gt; &lt;/b&gt;read and show information of a code file(which was written in our rule), instead of print it all on screen or open it with an editor.&lt;/div&gt;&lt;br /&gt;Now, let's edit the &lt;b&gt;~/.ipython/ipy_user_conf.py&amp;nbsp; &lt;/b&gt;to add some custom magic commands:&lt;br /&gt;&lt;pre style="background-color: #444444; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;"&gt;&lt;code&gt;import IPython.ipapi&lt;br /&gt;ip = IPython.ipapi.get()&lt;br /&gt;&lt;br /&gt;def mel(self, arg):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; show info&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;&lt;br /&gt;ip.expose_magic("mel", mel)&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a demo of the mel magic command:&lt;/div&gt;&lt;pre style="background-color: #444444; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;"&gt;&lt;code&gt;In [1]: mel dosomething.mel&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Name : dosomething&lt;br /&gt;&amp;nbsp;Author : Willy Fan&lt;br /&gt;&amp;nbsp;Dep : TD&lt;br /&gt;&amp;nbsp;Org : @@a&lt;br /&gt;&amp;nbsp;Date : Apr 04 04:45 2010&lt;br /&gt;&amp;nbsp;Version : 1.0&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Description :&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This is a mel procedure that will do something...&lt;br /&gt;&lt;br /&gt; global string proc dosomething (string $action)&amp;nbsp; &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next, for building &lt;b&gt;environment&lt;/b&gt;, we can edit &lt;b&gt;/usr/bin/ipython&lt;/b&gt; or a custom wrapper, or, create a &lt;b&gt;python module&lt;/b&gt; for the wrapper to load&lt;b&gt;(for initializing)&lt;/b&gt;. In production or some tasks, there will be directories store some python modules that are often used, as a library. If these modules can be imported when we get into &lt;b&gt;IPython&lt;/b&gt;, or by a simple command, we can quickly get into work and use the facility of &lt;b&gt;tab completion&lt;/b&gt; to find modules we need.&lt;br /&gt;&lt;br /&gt;Here is an example while initializing:&lt;br /&gt;&lt;pre style="background-color: #444444; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;"&gt;&lt;code&gt;import IPython.ipapi&lt;br /&gt;ip = IPython.ipapi.get()&lt;br /&gt;&lt;br /&gt;#-----------------&lt;br /&gt;&lt;br /&gt;def importModules(paths):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip.ex( "import modules" )   #exec "import modules" &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;&lt;br /&gt;#-----------------&lt;br /&gt;&lt;br /&gt;import sys&lt;br /&gt;&lt;br /&gt;paths = [&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "path01",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "path02",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "path03",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;]&lt;br /&gt;&lt;br /&gt;sys.path += paths&lt;br /&gt;importModules(paths)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note that one should use &lt;b&gt;ip.ex( "import&amp;nbsp; modules" )&lt;/b&gt; instead of &lt;b&gt;exec "import modules" &lt;/b&gt;, or the imported modules will remain just within the local scope of &lt;b&gt;importModules&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;By making these efforts, we can use &lt;b&gt;Vim&lt;/b&gt; and &lt;b&gt;IPython&lt;/b&gt; to construct a simple integrated coding environment for &lt;b&gt;Python&lt;/b&gt;, &lt;b&gt;Maya&lt;/b&gt;, &lt;b&gt;RealFlow&lt;/b&gt;, &lt;b&gt;Nuke&lt;/b&gt;, and other 3D applications in a CG film production.&lt;br /&gt;&lt;span style="color: #3366ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #3366ff;"&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-7108240884621096534?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/7108240884621096534/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2010/04/coding-vim-plus-ipython-construct.html#comment-form' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/7108240884621096534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/7108240884621096534'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2010/04/coding-vim-plus-ipython-construct.html' title='Vim plus IPython'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-6506036206517041299</id><published>2009-11-01T06:55:00.000-08:00</published><updated>2011-11-01T07:26:13.561-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='data base'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='jdbc'/><title type='text'>JDBC and MySQL</title><content type='html'>（１）安裝MySQL：MySQL Community Server&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;下載位址：http://dev.mysql.com/downloads/#community-server&lt;br /&gt;安裝時設定Root密碼...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;（２）下載MySQL Connector/J：for connecting to MySQL from Java&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;下載位址：http://dev.mysql.com/downloads/#connector-j&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;（３）解壓縮MySQL Connector/J，自訂存放位置，設定環境變數中的CLASSPATH&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;存放位置如C:\Program Files\Java\MySQL Connector Java；設定CLASSPATH時輸入mysql-connector-java*.jar 所在位置的完整位址（有關CLASSPATH的資訊可問Google）&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;（４）進入MySQL Command Line Client：建立資料庫及使用者帳戶&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;這時須使用SQL語法：&lt;br /&gt;mysql&amp;gt;CREATE DATABASE myfirstdb;&lt;br /&gt;mysql&amp;gt;USE myfirstdb;&lt;br /&gt;mysql&amp;gt;CREATE USER ' willy ' @ ' localhost ' IDENTIFIED BY ' gygy9gy ' ;&lt;br /&gt;mysql&amp;gt;GRANT all ON myfirstdb TO ' willy ' @ ' localhost ' IDENTIFIED BY ' gygy9gy ' ;&lt;br /&gt;mysql&amp;gt;FLUSH PRIVILEGES;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;（５）撰寫Java程式來連接MySQL：&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;（６）連連看！&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-6506036206517041299?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/6506036206517041299/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2011/11/jdbc-and-mysql.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/6506036206517041299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/6506036206517041299'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2011/11/jdbc-and-mysql.html' title='JDBC and MySQL'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-757593906409699946</id><published>2009-05-03T10:54:00.000-07:00</published><updated>2011-11-01T07:25:09.170-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rib'/><category scheme='http://www.blogger.com/atom/ns#' term='rendering'/><category scheme='http://www.blogger.com/atom/ns#' term='rat'/><category scheme='http://www.blogger.com/atom/ns#' term='slim'/><category scheme='http://www.blogger.com/atom/ns#' term='renderman'/><title type='text'>Using RIB Archive</title><content type='html'>&lt;span style="font-size: 180%;"&gt;&lt;span style="font-weight: bold;"&gt;Goal :&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. &lt;/span&gt;Understand what is called &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt;?&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2.&lt;/span&gt; How to import &lt;span style="font-weight: bold;"&gt;RIB archives &lt;/span&gt;in&lt;span style="font-weight: bold;"&gt; RenderMan for Maya&lt;/span&gt;?&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3. &lt;/span&gt;How &lt;span style="font-weight: bold;"&gt;RIB archives&lt;/span&gt; work with &lt;span style="font-weight: bold;"&gt;RenderMan shaders&lt;/span&gt;?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Simply put, &lt;span style="font-weight: bold;"&gt;RIB&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;RenderMan Interface Bytestream)&lt;/span&gt; is a file format defined by the &lt;span style="font-weight: bold;"&gt;RenderMan Standard&lt;/span&gt;, while a &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt; is a &lt;span style="font-weight: bold;"&gt;RIB&lt;/span&gt; file contains description of a scene.&lt;br /&gt;&lt;br /&gt;Let us see what &lt;span style="font-weight: bold;"&gt;Pixar&lt;/span&gt; says:&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;One important use of the RIB protocol is to store a scene description in an archive file for rendering at a later time or in a remote location from the modeling application.*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large; font-weight: bold;"&gt;&lt;i&gt;Procedures:&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; Generating &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt;s:&lt;br /&gt;&lt;br /&gt;We could generate &lt;span style="font-weight: bold;"&gt;RIB &lt;/span&gt;archives by using some 3D programs like &lt;span style="font-weight: bold;"&gt;Maya &lt;/span&gt;(by &lt;span style="font-weight: bold;"&gt;Renderman for Maya&lt;/span&gt;) , &lt;span style="font-weight: bold;"&gt;Houdini&lt;/span&gt; and so on.&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/Sf99EJew1eI/AAAAAAAAAU8/41_PqFk6Y8E/s1600-h/1.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117994047854050" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/Sf99EJew1eI/AAAAAAAAAU8/41_PqFk6Y8E/s400/1.png" style="cursor: pointer; display: block; height: 292px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;Before exporting &lt;span style="font-weight: bold;"&gt;RIB archive, &lt;/span&gt;choose &lt;span style="font-weight: bold;"&gt;full path &lt;/span&gt;option may help us to avoid loading problem.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/Sf98o4CravI/AAAAAAAAAU0/wsQbUF2hwpA/s1600-h/2.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117525510187762" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/Sf98o4CravI/AAAAAAAAAU0/wsQbUF2hwpA/s400/2.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 317px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. &lt;/span&gt;Loading &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt;s in &lt;span style="font-weight: bold;"&gt;Maya&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;Create a&lt;span style="font-weight: bold;"&gt; locator&lt;/span&gt; (locators) or a &lt;span style="font-weight: bold;"&gt;polygon cube&lt;/span&gt; and then attach a &lt;span style="font-weight: bold;"&gt;RIBBox&lt;/span&gt; to them, where the locator or cube here represents the &lt;span style="font-weight: bold;"&gt;geometry&lt;/span&gt; loaded by &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt;.&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/Sf98omrd9BI/AAAAAAAAAUs/yp4cnE5Vz_g/s1600-h/3.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117520849433618" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/Sf98omrd9BI/AAAAAAAAAUs/yp4cnE5Vz_g/s400/3.png" style="cursor: pointer; display: block; height: 286px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;Create a &lt;span style="font-weight: bold;"&gt;RIBBox &lt;/span&gt;or a &lt;span style="font-weight: bold;"&gt;RIBBox&lt;/span&gt; connected to an &lt;span style="font-weight: bold;"&gt;Ensemble&lt;/span&gt; shader. After doing so, input codes as &lt;span style="color: red; font-weight: bold;"&gt;ReadArchive "RIB file name"&lt;/span&gt; for loading &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt;.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/Sf98oQgF0hI/AAAAAAAAAUk/OG2B3H5DLDg/s1600-h/4.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117514896134674" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/Sf98oQgF0hI/AAAAAAAAAUk/OG2B3H5DLDg/s400/4.png" style="cursor: pointer; display: block; height: 199px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;Attach the shader to the locater and render, we can see...&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/Sf98oEHn2wI/AAAAAAAAAUc/GK8iMqBvGD0/s1600-h/5.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117511572282114" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/Sf98oEHn2wI/AAAAAAAAAUc/GK8iMqBvGD0/s400/5.png" style="cursor: pointer; display: block; height: 308px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;For more flexibility, we can add more functions to the shader.&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/Sf98oPbsIcI/AAAAAAAAAUU/eoia40eU4NQ/s1600-h/6.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117514609238466" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/Sf98oPbsIcI/AAAAAAAAAUU/eoia40eU4NQ/s400/6.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 396px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;But, here comes a problem, image won't be changed as we wished after rendering.The additional functions won't be applied on the geometry for there has been a shader loaded from &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt; and applied on the geometry.&lt;br /&gt;&lt;br /&gt;Since the &lt;span style="font-weight: bold;"&gt;RIB archive&lt;/span&gt; can't be changed in the current &lt;span style="font-weight: bold;"&gt;Maya&lt;/span&gt; scene, we need to edit the&lt;span style="font-weight: bold;"&gt; RIB archive&lt;/span&gt; to reach our purpose.&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/SgCcBC6eONI/AAAAAAAAAVM/F8FLSrTDu9o/s1600-h/Untitled-1+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332433500582590674" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/SgCcBC6eONI/AAAAAAAAAVM/F8FLSrTDu9o/s400/Untitled-1+copy.png" style="cursor: pointer; display: block; height: 211px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;By marking the line that imports &lt;span style="font-weight: bold;"&gt;RenderMan&lt;/span&gt; shaders, the additional functions of the shader in the current scene can be applied to the geometry.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-jeFbtpbRyxI/TrAAwjHoa4I/AAAAAAAAA4U/mQClo6VS3SY/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="306" src="http://4.bp.blogspot.com/-jeFbtpbRyxI/TrAAwjHoa4I/AAAAAAAAA4U/mQClo6VS3SY/s400/8.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_bM8r-Tuvqco/Sf98Q9LOr5I/AAAAAAAAAUE/ax9GMNxr-6w/s1600-h/8.png" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117109506544322" src="http://3.bp.blogspot.com/_bM8r-Tuvqco/Sf98QqTrksI/AAAAAAAAAT0/X8drHTiuyw8/s400/10.png" style="display: block; height: 230px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/Sf98QTOGVqI/AAAAAAAAATs/KChWi8PwH_4/s1600-h/11.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332117103309117090" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/Sf98QTOGVqI/AAAAAAAAATs/KChWi8PwH_4/s400/11.png" style="cursor: pointer; display: block; height: 301px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;* These descriptions are quoted from &lt;b&gt;Pixar &lt;/b&gt;&lt;/span&gt;&lt;span style="color: #666666;"&gt;&lt;b&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;RenderMan Artist Tools 6.5 document&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-757593906409699946?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/757593906409699946/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/05/rendering-using-rib-archive-part-i.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/757593906409699946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/757593906409699946'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/05/rendering-using-rib-archive-part-i.html' title='Using RIB Archive'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bM8r-Tuvqco/Sf99EJew1eI/AAAAAAAAAU8/41_PqFk6Y8E/s72-c/1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-6606371970328321651</id><published>2009-04-24T22:52:00.000-07:00</published><updated>2011-11-01T07:24:21.083-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aov'/><category scheme='http://www.blogger.com/atom/ns#' term='rendering'/><category scheme='http://www.blogger.com/atom/ns#' term='rat'/><category scheme='http://www.blogger.com/atom/ns#' term='slim scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='renderman'/><title type='text'>Rendering Secondary Outputs (AOVs in RenderMan) - Part II</title><content type='html'>&lt;strong&gt;&lt;span style="font-size: 180%;"&gt;Goal :&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; While generating &lt;strong&gt;AOVs&lt;/strong&gt;, what is the relationsip between variables in &lt;strong&gt;SLBoxs&lt;/strong&gt; and &lt;strong&gt;secondary display settings&lt;/strong&gt; in &lt;strong&gt;RenderMan Globals(RG)&lt;/strong&gt;. &lt;br /&gt;&lt;strong&gt;2. &lt;/strong&gt;In &lt;strong&gt;Slim console&lt;/strong&gt;, using&lt;strong&gt; rmanctl &lt;/strong&gt;commands to manipulate &lt;strong&gt;secondary display settings&lt;/strong&gt; in &lt;strong&gt;RG&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For generating &lt;strong&gt;secondary outputs&lt;/strong&gt;, we can declare some &lt;strong&gt;variables&lt;/strong&gt; in &lt;strong&gt;SLBox&lt;/strong&gt; and give them some initial values and output values.&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4l1I2RI/AAAAAAAAATk/m4mOaV4l2KI/s1600-h/11.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5328965495662631186" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4l1I2RI/AAAAAAAAATk/m4mOaV4l2KI/s400/11.png" style="cursor: pointer; display: block; height: 322px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;&lt;/span&gt;&lt;br /&gt;What makes those variables be generated as so called &lt;strong&gt;AOVs&lt;/strong&gt; is the setting of &lt;strong&gt;secondary display&lt;/strong&gt; in &lt;strong&gt;RG&lt;/strong&gt;. &lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4a4s-kI/AAAAAAAAATc/zSiyi4bI93k/s1600-h/22.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5328965492724791874" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4a4s-kI/AAAAAAAAATc/zSiyi4bI93k/s400/22.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 285px;" /&gt;&lt;/a&gt;&lt;br /&gt;How to create new &lt;span style="font-weight: bold;"&gt;AOVs&lt;/span&gt; by setting &lt;span style="font-weight: bold;"&gt;RG&lt;/span&gt;? The standard procedures would be:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;Add a new&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;channel&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;: &lt;/span&gt;&lt;i&gt;&lt;span style="font-size: 100%;"&gt;The new&lt;/span&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt; channels&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; are those variables defined in the &lt;/span&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt;SLBox&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-weight: bold;"&gt;2. &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Add a new &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;secondary display:&lt;/span&gt;&amp;nbsp;&lt;i&gt;&lt;span style="font-size: 100%;"&gt;The name of the new&lt;/span&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt; display &lt;/span&gt;&lt;span style="font-size: 100%;"&gt;would be a part of the file name when images was rendered.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt;3. &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Setup &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;secondary display:&amp;nbsp;&lt;/span&gt;&lt;i&gt;Under the &lt;span style="font-weight: bold;"&gt;secondary display&lt;/span&gt; which we have created, we can deside what kind of &lt;span style="font-weight: bold;"&gt;type&lt;/span&gt; the&amp;nbsp;output file of the &lt;span style="font-weight: bold;"&gt;AOV&lt;/span&gt; should be generated by, and add &lt;span style="font-weight: bold;"&gt;channels&lt;/span&gt;  to this &lt;span style="font-weight: bold;"&gt;display&lt;/span&gt;.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;Now I will use&lt;span style="font-weight: bold;"&gt; rmanctl &lt;/span&gt;commands to setup &lt;span style="font-weight: bold;"&gt;AOV&lt;/span&gt;s in &lt;span style="font-weight: bold;"&gt;RG&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; In the beginning, we should get a list of their ids to prevent overwriting the existing values:&lt;/div&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl GetChannelIDs&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl GetDspyIDs&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #339999;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #33cc00;"&gt;&lt;span style="color: #009900;"&gt;&lt;i&gt;Commands above will return &lt;span style="font-weight: bold;"&gt;a string of ids&lt;/span&gt;, the &lt;span style="font-weight: bold;"&gt;id&lt;/span&gt; of new &lt;span style="font-weight: bold;"&gt;channels&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;displays&lt;/span&gt; should be greater than the last one in the list&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #33cc00;"&gt;&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4e1pzzI/AAAAAAAAATU/qwptnHCKM2U/s1600-h/33.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5328965493785743154" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4e1pzzI/AAAAAAAAATU/qwptnHCKM2U/s400/33.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 284px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. Add a new channel:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl InitChannel id&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl SetValue channelDspyMode_id {color glow_matte}&lt;/span&gt;&lt;br /&gt;&lt;div style="color: red;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #33cc00;"&gt;&lt;i&gt;&lt;span style="color: #009900;"&gt;where&lt;/span&gt;&lt;span style="color: #009900; font-weight: bold;"&gt; "id"&lt;/span&gt;&lt;span style="color: #009900;"&gt; here is based on the&lt;/span&gt;&lt;span style="color: #009900; font-weight: bold;"&gt; channel id list&lt;/span&gt;.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4J9vRAI/AAAAAAAAATM/Tq83JrXwVkE/s1600-h/44.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5328965488182510594" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4J9vRAI/AAAAAAAAATM/Tq83JrXwVkE/s400/44.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 284px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt;3. Add a new secondary display:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl InitDspy id&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl SetValue dspyName_id ball_matte&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl SetValue dspyMode_id glow_matte&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;rmanctl SetVlaue dspyType_id openexr&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #006600;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #33cc00;"&gt;&lt;i&gt;&lt;span style="color: #009900;"&gt;where&lt;/span&gt;&lt;span style="color: #009900; font-weight: bold;"&gt; "id"&lt;/span&gt;&lt;span style="color: #009900;"&gt; here is based on the&lt;/span&gt;&lt;span style="color: #009900; font-weight: bold;"&gt; display id list&lt;/span&gt;&lt;span style="color: #009900;"&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #009900;"&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4FzmjlI/AAAAAAAAATE/hMKUZYugnE8/s1600-h/55.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5328965487066254930" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4FzmjlI/AAAAAAAAATE/hMKUZYugnE8/s400/55.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 284px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt;4&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;. &lt;/span&gt;For adding more than one&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;channel&lt;/span&gt;, use &lt;span style="font-weight: bold;"&gt;commas&lt;/span&gt; to separate &lt;span style="font-weight: bold;"&gt;modes&lt;/span&gt;:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: orange;"&gt;rmanctl SetValue dspyMode_id&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span style="color: #e69138; font-style: italic;"&gt;glow_matte,body_matte,a,...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, &lt;span style="font-weight: bold;"&gt;rmanctl &lt;/span&gt;commands are not documented in the manual of &lt;span style="font-weight: bold;"&gt;Pixar RAT&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;RMS&lt;/span&gt;.&lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;/span&gt;But we still can get some informations by typing&lt;span style="font-weight: bold;"&gt; rmanctl&lt;/span&gt; in &lt;span style="font-weight: bold;"&gt;Slim console.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #3366ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #3366ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #3366ff;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-6606371970328321651?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/6606371970328321651/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/rendering-generating-secondary-outputs.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/6606371970328321651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/6606371970328321651'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/rendering-generating-secondary-outputs.html' title='Rendering Secondary Outputs (AOVs in RenderMan) - Part II'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bM8r-Tuvqco/SfRJ4l1I2RI/AAAAAAAAATk/m4mOaV4l2KI/s72-c/11.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-1109121851081110746</id><published>2009-04-17T08:13:00.000-07:00</published><updated>2011-11-01T07:18:11.144-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aov'/><category scheme='http://www.blogger.com/atom/ns#' term='rendering'/><category scheme='http://www.blogger.com/atom/ns#' term='rat'/><category scheme='http://www.blogger.com/atom/ns#' term='renderman'/><title type='text'>Rendering Secondary Outputs (AOVs in RenderMan) - Part I</title><content type='html'>&lt;span style="font-size: 180%; font-weight: bold;"&gt;Goal :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; Understand what is called &lt;span style="font-weight: bold;"&gt;Secondary Output (AOV)&lt;/span&gt;.&lt;br /&gt;&lt;b&gt; 2. &lt;/b&gt;Realize the process how to generate &lt;span style="font-weight: bold;"&gt;AOVs &lt;/span&gt;when rendering passes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Pixar&lt;/span&gt; says:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span style="color: #cc0000; font-size: 100%;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt; Secondary outputs are also called &lt;span style="font-style: italic;"&gt;Arbitrary Output Variables&lt;/span&gt;, or &lt;span style="font-style: italic;"&gt;AOVs&lt;/span&gt;. These outputs are not rendered in multiple passes, but are created at the same time the main image is being rendered&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;.*&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we are about to render an image and generate its &lt;span style="font-weight: bold;"&gt;AOV&lt;/span&gt;s.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. &lt;/span&gt;Create a &lt;span style="font-weight: bold;"&gt;Maya geometry&lt;/span&gt;, a cube for example:&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNmUdhgXI/AAAAAAAAAS8/t0ak7RSZQmw/s1600-h/01+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084461297762674" src="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNmUdhgXI/AAAAAAAAAS8/t0ak7RSZQmw/s400/01+copy.png" style="cursor: pointer; display: block; height: 284px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;2. &lt;/span&gt;Create &lt;span style="font-weight: bold;"&gt;RenderMan shaders&lt;/span&gt; (&lt;span style="font-weight: bold;"&gt;Ensemble&lt;/span&gt; with &lt;span style="font-weight: bold;"&gt;surface&lt;/span&gt; property connected to a &lt;span style="font-weight: bold;"&gt;Delux&lt;/span&gt;) and attach them to the &lt;span style="font-weight: bold;"&gt;Maya geometry&lt;/span&gt;:&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNmHsO7OI/AAAAAAAAAS0/bkXCshPdt0Y/s1600-h/02+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084457869798626" src="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNmHsO7OI/AAAAAAAAAS0/bkXCshPdt0Y/s400/02+copy.png" style="cursor: pointer; display: block; height: 178px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;3. &lt;/span&gt;Create &lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt; and Edit &lt;span style="font-weight: bold;"&gt;RenderMan Globals(RG)&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;Instead of adding new &lt;span style="font-weight: bold;"&gt;secondary outputs&lt;/span&gt; in &lt;span style="font-weight: bold;"&gt;RG &lt;/span&gt;by hand, I would like to use my AOV creating tool to finish this step, for the reason that I want to introduce something about&lt;span style="font-weight: bold;"&gt; rmanctl&lt;/span&gt; command, which can help us to control &lt;span style="font-weight: bold;"&gt;secondary outputs&lt;/span&gt; in &lt;span style="font-weight: bold;"&gt;RG&lt;/span&gt; by coding. See &lt;a href="http://liberoxp.blogspot.com/2009/04/rendering-generating-secondary-outputs.html"&gt;&lt;span style="font-weight: bold;"&gt;Part II&lt;/span&gt;&lt;/a&gt; of this article.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNl2HQ1TI/AAAAAAAAASs/PxAzzVbTrlo/s1600-h/03+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084453151331634" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNl2HQ1TI/AAAAAAAAASs/PxAzzVbTrlo/s400/03+copy.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 312px;" /&gt;&lt;/a&gt;Select &lt;span style="font-weight: bold;"&gt;Delux shaders &lt;/span&gt;and declare &lt;span style="font-weight: bold;"&gt;AOV title&lt;/span&gt;, variable &lt;span style="font-weight: bold;"&gt;types&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;names&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;initial values&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;output values&lt;/span&gt;.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNl_NEVWI/AAAAAAAAASk/4nQvrYBEAQU/s1600-h/04+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084455591597410" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNl_NEVWI/AAAAAAAAASk/4nQvrYBEAQU/s400/04+copy.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 322px;" /&gt;&lt;/a&gt;After pushing "Add AOV" button, a &lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;shading component&lt;/span&gt; with contents shown below will be created and connected to each &lt;span style="font-weight: bold;"&gt;Delux shader&lt;/span&gt; . There are three &lt;span style="font-weight: bold;"&gt;Delux shaders&lt;/span&gt;, each represents the &lt;span style="font-weight: bold;"&gt;surface appearance&lt;/span&gt; of the specific faces of the cube. &lt;a href="http://liberoxp.blogspot.com/2009/04/slim-add-slbox-to-delux_09.html"&gt;(How to add SLBox in Delux shader?)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;faceA with output &lt;span style="font-weight: bold;"&gt;(1,0,0) &lt;/span&gt;as &lt;span style="font-weight: bold;"&gt;red&lt;/span&gt;&lt;br /&gt;faceB with output &lt;span style="font-weight: bold;"&gt;(0,1,0)&lt;/span&gt; as &lt;span style="font-weight: bold;"&gt;green&lt;/span&gt;&lt;br /&gt;faceC with output &lt;span style="font-weight: bold;"&gt;(0,0,1)&lt;/span&gt; as &lt;span style="font-weight: bold;"&gt;blue&lt;/span&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNZ0sISGI/AAAAAAAAASU/vwICz3iZSK4/s1600-h/55.png+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084246610659426" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNZ0sISGI/AAAAAAAAASU/vwICz3iZSK4/s400/55.png+copy.png" style="cursor: pointer; display: block; height: 205px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;Let us go to &lt;span style="font-weight: bold;"&gt;RG&lt;/span&gt;, the&lt;span style="font-weight: bold;"&gt; secondary outputs&lt;/span&gt; have already been created. The picture shown below will show us that in our&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;rendered &lt;span style="font-weight: bold;"&gt;pass&lt;/span&gt;, there will be an &lt;span style="font-weight: bold;"&gt;openexr&lt;/span&gt; image with "matte" in its file name, and four &lt;span style="font-weight: bold;"&gt;channels&lt;/span&gt; in this image. Now we can setup and render.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNaKDrTrI/AAAAAAAAASc/C2FYTeNCYWs/s1600-h/05+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084252346568370" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/SeoNaKDrTrI/AAAAAAAAASc/C2FYTeNCYWs/s400/05+copy.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 283px;" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;4. &lt;/span&gt;After the render job was finished, search the images by &lt;span style="font-weight: bold;"&gt;Apple Shake&lt;/span&gt;, we can see that "test.0001.tif " and " test_bty.0001.exr " are our &lt;span style="font-weight: bold;"&gt;primary outputs&lt;/span&gt;, " test_matte.0001.exr " is our &lt;span style="font-weight: bold;"&gt;secondary output&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Open " test_matte.0001.exr ":&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNZ7zfHcI/AAAAAAAAASM/dKl1bq7Refs/s1600-h/06+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084248520564162" src="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNZ7zfHcI/AAAAAAAAASM/dKl1bq7Refs/s400/06+copy.png" style="cursor: pointer; display: block; height: 277px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;5. &lt;/span&gt;By checking out the &lt;span style="font-weight: bold;"&gt;property panel&lt;/span&gt; of this image, we can see the &lt;span style="font-weight: bold;"&gt;channels&lt;/span&gt; contained in the image. Let us select red channel of faceA, green channel of faceB and blue channel of faceC.&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNZoK8oNI/AAAAAAAAASE/Kobex1f6mJw/s1600-h/07+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084243250258130" src="http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNZoK8oNI/AAAAAAAAASE/Kobex1f6mJw/s400/07+copy.png" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 380px;" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt; &lt;br /&gt;6. &lt;/span&gt;This is our &lt;span style="font-weight: bold;"&gt;secondary outputs&lt;/span&gt;, quite simple and easy, isn't it?&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/SeoNZl6uUAI/AAAAAAAAAR8/t9Q1frTBpic/s1600-h/08+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326084242645340162" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/SeoNZl6uUAI/AAAAAAAAAR8/t9Q1frTBpic/s400/08+copy.png" style="cursor: pointer; display: block; height: 298px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the end, while &lt;span style="font-weight: bold;"&gt;rendering passes&lt;/span&gt;, it will be very valuable for &lt;span style="font-weight: bold;"&gt;compositing&lt;/span&gt; if we define some special &lt;span style="font-weight: bold;"&gt;AOVs&lt;/span&gt;. With these proper &lt;span style="font-weight: bold;"&gt;AOVs&lt;/span&gt;, &lt;span style="font-style: italic; font-weight: bold;"&gt;compositing can be more flexible&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #003366; font-family: Verdana; line-height: 19px;"&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;* These descriptions are quoted from &lt;strong&gt;Pixar &lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #666666;"&gt;&lt;strong&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;RenderMan Artist Tools 6.5 document&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-1109121851081110746?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/1109121851081110746/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-generating-aov.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/1109121851081110746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/1109121851081110746'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-generating-aov.html' title='Rendering Secondary Outputs (AOVs in RenderMan) - Part I'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bM8r-Tuvqco/SeoNmUdhgXI/AAAAAAAAAS8/t0ak7RSZQmw/s72-c/01+copy.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-4066552529672819338</id><published>2009-04-16T11:11:00.000-07:00</published><updated>2011-11-01T05:18:21.722-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='slim scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='renderman'/><category scheme='http://www.blogger.com/atom/ns#' term='slim template'/><title type='text'>RAT6.5 : Add SLBox in Delux - Part IV</title><content type='html'>&lt;strong&gt;&lt;/strong&gt;&lt;span style="font-size: 180%;"&gt;&lt;strong&gt;Goal :&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;From viewing &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;slim.ini&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;.&lt;/span&gt;&lt;strong&gt;slim &lt;span class="Apple-style-span" style="font-weight: normal;"&gt;file&lt;/span&gt;&lt;/strong&gt; to understand the details of the command structure like&lt;br /&gt;&lt;strong&gt;::Slim::CustomUI::pixar::AddParam::AddParam&lt;/strong&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; arg arg&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;To reach the goal, let us take a view in &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;slim.ini&lt;/span&gt; first. The code shown below is the first line written in the &lt;strong&gt;slim.ini&lt;/strong&gt;, where &lt;strong&gt;::Slim&lt;/strong&gt; is a &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;global namespace&lt;/span&gt;.&lt;span class="Apple-style-span" style="color: #0000ee;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_bM8r-Tuvqco/SennL_2WRVI/AAAAAAAAAPk/SxjMNjh4U58/s1600-h/namespace.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326042227646285138" src="http://1.bp.blogspot.com/_bM8r-Tuvqco/SennL_2WRVI/AAAAAAAAAPk/SxjMNjh4U58/s400/namespace.png" style="cursor: pointer; height: 40px; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;The following picture shows that there are many .&lt;strong&gt;slim files&lt;/strong&gt; defined to build &lt;strong&gt;custom user interface(customui).&lt;/strong&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/Senn4FtAJEI/AAAAAAAAAPs/PC9TJutDVm8/s1600-h/customui.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326042985131942978" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/Senn4FtAJEI/AAAAAAAAAPs/PC9TJutDVm8/s400/customui.png" style="cursor: pointer; height: 216px; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As for the reason why wasn't it written as &lt;strong&gt;CustomUI&lt;/strong&gt;, it might be defined in a file somewhere (I haven't found it yet...), but we can find some information in the&lt;strong&gt; Slim scripting document:&lt;/strong&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;CustomUIs are defined on Collection properties. These methods access the CustomUI information for a collection.*&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: orange;"&gt;collh &lt;span style="font-weight: bold;"&gt;GetCustomUIVendor&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: orange;"&gt;collh &lt;span style="font-weight: bold;"&gt;GetCustomUIName&lt;/span&gt;&lt;br /&gt;collh &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: orange;"&gt;GetCustomUIModes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;Let us see how to use these commands:&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #0000ee;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/SenpmthmxBI/AAAAAAAAAQE/wNME5YljFPY/s1600-h/presentation.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326044885607171090" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/SenpmthmxBI/AAAAAAAAAQE/wNME5YljFPY/s400/presentation.png" style="cursor: pointer; height: 252px; width: 400px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;As we can see, when invoking c&lt;span class="Apple-style-span" style="font-style: italic;"&gt;oll0&lt;/span&gt; by &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;GetCustomUIVendor&lt;/span&gt;, we get &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;pixar&lt;/span&gt;, and by &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;GetCustomUIName&lt;/span&gt; we get &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;AddParam. &lt;/span&gt;(I will not talk about &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;CustomUIModes&lt;/span&gt; since I haven't found information about it)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now we should have a rough picture about &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;::Slim::CustomUI::pixar::AddParam::&lt;/span&gt; as &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;[global namespace] + [defined command] + [UI vendor] + [UI name] &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;The additional &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;AddParam&lt;/span&gt;, as the final member of the command, can not be seen in the picture shown above. (where the result of &lt;span class="Apple-style-span" style="font-style: italic;"&gt;coll0 GetName is&lt;/span&gt; not what we are looking for)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Go to &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Pixar installation folder&lt;/span&gt; and search for &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;addparamui.slim&lt;/span&gt;, we can find information to prove the conclusion described above:&lt;span class="Apple-style-span" style="color: #0000ee;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_bM8r-Tuvqco/Senl2UDvSAI/AAAAAAAAAPc/qMdhOYT6eVM/s1600-h/addparam.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326040755602409474" src="http://4.bp.blogspot.com/_bM8r-Tuvqco/Senl2UDvSAI/AAAAAAAAAPc/qMdhOYT6eVM/s400/addparam.png" style="cursor: pointer; height: 182px; width: 305px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;See &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;pixar&lt;/span&gt; is upon &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;AddParam&lt;/span&gt; in hierarchy, and &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;AddParam&lt;/span&gt; is declared as a &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;customui&lt;/span&gt;. In the bottom of the codes, we can find a procedure called &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;AddParam&lt;/span&gt; and this is the last member we are looking for, thank god !!&lt;span class="Apple-style-span" style="color: #0000ee;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/Senpml9AM-I/AAAAAAAAAQM/-z6fj_-6vf0/s1600-h/procedure.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326044883574600674" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/Senpml9AM-I/AAAAAAAAAQM/-z6fj_-6vf0/s400/procedure.png" style="cursor: pointer; height: 88px; width: 400px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;The two parameters are &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;collection&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;type&lt;/span&gt;&lt;span class="Apple-style-span"&gt; (and additional prefix string)&lt;/span&gt; , that is why we take the two arguments as &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;componentcontainer(collection)&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;shadingcomponent(type)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #003366; font-family: Verdana; line-height: 19px;"&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;* These descriptions are quoted from &lt;strong&gt;Pixar &lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #666666;"&gt;&lt;strong&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;RenderMan Artist Tools 6.5 document&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-4066552529672819338?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/4066552529672819338/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-scripting-add-slbox-in-delux-part_16.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/4066552529672819338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/4066552529672819338'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-scripting-add-slbox-in-delux-part_16.html' title='RAT6.5 : Add SLBox in Delux - Part IV'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bM8r-Tuvqco/SennL_2WRVI/AAAAAAAAAPk/SxjMNjh4U58/s72-c/namespace.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-2393635331781966265</id><published>2009-04-14T07:45:00.000-07:00</published><updated>2011-11-01T05:18:07.725-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='slim scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='renderman'/><title type='text'>RAT6.5 : Add SLBox in Delux - Part III</title><content type='html'>&lt;span style="font-size: 180%; font-weight: bold;"&gt;Goal :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; Understand how to use &lt;span style="font-weight: bold;"&gt;template&lt;/span&gt;.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2.&lt;/span&gt; Understand &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;property&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-weight: bold;"&gt; object&lt;/span&gt; and &lt;/span&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt;details&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; of the property, &lt;/span&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt;GetDetail&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; and &lt;/span&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt;SetDetail&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; of property commands.&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #3366ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Slim template:&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;Slim uses &lt;/span&gt;&lt;i style="color: #cc0000;"&gt;templates&lt;/i&gt;&lt;span style="color: #cc0000;"&gt; to define the functions that are combined and manipulated in order to create custom shaders.*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The default templates are defined and stored in &lt;span style="font-weight: bold;"&gt;Pixar RenderMan for Maya&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; installation folder&lt;/span&gt;, search for &lt;span style="font-weight: bold;"&gt;slim.ini&lt;/span&gt; to get a list of templates to use. Here are a few commands that shows us how to use &lt;span style="font-size: 0px;"&gt;template&lt;/span&gt;, it's simple and easy:&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;$plt CreateInstance -template "pixar,Ensemble#0"&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &amp;nbsp;&lt;/span&gt;--&amp;gt;&amp;nbsp;create an appearance&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: orange;"&gt;$app GetTemplate&lt;/span&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;--&amp;gt; &amp;nbsp;get its template&lt;/i&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;slim GetAppearances -template pixar*&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &amp;nbsp;&lt;/span&gt;--&amp;gt;&lt;span style="color: orange; font-weight: bold;"&gt; &amp;nbsp;&lt;/span&gt;get appearances build by the template&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;slim GetTemplates -type "color" &amp;nbsp;&lt;/span&gt;--&amp;gt; &amp;nbsp;list &lt;span style="font-weight: bold;"&gt;active&lt;/span&gt; template by "shadingcomponent" type&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;According to the description above, &lt;b&gt;S&lt;/b&gt;&lt;span style="font-weight: bold;"&gt;lim template&lt;/span&gt; is used to create custom shaders. What are the connections between &lt;span style="font-weight: bold;"&gt;template&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;appearance&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;shader&lt;/span&gt;? Let's see how Pixar describes about them:&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;A shader is the principal procedural entity and an appearance is a description of &lt;/span&gt;&lt;i style="color: #cc0000;"&gt;how&lt;/i&gt;&lt;span style="color: #cc0000;"&gt; to invoke the procedur&lt;span style="color: #cc0000;"&gt;e&lt;/span&gt;.&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So here comes a conclusion that we create&lt;span style="font-weight: bold;"&gt; functions&lt;/span&gt; from defined &lt;span style="font-weight: bold;"&gt;templates&lt;/span&gt; as the so called &lt;span style="font-weight: bold;"&gt;appearances&lt;/span&gt;, and we organize these appearances (&lt;span style="font-weight: bold;"&gt;compile&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;them&lt;/span&gt;) to become&lt;span style="font-weight: bold;"&gt; a shader&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;shaders&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large; font-weight: bold;"&gt;&lt;i&gt;Property Object:&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Property is a base class representing the Parameters, Collections and Attributes inside of an appearance.*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Each property has its own detail, the detail can be :&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;uniform&lt;/span&gt;&amp;nbsp; --&amp;gt; &amp;nbsp;cannot be connected to a function&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;varying&lt;/span&gt;&amp;nbsp; --&amp;gt; &amp;nbsp;can be connected to a function&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;must vary&lt;/span&gt;&amp;nbsp; --&amp;gt; &amp;nbsp;must be connected to a function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After a parameter or a collection was created, its detail would be &lt;span style="font-weight: bold;"&gt;uniform&lt;/span&gt; by default, if we set it to be &lt;span style="font-weight: bold;"&gt;mustvary&lt;/span&gt;, we get some changes :&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="color: black;"&gt; &lt;span style="color: red; font-weight: bold;"&gt;set parm [$app NewParameter color "v7"]&lt;/span&gt;&lt;span style="color: red; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/Senqxx9vm_I/AAAAAAAAAQk/5S1f21Re_5A/s1600-h/color.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326046175289121778" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/Senqxx9vm_I/AAAAAAAAAQk/5S1f21Re_5A/s400/color.png" style="cursor: pointer; height: 40px; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;$parm SetDetail mustvary&lt;/span&gt;&lt;span style="color: red; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/Senqxm-geXI/AAAAAAAAAQc/PKZfgaOu4_k/s1600-h/mustvary.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326046172339534194" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/Senqxm-geXI/AAAAAAAAAQc/PKZfgaOu4_k/s400/mustvary.png" style="cursor: pointer; height: 40px; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;&lt;br /&gt;$parm SetDetail uniform&amp;nbsp;&lt;span class="Apple-style-span" style="color: black; font-weight: normal;"&gt;(Its color won't be recovered)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_bM8r-Tuvqco/SenrFXUS7iI/AAAAAAAAAQs/yo-YWr39AAU/s1600-h/uniform_2.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326046511733337634" src="http://3.bp.blogspot.com/_bM8r-Tuvqco/SenrFXUS7iI/AAAAAAAAAQs/yo-YWr39AAU/s400/uniform_2.png" style="cursor: pointer; float: left; height: 40px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;* These descriptions are quoted from &lt;strong&gt;Pixar &lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #666666;"&gt;&lt;strong&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;RenderMan Artist Tools 6.5 document&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-2393635331781966265?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/2393635331781966265/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-scripting-add-slbox-in-delux-part.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/2393635331781966265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/2393635331781966265'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-scripting-add-slbox-in-delux-part.html' title='RAT6.5 : Add SLBox in Delux - Part III'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bM8r-Tuvqco/Senqxx9vm_I/AAAAAAAAAQk/5S1f21Re_5A/s72-c/color.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-7963672976811448083</id><published>2009-04-12T08:56:00.000-07:00</published><updated>2011-11-01T04:53:59.030-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='slim scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='renderman'/><title type='text'>RAT6.5 : Add SLBox in Delux - Part II</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 180%;"&gt;Goal :&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 180%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Understand &lt;span style="font-weight: bold;"&gt;Collection object&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;Parameter object&lt;/span&gt; in Slim scripting.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Actually, there is another way to achieve the goal mentioned in &lt;a href="http://liberoxp.blogspot.com/2009/04/slim-add-slbox-to-delux_09.html"&gt;Part I&lt;/a&gt;. There exists some critical points by using this way.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After calling a Delux shader:&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;set newprop [$delux NewParameter shadingcomponent "v1"]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: orange;"&gt;(eval) $newprop SetDetail mustvary "pixar,C_SLBox#0 (inlline)"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: orange;"&gt;&lt;span style="font-weight: bold;"&gt;$newprop SetConnection [$slbox GetID] &lt;/span&gt;　&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;No matter how hard we try, what we've got is a shading component connected to a SLBox with no &lt;b&gt;inline&lt;/b&gt; state. You can say that at least we've created a connection successfully. But, If we type the following commands:&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;set container [$delux GetProperties -name "componentcontainer"]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;$container GetChildren&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;These commands will show us how many children are under the &lt;span style="font-weight: bold;"&gt;component container&lt;/span&gt;, and&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;our shading component is not here.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Component container&lt;/span&gt; contains &lt;span style="font-weight: bold;"&gt;collections&lt;/span&gt;, and what we've created is&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;a &lt;span style="font-weight: bold;"&gt;parameter&lt;/span&gt;. They are different&lt;span style="font-weight: bold;"&gt; objects&lt;/span&gt; in &lt;span style="font-weight: bold;"&gt;Slim scripting&lt;/span&gt;. Let us see how Pixar describe them:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;i&gt;Collection Object:&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Collection objects are used to group Parameters and Attributes. Since they do not have a value.*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;i&gt;Parameter Object:&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;What sets the Parameter class apart from other subclasses is its existence inside of the shader. It is for this reason that the methods specific to Parameter are oriented toward its presencing in shading language.*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Therefore, We can use &lt;span style="font-weight: bold;"&gt;NewCollection&lt;/span&gt; to generate a new collection, and use &lt;span style="font-weight: bold;"&gt;NewParameter&lt;/span&gt; to add parameters under the collection.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;* These descriptions are quoted from &lt;strong&gt;Pixar &lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #666666;"&gt;&lt;strong&gt;&lt;span style="color: #cc0000; font-size: 85%;"&gt;RenderMan Artist Tools 6.5 document&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-7963672976811448083?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/7963672976811448083/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-add-slbox-in-delux-part-ii.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/7963672976811448083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/7963672976811448083'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-add-slbox-in-delux-part-ii.html' title='RAT6.5 : Add SLBox in Delux - Part II'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-4768916892887507196</id><published>2009-04-10T11:07:00.000-07:00</published><updated>2011-11-01T04:53:41.674-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='slim scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='renderman'/><title type='text'>RAT6.5 : Add SLBox in Delux - Part I</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 180%;"&gt;Goal :&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;1. &lt;/span&gt;Within a &lt;span style="font-weight: bold;"&gt;Delux&lt;/span&gt; shader, create a new property of&lt;span style="font-weight: bold;"&gt; shading component&lt;/span&gt; type.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. &lt;/span&gt;Make it connect to a  &lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt; function with &lt;span style="font-weight: bold;"&gt;inline&lt;/span&gt; state, as "v1" in the picture shown below.&lt;br /&gt;&lt;br /&gt;(&lt;span style="font-weight: bold;"&gt;"inline"&lt;/span&gt; means we can deal with the &lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt; function within &lt;span style="font-weight: bold;"&gt;Delux&lt;/span&gt; shader without actually going into the &lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt; node)&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/SeINrxSmtQI/AAAAAAAAAEE/pd5WrFeNjMY/s1600-h/slbox+in+delux+copy.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5323832755122255106" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/SeINrxSmtQI/AAAAAAAAAEE/pd5WrFeNjMY/s400/slbox+in+delux+copy.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 364px;" /&gt;&lt;/a&gt;This instruction is based on &lt;span style="font-weight: bold;"&gt;RenderMan Artists Tools 6.5&lt;/span&gt;&amp;nbsp;on&amp;nbsp;&lt;span style="font-weight: bold;"&gt;Linux&lt;/span&gt;&amp;nbsp;system.&amp;nbsp;Let's select a &lt;span style="font-weight: bold;"&gt;Delux&lt;/span&gt; node and find the property called &lt;span style="font-weight: bold;"&gt;component container&lt;/span&gt;.&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;There are at least ways for creating a new &lt;span style="font-weight: bold;"&gt;shading component &lt;/span&gt;property:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. &lt;/span&gt;By using the following command:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;　&lt;/span&gt;&lt;span style="font-size: 16px;"&gt;&lt;span style="color: orange; font-weight: bold;"&gt;set newprop [$container NewCollection shadingcomponent "v1"]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. &lt;/span&gt;By using the following commands:&lt;br /&gt;&lt;span style="font-size: 100%;"&gt; 　&lt;span style="color: orange; font-weight: bold;"&gt;set command &lt;/span&gt;&lt;/span&gt;&lt;span style="color: orange; font-weight: bold;"&gt;"::Slim::CustomUI::pixar::AddParam::AddParam"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: orange; font-weight: bold;"&gt;　set newprop [$command $container shadingcomponent]&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using method&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;1&lt;/span&gt;, we need to assign a &lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt; function to the property and make it be &lt;span style="font-weight: bold;"&gt;inline&lt;/span&gt; state:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;　&lt;span class="Apple-style-span" style="color: orange;"&gt;eval $newprop SetDetail mustvary "pixar,C_SLBox#0 inline"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using method&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;2&lt;/span&gt;, we just need to change the function type &lt;span style="font-weight: bold;"&gt;diffuse&lt;/span&gt; to &lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt;:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;　&lt;span style="color: orange; font-size: 100%;"&gt;$newprop SetDetail mustvary "pixar,C_SLBox#0"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the end, we just need to &lt;span style="font-weight: bold;"&gt;set connection &lt;/span&gt;between&lt;span style="font-weight: bold;"&gt; the parameter &lt;/span&gt;and&lt;span style="font-weight: bold;"&gt; the &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;SLBox&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;node. The following shows TCL version and Python version of codes to do this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;u&gt;&lt;span style="font-weight: bold;"&gt;TCL&lt;/span&gt; version, executed in&lt;span style="font-weight: bold;"&gt; Slim console&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bM8r-Tuvqco/Sens15xQHkI/AAAAAAAAARE/NGZuWNw_m40/s1600-h/tcl.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326048445126942274" src="http://3.bp.blogspot.com/_bM8r-Tuvqco/Sens15xQHkI/AAAAAAAAARE/NGZuWNw_m40/s400/tcl.png" style="cursor: pointer; display: block; height: 331px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;u&gt;&lt;i&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;u&gt;&lt;span style="font-weight: bold;"&gt;Python&lt;/span&gt; version,&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;executed in &lt;span style="font-weight: bold;"&gt;Maya&lt;/span&gt; with &lt;span style="font-weight: bold;"&gt;Mtor Slim command&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_bM8r-Tuvqco/Sens1x5jRYI/AAAAAAAAARM/BlPPLgH42ls/s1600-h/py.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326048443014268290" src="http://2.bp.blogspot.com/_bM8r-Tuvqco/Sens1x5jRYI/AAAAAAAAARM/BlPPLgH42ls/s400/py.png" style="cursor: pointer; display: block; height: 212px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;tcl&gt;&lt;mel&gt;&lt;python&gt;&lt;br /&gt;&lt;/python&gt;&lt;/mel&gt;&lt;/tcl&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-4768916892887507196?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/4768916892887507196/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-add-slbox-to-delux_09.html#comment-form' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/4768916892887507196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/4768916892887507196'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/slim-add-slbox-to-delux_09.html' title='RAT6.5 : Add SLBox in Delux - Part I'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bM8r-Tuvqco/SeINrxSmtQI/AAAAAAAAAEE/pd5WrFeNjMY/s72-c/slbox+in+delux+copy.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-7631043325446432889</id><published>2009-04-09T10:33:00.000-07:00</published><updated>2011-11-01T04:14:12.964-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Key word : this</title><content type='html'>在以下類別繼承的架構下，設計每一個子類別都有印出自己和父類別的方法，當宣告 B myB = new B() 時，呼叫 myB.showAB() 可以順利印出 "AB"！　&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;但當宣告 C myC = new C() 時，呼叫 myC.showABC() 卻印出 "ACC"！！&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;class A {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void show() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.print("A");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class B extends A {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void show() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.print("B");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void showAB() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super.show();－－－－－－－印出A&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.show();－－－－－－－－印出B&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class C extends B {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void show() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.print("C");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void showABC() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super.showAB();－－－－－－印出AC&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.show();－－－－－－－－印出C&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ｝&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;原因在於宣告 C myC = new C() 時，myC.showABC() 呼叫了super.showAB()，而B類別的 showAB() 中所執行的this.show() 事實上卻是呼叫C類別所override的 show() 方法，故印出C！&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;結論：&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;一 般 this 所指的是所在類別的物件參考，但事實上如同 this 字面上所傳達的訊息：我並沒有參考到特定的物件，那麼 this 廣義來看應該是參考到所創建的物件，如 C myC = new C() 時，父類別的 this 是參考到 C 的物件；如果在父類別定義一個子類別沒有的方法，再用 this 呼叫：&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;class B extends A {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void show() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.print("B");&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void showAB() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super.show();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ＊this.someMethod();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.show();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void someMethod() {}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class C extends B {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void show() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.print("C");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;那麼 this.someMethod() 的呼叫應該是先在物件 C 中搜尋 someMethod 方法，找不到再搜尋父類別！&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;使用 "this" 呼叫該類別的方法是常見的手法，但在繼承架構中，若程式的設計如同範例一般，在編譯期不會發生問題，到了執行時才會從結果中知道出了錯！當然，解決問題的寫法有許多種...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;若使用類別方法 (class methods)，那麼一切就會變得很簡單，每個類別只需要定義一個 static void show( ) { 印出所在類別名稱 }，只要在最後一個子類別定義一個方法 (類別方法或實體方法都可以)，以類別名稱來呼叫各自的"靜態(static)" show() 方法：&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;class D extends C {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void show() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("D");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public (static) void showABCD() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A.show() ;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B.show();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C.show();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; D.show();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-7631043325446432889?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/7631043325446432889/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/java-key-word-this_09.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/7631043325446432889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/7631043325446432889'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/java-key-word-this_09.html' title='Key word : this'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-8722805957836283410</id><published>2009-04-09T10:10:00.000-07:00</published><updated>2011-11-01T04:13:59.854-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Literal value</title><content type='html'>整數的字面值編譯器預設指定為int type，浮點數的字面值編譯器預設指定為double type，若float y=3.14不合法且必須加上 F/f 讓編譯器跳過預設而將3.14配置給float type，為何byte x=127可順利編譯？(short x=127亦可)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;byte x = 127;&lt;br /&gt;float y = 3.14F;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;處理等號右邊記憶體空間大於等號左邊記憶體空間問題，以下為相同邏輯的(casting)處理程序！&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;double a = 3.14;&lt;br /&gt;float b = (float)a;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int c = 127;&lt;br /&gt;byte d = (byte)c;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;問題解答：引述自JavaWorld@TW Duncan網友－這與數據所帶的資訊在 assignment 後是否會遺失有關：&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;integer value 127 (int type by default) 在 assign 給 byte storage 後資訊完全不會遺失；floating-point value 3.14 (double type by default) 在assign 給 float stoarge 會遺失部分資訊(不準確)！&lt;br /&gt;127 以 2's complement 方式表示的 binary 可以存在byte型態的 8 bits 空間裡，double 3.14 是 3.14 的近似值，將此值 assign 給 float 後也是 3.14 的近似值，但由於float type 的 mantissa(or fraction) bits 比 double 來得少，所以將一個 double value assign 給 float storage 後誤差會變大！&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;根據以上的敘述所給出的線索，我做了以下實驗：&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;//Is int 127 equal to byte 127?&lt;br /&gt;&lt;br /&gt;byte e = 127;&lt;br /&gt;&lt;br /&gt;if((e-127)==0) System.out.println("Yes!");&lt;br /&gt;&lt;br /&gt;else System.out.println("No!");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Is double 3.14 equal to float 3.14?&lt;br /&gt;&lt;br /&gt;float f = 3.14F;&lt;br /&gt;&lt;br /&gt;if((f-3.14)==0) System.out.println("Yes!");&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.print("No!");&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("Thｅ error = " + (f-3.14));&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;答案是No!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;但我得到一個有趣的結果 : float 3.14 大於 double 3.14!&lt;br /&gt;這是否是常態的結果呢?&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;//Is float type value greater than double type value?&lt;br /&gt;&lt;br /&gt;float g;&lt;br /&gt;&lt;br /&gt;for(double i=3.14 ; i &amp;lt; 3.15 ; i+=0.001) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; g = (float)i;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(g-i);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;＝＝＝＝＝＝＝＝＝＝＝＝&lt;br /&gt;&lt;br /&gt;Results：&lt;br /&gt;&lt;br /&gt;1.0490417468034252E-7&lt;br /&gt;&lt;br /&gt;3.2424926743601645E-8&lt;br /&gt;&lt;br /&gt;-4.005432119313923E-8&lt;br /&gt;&lt;br /&gt;-1.1253356912988011E-7&lt;br /&gt;&lt;br /&gt;5.340576203494152E-8&lt;br /&gt;&lt;br /&gt;-1.907348590179936E-8&lt;br /&gt;&lt;br /&gt;-9.155273383854023E-8&lt;br /&gt;&lt;br /&gt;7.438659732628139E-8&lt;br /&gt;&lt;br /&gt;1.9073493895405136E-9&lt;br /&gt;&lt;br /&gt;-7.057189854720036E-8&lt;br /&gt;&lt;br /&gt;9.536743261762126E-8&lt;br /&gt;&lt;br /&gt;＝＝＝＝＝＝＝＝＝＝＝＝&lt;/code&gt;&lt;/pre&gt;作了以上試驗得到一些振盪的結果！&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Let's see how float type stores data from double type.&lt;br /&gt;float h = (float)Math.PI;&lt;br /&gt;double i = Math.PI;&lt;br /&gt;System.out.println(i);&lt;br /&gt;System.out.println(h);&lt;br /&gt;System.out.println(3.14159261535F);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;上述說明當超過float範圍的數值存入float時，數值會被截斷以放入float的記憶體空間；float數值與double數值之差異在於數值被截斷時如何進位？上面程式碼的最後一行說明若被砍掉那一端的第一個位數為0或1時，前一個位數會減1；若第一個位數大於等於2時,前一個位數均加1...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-8722805957836283410?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/8722805957836283410/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/java-literal-value.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/8722805957836283410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/8722805957836283410'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/java-literal-value.html' title='Literal value'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7112900122767691871.post-1553868246250923422</id><published>2009-04-08T10:09:00.000-07:00</published><updated>2011-11-01T04:13:39.875-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><category scheme='http://www.blogger.com/atom/ns#' term='cygwin'/><title type='text'>GCJ in Cygwin</title><content type='html'>Java codes compiled by GNU gcj in cygwin.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;很早就知道GNU的gcc有編譯java code的套件，但一直沒有嘗試著去學習，又或者當年試著要在windows下使用gcc編譯c++ code結果無法有效吸收網路上的資訊而作罷。現在捲土重來，在windows環境下裝上了cygwin要來測試用gcc內部的gcj來編譯java code，其實目的只是為了測試另一種程式的開發環境！&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@GNU GCC網站　－　http://gcc.gnu.org/&lt;br /&gt;@cygwin下載網址　－　http://www.cygwin.com/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ｓｔｅｐ　１　－－－　安裝cygwin&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cygwin是一套Linux like環境，專門在MS Windows下運行&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@cygwin網站　－　http://www.cygwin.com/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ｓｔｅｐ　２　－－－　選取必要的套件&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;在Category項目中點開Devel，右邊列出許多套件(多半都是skip)，找到gcc字眼的套件選擇c,c++和java相關的套件，點選skip就會變成版本序號，然後接續安裝。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ｓｔｅｐ　３　－－－　編寫程式&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;跳過.............................&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ｓｔｅｐ　４　－－－　cygwin視窗下編譯程式&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;＄ gcj -C hello.java&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;呼叫gcj編譯器並使用適當的options指令，此時可以去參考ＧＣＪ的使用手冊。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1.6 Code Generation說明 " -C " 指令可告知gcj編譯出bytecode( .class 檔)而非object code( .o 檔)。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@GCJ的網站　－　http://gcc.gnu.org/java/&lt;br /&gt;@Documentation內的GCJ Manual　－　http://gcc.gnu.org/onlinedocs/gcj/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[註]：執行gcj --help，會發現gcj所提供的指令為 " -c " 而非 " -C " ！使用 " -c " 編譯會得到 .o 檔 。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ｓｔｅｐ　５　－－－　cygwin視窗下執行bytecode&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;＄ gij hello&lt;br /&gt;＜show result＞&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;在cygwin下要執行bytecode必須呼叫gij，gij是java bytecode的interpreter。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7112900122767691871-1553868246250923422?l=liberoxp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://liberoxp.blogspot.com/feeds/1553868246250923422/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://liberoxp.blogspot.com/2009/04/java-gcj-in-cygwin.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/1553868246250923422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7112900122767691871/posts/default/1553868246250923422'/><link rel='alternate' type='text/html' href='http://liberoxp.blogspot.com/2009/04/java-gcj-in-cygwin.html' title='GCJ in Cygwin'/><author><name>Willy Fan</name><uri>http://www.blogger.com/profile/18213771331975511422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-FDNEJ3_G6pQ/Tq_EpOjm_tI/AAAAAAAAA2M/9hvQdq3vw30/s220/Screen%2BShot%2B2011-11-01%2Bat%2B5.42.34%2BPM.png'/></author><thr:total>0</thr:total></entry></feed>
