2011年12月26日 星期一

MAXscript : 新創同樣BoneList的Skin

從現有已加完Bones的Skin中,抓取Bone List到新的Skin中

--從已有的Skin中抓取骨骼的Name
bonesAry = for i in 1 to skinOps.getNumberBones $.skin collect skinOps.getBoneName $.skin i 0
--加入到新的Skin中

for i in 1 to boneAry.count do skinOps.addBone $.skin (getNodeByName boneAry[i]) 0

2011年12月4日 星期日

Maxscript : Writing Better and Faster Scripts


( Frequently Asked Questions in MAXscript help)

Disable Viewport Redraws when making changes to scene objects
You can use the with redraw off() context or a pair of disableSceneRedraw() and enableSceneRedraw() calls to speed up you code. The former method is the preferred one.

Disable Undo system when possible
ondo off( ... ) ; ondo on( ... ) ; with undo off
print (et-st) --print the resulting time
gc() --call Garbage Collection &endash; you will needed it!

Modify Panel can be slow - change to Create Panel when possible
In 3ds Max 7 and higher, you can also completely disable Modify Panel updates using the suspendEditing() and resumeEditing() methods

Only calculate once if possible
Try to avoid running the same calculation more than once, or interrogating the same value in the same node more than once.

Cache frequently used functions and objects
You can store frequently used functions and objects in user variables to faster access.

Pre-initialize arrays when final size is known
When adding elements to an array using the append method, a copy of the original array is being created in memory before the new array is created. When the size of an array is known before the array is actually used, it is a good practice to pre-initialize the array in memory by assigning the last element of the array to some temporary value. This will create an array of the desired size in memory and will let you simply assign values to any element of the array using indexed access without the memory overhead of the append method.

MyArray = #()

MyArray[100] = 0 --initialize a 100 elements array in memory
for i = 1 to 100 do MyArray[i] = random 1 100 --assign to predefined array


matchPattern is faster than findString
When searching for a substring inside a string, using the matchPattern() method is faster than using findString().
Executing the same method one million times on the same PC resulted in:
3.7 seconds execution time for matchPattern
5.9 seconds execution time for findString
5.0 seconds execution time for subString when comparing the first 3 characters.

Do not use return, break, exit or continue

Return, break, exit, continue and throw are implemented using C++ exception.
C++ exceptions are SLOW!

Use StringStream to build large strings
If building strings, use a StringStream value to accumulate the string and then convert to a string.

fn test5d =
(
 local ss = stringstream"",fmt ="%"
 for i = 1 to 100 do format fmt ito:ss
 ss as string
)

Using Bsearch For Fast Table Lookup
The bsearch() method available in 3ds Max 2009 and higher allows for very fast table lookup operations in sorted arrays.

2011年12月2日 星期五

Maxscript : Right-Handed to Left-Handed


正解!!Right to Left or Left to Right:by cmann

Let me try to explain it a little better. I need to export from Blender, in which the z axis is facing, to OpenGL where the y axis is facing up.
For every coordinate (x, y, z) it's simple, swap the y and z values: (x, z, y).
Because I have swapped the all of the y and z values any matrix that I use also needs to be flipped so that it has the same affect .
After a lot of searching I've eventually found a solution here:
http://www.gamedev.net/community/forums/topic.asp?topic_id=537664
If your matrix looks like this:
{ rx, ry, rz, 0 }
{ ux, uy, uz, 0 }
{ lx, ly, lz, 0 }
{ px, py, pz, 1 }
To change it from left to right or right to left, flip it like this:
{ rx, rz, ry, 0 }
{ lx, lz, ly, 0 }
{ ux, uz, uy, 0 }
{ px, pz, py, 1 }



2011年11月30日 星期三

Maxscript : isValidNode



isValidNode
Returns true if is a node value, and the node has not been deleted. Otherwise, it returns false.
isValidNode $ 
等同於
fn isValidNodeFn = ( if $!=undefined then return true else return false )


getSavePath()
getSavePath [caption:] [initialDir:]
(MAXscript Reference : Standard Open and Save File Dialogs)
This function displays a folder selection browser for the user to select a folder. Returns a string path name for the selected folder or the value undefined if the user presses Cancel in the folder browser.
If the initialDir: keyword argument is specified, the Browse For Folder dialog will be opened at the specified directory. Symbolic pathnames are acceptable as the pathname. Available in 3ds Max 8 and higher.


Try Expression
The try expression lets you bracket a piece of code and catch any runtime errors.
This allows you to respond appropriately or take corrective action, rather than let MAXScript halt the execution of your script and print an error message.
try ... catch ...
throw ... ; throw()




