Drake's Weblog

2 minute read

前天 Timothy 和我聊到一個非常有趣的事。
他因為工作需要,常常要批次(batch)處理一大堆的 Maya scene files,透過一些他自行寫的 scripts 來執行一些例行性的工作。然後他需要把 Maya 產生的任何 message 都以某種型式丟出來,方便他 debug 或是分析。我們兩個人在想,有哪些方法可以做到?(從這點可以看出來,Timothy 是一位非常稱職的 RD/TD,會汲汲於想一些方法來做 mass production,而不是手動一個一個處理。因為即使你手動做得再快,只要量一大,還是有一定的速度上限~)
我們最後釐清了需求:
Maya 會由 terminal/console 下執行,所有的 message 要能正常輸出,而不是只留在 Maya Script Editor 裏頭。 message 包括:Maya 本身產生的;Mel 的 print;Python 的 print。 解法:
要讓 Python 的 print 得以輸出到 terminal,只要把 sys.stdout 由原來的 Maya Output object 換成 sys.stdout 即可。 要讓 Mel 的 print 與 Maya 原生的 message 輸出到 terminal 的話,需要利用到 Maya API 裏頭 CommandMessage 所提供的 CommandOutputCallback。向 Maya 註冊一個 callback 後,每當有任何一個 command 的 output 時,這個 callback 就會被呼叫,然後我們可以來決定怎麼處理這個 output message。 For Python’s print:

1 minute read

有天(2007/10)突然心血來潮,想說認識了 7 年有餘的 Maya(從大五寫遊戲開始,至進入太極影音工作),還真不曉得它的歷史,要了解一個軟體的歷史得花不少時間,但如果只是抓抓圖的話,可就比較快了。那就來收集一下 Maya 歷年版本的 Splash Window 好了。不過目前還缺不少版本中… 如果有人有其它版本的 splash window,還請通知一下 :)
Maya 2011 Splash Window
Maya 2009 Splash Window
Maya 2008 Splash Window
Maya 8.5SP1 Splash Window
Maya 8.0 Splash Window
Maya 7.0 PLE Splash Window
Maya 6.5 Splash Window
Maya 6.0 Splash Window
Maya 5.0 Splash Window
Maya 4.5 Splash Window
Maya 4.0 Splash Window
Maya 2.

1 minute read

負責 Meet The Robinsons 立體部分的 Phil McNally 在一次受邀訪談中,針對這部動畫的立體(3-D, stereo)部分做了一些說明。太極影音 3D 同仁正如火如荼趕工的 Quantum Quest 是一部 IMAX, Large Format, Stereoscopic Animation,我有幸參與了一部分 stereo 的研究/環境建置/製作,所以不時(自發性或被迫都有)得去看一些這方面的資料,Phil 的這次採訪讀來讓人非常愉快輕鬆,於是我決定節錄一些有趣且值得記下來的內容:
Disney Digital 3D 是負責的單位,先前有過的立體經驗分別是 Chicken Little 與 Tim Burton’s Nightmare Before Christmas(原來這個也有立體版?!)。Real D 與 Disney Digital 3D 的關係非常特殊,他們未來出版的立體動畫電影也一律會支援使用 Real D 的數位戲院,加上其它幾個重量級 Hollywood studio 的支援,這一波立體風潮大勢抵定,就算觀眾不買帳,它至少也會撐個數年頭。 Chicken Little 當時的立體版,是在 2D 版做完後的加工,所以並沒有特別針對立體這件事做多少鏡頭與說故事方面的調整。同時,那時採取的作法,幾乎可以說成是「一立鏡頭到底」,亦即每一卡都差不多是套用相同的設定(camera configurations),所以自然不會有什麼特別的表現,不過是個輕鬆愉快的實際作法。我個人沒有機會看到這部動畫的立體版,不過我猜測應該幾乎都是凹進去的。 We actually wrote what we call a ‘Depth Script’ for the entire film, in which we determined how much depth we would use in each sequence of the story.

3 minute read