getNodeByName

getNodeByName "Box01"
等同於
theName = "Box01"
theObject = Execute ("$'"+theName+"'")



displayTempPrompt


displayTempPrompt
Displays the specified string on the Prompt Line for the specified number of milliseconds. After the time elapses, the string is popped from the stack. This may be used to put up a temporary error message for example. Control is returned to MAXScript immediately after the call, that is, MAXScript execution continues even while the temporary prompt is displayed.




snapshot
This function provides functionality similar to the SnapShot tool in 3ds Max. It generates a new node that contains a copy of the world-state mesh of the source at the time that the snapshot is made. Any existing modifiers are collapsed out of the new node and the mesh snapshot accounts for any space warps currently applied. As with the clone methods (copy, reference and instance,) you can add any of the standard node creation keyword arguments, such as pos:, name:, etc. 

2011年9月1日 星期四

[Lua] 筆記 to 28

-- Example 18   -- if elseif else statement

c=3
if c==1 then
    print("c is 1")
elseif c==2 then
    print("c is 2")
else
    print("c isn't 1 or 2, c is "..tostring(c))
end


-- Example 19   -- Conditional assignment.
-- value = test and x or y

a=1
b=(a==1) and "one" or "not one"
print(b)

-- is equivalent to
a=1
if a==1 then
    b = "one"
else
    b = "not one"
end
print(b)


-------- Output ------

one
one


-------- Output ------

c isn't 1 or 2, c is 3



-- Example 20   -- while statement.

a=1
while a~=5 do -- Lua uses ~= to mean not equal
    a=a+1
    io.write(a.." ")
end


-------- Output ------

2 3 4 5
Press 'Enter' key for next example


-- Example 20   -- while statement.

a=1
while a~=5 do -- Lua uses ~= to mean not equal
    a=a+1
    io.write(a.." ")
end


-------- Output ------

2 3 4 5


-- Example 22   -- for statement.
-- Numeric iteration form.

-- Count from 1 to 4 by 1.
for a=1,4 do io.write(a) end

print()

-- Count from 1 to 6 by 3.
for a=1,6,3 do io.write(a) end


-------- Output ------

1234
14


-- Example 23   -- More for statement.
-- Sequential iteration form.

for key,value in pairs({1,2,3,4}) do print(key, value) end


-------- Output ------

1       1
2       2
3       3
4       4


-- Example 24   -- Printing tables.
-- Simple way to print tables.

a={1,2,3,4,"five","elephant", "mouse"}

for i,v in pairs(a) do print(i,v) end


-------- Output ------

1       1
2       2
3       3
4       4
5       five
6       elephant
7       mouse




2011年8月29日 星期一

Cry - Flow Graph 筆記

Done與Succeed/Fail的差別:Done是不管Succeed/Fail都會送出

在system.cfg中加速g_tpview_force_goc=1可防止攝影機穿越物件

2011年7月22日 星期五

Bodypaint : 直接把圖貼到模型上

假設模型上已有一部分貼圖是可以移植到另一個部位上,或者有圖片想直接貼到模型貼圖上
可先將設些部份Ctrl+C至剪貼簿,開啟Bodypaint後,切到你要的角度Ctrl+V,
就會把剪貼簿裏面的圖像直接貼到模型上,此時Bodypaint會進入投影模式,
要繼續繪製時記得取消,否則接縫處會有縫隙。

2011年7月19日 星期二

3ds Max : Skin Warp

當有類似的模型已經skin,可以利用skin warp modifier把權重copy到還沒skin的模型上

2011年7月18日 星期一

Maxscript : 把Rollout顯示出來, script加入介面中

把Rollout顯示出來
rf = newRolloutFloater "Title" 500 520
addRollout rolloutname rf

script加入介面中
macroScript name category:"category" toolTip:"tooltip"
(on Execute do
  fileIn "$Scripts\script.ms"
)

2011年7月17日 星期日

Maxscript : Select All Children by Janus

fn selhi =
(
if $ != undefined do
(

Maxscript : re Skin by Janus

skinOps.SaveEnvelope $.modifiers[#Skin] exportPath -- Save envelope
maxOps.CollapseNode $ off -- Collapse all
modPanel.addModToSelection (XForm ()) -- Add modifier

2011年7月14日 星期四

Maxscipt : 自動置換貼圖 by Janus

nameStr = $.name as string
modelName = substring nameStr 1 4
texturePath = "D:/....../"+modelName+"/"+modelName+"a....._1.dds"

2011年7月4日 星期一

3dsMax Biped Animating Tutorial

Part 1/3 of full live recorded animation video tutorial with polish comment. Duration 23 min.
animator: Lukasz Kubinski
Dash Dot Creations

3dsMax註冊畫面無法顯示的解決方法

最乾脆的方法如下
將所有註冊時會用到的RT?.html都加上<!-- saved from url=(0016)http://localhost -->,成為被信任的網頁即可

2011年7月1日 星期五

縮放物件所造成的問題和Xform的用途

當直接對物體進行非等比的縮放時,會造成物件的vertices在不同軸向上承受不同的縮放比例,因此當旋轉pivot的時候,就會影響到物件形狀的正確性。

2011年6月29日 星期三

2011年6月8日 星期三

3ds Max Hotkeys

; - repeat last(poly)
shift + e - extrude face
alt + a - align
7 - show statistics (面數..)
ctrl + X - show/hide tool UI
alt + X - enable X-ray previews

2011年6月6日 星期一

用Motion Path快速做出脊椎狀、鍊狀結構

  1. 用curve畫出想要的曲線
  2. 選擇單元物件與curve
  3. [Animation] Animate / Motion Paths / Attach to Motion Path

用Nrubs來雕塑Polygon曲面

對要做出板面狀的Polygon曲面相當有用的技巧
  1. 用一個nurbs plane涵蓋住polygon模型
  2. 選取polygon模型與plane
  3. [Animation] Create Deformers / Warp
  4. 就可使用nurbs plane來控制polygon模型

Making of Recon Elite by Vadim - DominanceWar4

Part1
http://youtu.be/8ZNJoPY7-yk?hd=1
Part2
http://youtu.be/q0JTvtempP0?hd=1
Part3
http://youtu.be/LIFmysfI_8k?hd=1

2011年5月30日 星期一

獨立遊戲開發者分享會

GDC 2011
得獎案例 - How to win the IGF in 15 weeks - Monaco
成功案例 - Turning mobile games into moneymakers
- Angry birds, Gun bros, Cut the rope
失敗的案例
每年做一款實體遊戲
實驗性遊戲案例


Watch live video from igdshare on Justin.tv

2011年遊戲設計學校評比 大學與研究所

Princeton Review與Game Pro合作的2011年遊戲設計學校評比

http://prattflora.com/mfastudy/?p=16970

wonderfl 在瀏覽器裡編譯AS

wonderfl提供可以直接在瀏覽器上進行AS的編譯,不需要flash也可以寫出AS!而且最棒的地方是所有在上面發表的程式,都可以直接看原始碼,這對於AS的學習相當有利,還有code search的功能,可直接以關鍵字查詢有關的程式內容。

2011年5月27日 星期五

Wireframe rendering in Mental ray

  1. 在材質的shading group(SG)中展開mental ray/Contours標籤
  2. 勾選Enable Contour Rendering,設定Color, Alpha, Width
  3. 開啟Render Settings,在Features/Contours標籤中勾選Enable Contour Rendering
  4. 在Draw By Property Difference中設定所需的render方式,勾選Around all poly faces以render所有的edges

2011年4月1日 星期五

導演 新房昭之

化物語導演

WIKI
http://zh.wikipedia.org/zh/新房昭之

●試論新房昭之(以化物語為範例分析)
http://lowex.blogspot.com/2011/01/blog-post_08.html

  • 在《〜魂狩〜》中大量使用抽象、象徵性的手法,表現出強烈的個人風格
  • 使用大量陰影、眼睛特寫與靜止畫,亦喜歡使用極端對比、奇特且華麗的色彩,以及使用文字代替畫面構成的方式。
  • 新房慣用的手法如靜止畫、空鏡的運用,顏色對比強烈的配搭及特殊時間節奏,而統稱「新房風格」事實上還有他手邊兩位成員大沼心與尾石達也的搭配所組成,大沼心比較多用強烈的色彩和光暗對比作演出,尾石達也則多插入實寫圖片和及獨特的照片素材於動畫中作演出,以上三個人的特殊風格組成最後才形成了大家熟知的「新房風格」(所以客觀一點說,應該稱作SHAFT風格會比較適當)。


動畫界近來最受囑目的鬼才─新房昭之
http://home.gamer.com.tw/creationDetail.php?sn=979606
- 絕望先生的風格,與新房昭之太為契合了。使這部作品擁有了難以想像的完成度,並且將新房式風格完全的發揮。

2011年3月29日 星期二

Ultrasonic range finder


Maxsonar
檢測距離範圍:6~254inches (15.24cm~6.45m)
啟動時保持36公分的淨空較佳(至少18)
Datasheet - maxbotix
FAQ

電路與arduino sketch教學(analog&PWM singal)
http://craft.mos-com.net/articles/arduino-maxsonar-ez1/

Reading analog values with an Arduino
An example using an ultrasonic distance sensor
http://sheepdogguides.com/arduino/aht1a.htm

用平均值之方式穩定數值(arduino sketch)
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1226321702

Simple fix for when electrical noise interferes with the MaxSonar sensors.

2011年3月18日 星期五

[Arch] MOUNT FUJI ARCHITECTS STUDIO

原田真宏 + 原田麻魚
masahiro harada + mao harada
マウントフジアーキテクツスタジオ 一級建築士事務所 
mountfujiarchitectsstudio / mt.fuji architects studio

2011年3月15日 星期二

[Maxmsp] 物件備忘錄

scale - Map an input range of values to an output range
scale a b c d : 將a~ab的值作比例轉換至c~d間
The scale object will perform in exponential mode when a fifth argument is specified. This fifth argument must  be greater than 1.0 or the output will be linear.
hi and lo values can be reversed for inverse mapping!
itoa / atoi - integer to ASCII / ASCII to integer
coll - Store and edit a collection of different messages
coll allows for the storage, organization, editing, and retrieval of different messages.

Sims 3 自製物件

MTS教學 Tutorials:TS3 Basic HowTo Mesh Guide

系統必備軟體
  1. Microsoft's .Net Framework 3.5(for s3oc..)
  2. Visual Studio 2008 Runtime(for WesHowe Object Tool)

2011年3月13日 星期日

[Animate] Male's walk reference



[Animate] 貓走路動畫記錄

1. 同側(兩腳相反方向位移)時 - 前腳踏地後,後腳才會起來
2. 左前腳在後並往前邁進時,超過(或齊平)右前腳時,右後腳才離地
3. 右前腳往後時,兩隻後腿齊平時(或右後腳超過左後腳),左前腳踏地
4. 同側(兩腳相同方向位移)時 - 前後腳幾乎快碰到才踏地與離地

cat walkcycle reference

2011年3月10日 星期四

[Sims] 自訂物件收集

Sim3pack安裝路徑:文件\EA\模擬市民3\Downloads
Sim3pack安裝方法:檔案丟進上面路徑後,開啟S3Launcher,從下載頁面中進行安裝
Package安裝路徑:文件\EA\模擬市民3\Mods\Packages

PING))) ultrasonic sensor + Arduino + Maxmsp