Im Yours Chords by Jason Mraz, G Well, you done done me and you bet I felt it D I tried to be chill but your so hot that i melted E#m C I fell right through the cracks, and i'm tryin to get back G before the cool done run out i'll be givin it my best test D and nothin's gonna stop me but divine intervention E#m C I reckon it's again my turn to win some or learn some CHORUS G D I won't hesitate no more, E#m C no more, it cannot wait i'm yours G D Well open up your mind and see like me E#m open up your plans and damn you're free C look into your heart and you'll find love love love G D listen to the music at the moment maybe sing with me E#m Ah, la peaceful melody C Cm It's your god forsaken right to be loved loved loved loved Loved CHORUS G D So, i won't hesitate no more, E#m C no more, it cannot wait i'm sure G D E#m there's no need to complicate our time is short C this is our fate, i'm yours *scat* G I've been spendin' way too long checkin' my tongue in the mirror D and bendin' over backwards just to try to see it clearer E#m my breath fogged up the glass C and so I drew a new face and laughed G I guess what I'm a sayin'is there ain't no better reason D to rid yourself of vanity and just go with the seasons E#m it's what we aim to do C our name is our virtue CHORUS G D E#m I won't hesitate no more, no more C it cannot wait, i'm sure G D (there's no need to complicate E#m our time is short C it cannot wait, i'm yours 2x G D E#m no please don't complicate, our time is short C this is our fate, im yours.

2 minute read

Maya 原生的 Script Editor 不太好用,因為:
copy & past 不好用:這是指在 Linux 下,使用 Motif API 的 Maya 而言,其它平台的 Maya 沒有這個問題。 沒有 syntax highlighting:雖然說使用 script editor 時大都是試驗性或很簡短的程式碼,但天曉得,syntax highlighting 肯定能讓你的心情好一些,誰說「讓程式師計師的心情好不重要」的!! 不支援 regexp:just my humble opinion 不方便調整字型大小;just my humble opinion 沒有 smart indent;just my humble opinion but very important to Python 但是它也有幾點好處:
與 Maya output 在同一個視窗:方便 debug,在任何有疑問的地方 print 一下就行即時的 debug。 可以 run by selection:對於寫一些實驗性的 coding snippets 非常好用,至於在寫比較有規模的程式或模組時,直接透過 source (MEL) 與 import…reload (Python) 來做即可。 可以及時地查 mel 或 python 的 help:只有非常有經驗,寫過無數程式碼的工程師,才不需要查閱 API document,甚至可以誇張一點地說,程式設計師的工作不過就是查閱技術文件,然後把腦子裏的思緒(不管清不清楚,有沒有組織)以剛剛查到的語法寫出來,然後逐步(可能是逐行、逐函式、逐模組…)測試,最後交差,以接下來的維設與新增減功能。也因此,可否方便查閱文件,成了寫程式能不能很順暢的重要指標。不過 python 這一塊可以透過 mayaipy (maya + ipython2.

5 minute read

Maya scripting 現在有了 MEL 與 Python 可供選擇,對於大部分的 Maya 使用者來說,這是件微不足道的事,但對於天天使用與撰寫 Maya scripting 的人來說(ex, TD?!)(或保守一點的說,很有機會被要求寫點程式的人),這重要極了。
個人淺見,Python 與之後由 Luma Pictures 的 Chad Dombrova 所推出的 pymel (0.7.8),是 Autodesk 買下 Maya 後,在 8.5 所做的 features 裏頭,最最重要的一點了。好吧,我是以 RD/TD/SD 人員的角度來看事的,請先暫時原諒我這有點狹隘的說詞,然後接著繼續看文章。
Maya 8.5 發表以前,在 Maya 上頭工作的技術人員,除了和大家一樣要去了解與使用 Maya 以外(說真的,Maya 的學習曲線有點長,進入門檻有點兒高,以致於很多資訊系所的電腦圖學實驗室,都不容易利用這個工具來做點什麼,實在很可惜),可能還需要去了解一下 Maya ascii file format, Maya nodes, Hierarchy in a Maya scene file, Mel, Maya C++ API, 技術名詞, …好不容易似懂非懂一些東西後,就是寫些程式來試試看。
舉些個例子。如果你想寫個可以自動幫你架好骨架的 joints 與一些 IK/FK 的設定的東西,你可以利用 Mel 來做到;如果你希望有一個特別的材質球,它會在你的模型有互相穿刺時,用紅色這種非常鮮豔且帶警告意味的顏色來提醒人,你可以用 C++ API 寫個 plugin 來提供一個特製化的 material node;如果你想用透過一個放在 Maya shelf 上頭的按鈕,讓 lighter 可以很快的下算圖指令的話,那你可以使用 Mel 外加 RMS/MtoR 提供的指令來做到;如果你想利用 locator 來實作 instance(一些 Maya instance 無法做到的情況下),同時要讓這個 locator 秀出原 reference model 的各種動態的話,你得用 Maya API 外加對於 Maya node 的了解(當然,你也可以使用 billboard(sprite) 做到);…

Recent posts

Categories

About

You're looking at Drake's words or statements. All opinions are my own.