PING))) ultrasonic sensor的腳位為 SIG , 5V , GND
此種超聲波感測器的特殊點為使用的是Digital Pin
Arduino程式部分已有寫好的預設範本,還可實際的換算出距離(英吋或公分)

[Know] Eadweard Muybridge

埃德沃德·邁布里奇(Eadweard J. Muybridge,1830年4月9日-1904年5月8日),英國攝影師,他因使用多個相機拍攝運動的物體而著名,他發明的「動物實驗鏡」(Zoopraxiscope)是一種可以播放運動圖像的投影機,將連續圖像繪製在一塊玻璃圓盤的邊緣,隨著玻璃的旋轉,將影像投射出去,這樣就使這些影象顯得像在運動。
~維基百科

拍攝眾多超高品質的連續動作照片攝影師
其研究及作品至今仍有重要參考價值

出版品:
The Human and Animal Locomotion Photographs
Horses and other animals in motion
The Human Figure in Motion

[MAXMSP] 常用熱鍵&優化運作

操作技巧
連結connection時, 按住shift可以多次連接
Alt+Drag 可以框選patch cords
Ctrl+D可以重複位移複製
雙擊(unlock時要+Ctrl)save, receive, value物件會列出關係物件以供找尋位置
m 新增message
n 新增object
j 新增jitter
i 新增int
f 新增float
b 新增bang
t 新增toogle
c 新增comment
r 開啟Recent列表
ctrl+E 切換lock/unlock


Improve displays performance
Anytime you are using a jit.pwindow object which is smaller than the video being displayed (here, our video is 320x240, and our jit.pwindow is 80x60), you should turn off onscreen mode. It's a simple rule that will get the best possible speed from your performance patch.
Onscreen and offscreen modes use different drawing algorithms to do their work—data is drawn directly to the display in onscreen mode, while offscreen mode draws the data first to an offscreen buffer and then copies it to the display. The algorithm used in onscreen mode doesn't favor downsampling, so the performance is not as good.
Optimize your patch
http://abstrakt.vade.info/
 Some basic guidelines for any programming environment:
  • Get it working before you optimize - no need to complicate your life ahead of time
  • Clean, commented, organized code is easier to understand, and easier to optimize than messy, uncommented code - especially with graphical patching environments, messy means visually complex, hard to follow patchcoord everywhere spaghetti. Not fun.
  • Test your code - isolate potential bottlenecks and try out various methods. Sometimes more code can be faster than less, in specific cases (compare the amount of objects for the gpu based uyvy playback patch to the CPU based one) .
For Jitter specifically, some considerations - and DO NOTs.
  • DO NOT create unnecessary UI objects that constantly update - Jitter shares its drawing thread with the Max UI - the more you draw on screen, the less time Jitter has to draw to your window. If you REALLY need all that stuff on your screen blinking, set the screen refresh rate lower in performance options - and use qlim to limit the rate of updating.
  • No really, DO NOT create unnecessary UI elements, even hidden ones. Max has to keep track of them. Simply hiding them wont do it. Replace number boxes with [float] and [int], etc.
  • Pwindows - those little preview windows everyone wants to use - use qlim to limit the speed the pwindow is updated, and turn off “Use Onscreen” - you should see a decent speed increase just from that.
  • If you are using OpenGL, it is highly recommended to manage drawing manually by using @layer, or with @automatic. Using @automatic 0 allows you to stop OpenGL objects from drawing/being activated by simply not banging them. This can be very useful with complex filterchains. Its a pain at first, but manageable and much more powerful
  • If you plan on using the UYVY colormode, it is suggested you use the cc.uyvy2rgba shaders, as Windows users do not have native UYVY texturing (at least, @colormode on some GL objects in XP does not work). Just a heads up

      2011年3月6日 星期日

      [MAYA] AO算圖

      方法1 -
      將mesh給予surface shader材質, out color給予mentalray的mib_amb_occlusion材質(Texture類中), 調整mib_amb_occ的參數 sample與max distance, spread為發散值影響陰影濃度, dark/bright為亮暗色設定, 一般調整sample及max distance即可, 最後以mentalray進行render

      方法2 -
      將物件加入新的render layer, 對layer右鍵>attributes, 點擊Presets>Occlusion

      方法3 -
      啟用Mentalray作render, 開啟Render settings, 切到Passes Tab, Create new render pass然後Associate, Render View中File>load render pass

      2011年2月27日 星期日

      [MAYA] 正負燈-只產生影子的燈光

      同樣的燈光複製一個
      將亮度改為負值並取消影子
      就會產生只打出影子但不會產生亮度的燈光

      [MAYA] plug-in kk_controllers

      模組化控制器

      Description
      Use this script in rigging process for adding controllers to them.

      Color:
      Use color slider to change color of controllers and any other things in your scene.

      Lock&hide:
      Lock or hide translate, rotate, scale and visibility of controllers and any other things in your scene.
      Get lock and hide info from existing object in your scene by pressing get from selected button then by apply to selected button you can apply these info to another one.

      mirror :
      mirror controllers shapes from one side to another.

      Shapes:
      Create a controller shape by simply pressing a button and if you have something selected in scene the controller's shape will snape to that.

      Slider maker:
      Press slider maker button to bring back slider maker window then set the height and width value of slider’s border and set value of slider’s handle and finally press make slider button.

      Combine shapes:
      Select child shape and parent shape then press combine shape button to combine these two to one.

      Freeze transformations:
      By using freeze transformations button you are able to freeze locked transformations of controllers and you don’t have to unlock them before freezing them.

      How to install: 
      Put kk_icons folder in your prefs/icons folder, put the kk_controllers.mel into your scripts folder then launch Maya in command line type kk_controllers and hit enter

      2011年2月26日 星期六

      [AE] comp的循環

      對Timeline中的comp layer右鍵,Time \ Enable Time Remapping (Ctr+Alt+T) 啟動Time Remapping,如有需要要把最後的key往前調一個frame,再把layer長度拉到想要的秒數,打開layer的屬性timeRemap加入expression:loopOut(type = "cycle", numKeyframes = 0)

      [AE] 影片片斷的循環

      在Project視窗對影片片段右鍵,Interpret Footage/Main (Ctr+Alt+G) 中 Other Options 可設定循環次數

      [AE] 循環script

      loopOut("cycle",0)

      說明文件:http://livedocs.adobe.com/en_US/AfterEffects/8.0/help.html?content=WS3878526689cb91655866c1103906c6dea-7a30.html