Working with Unity3d

minedesertΛογισμικό & κατασκευή λογ/κού

31 Οκτ 2013 (πριν από 4 χρόνια και 12 μέρες)

154 εμφανίσεις

1
Working with Unity3d
TOMMI HORTTANA, tommi.horttana@tkk.fi
PETRI LANKOSKI, petri.lankoski@taik.fi
Unity Basics
• Game Objects
– Basic building
block
– Hierarchies
• Components
– Define the
behaviour of game
objects
– Transform
– Meshes
– Animations
– Materials
– Scripts
– Physics modeling
Workflow
• Working with Assets
– Place assets in the Assets folder
– Unity auto-imports them
– Only move and delete assets through Unity
– Regularly backup Assets and Library
folders
• Prefabs
– Sort of blueprints of game objects
– Should be made for most objects
Where to do things
• Outside Unity
– models
– animations
– textures
– sounds
– GUI graphics
• In Unity
– levels
– scripts
– physics
– materials/shaders
– GUI
Game Project 2008-2009 5
Modeling
• Support for Blender (.blend), Maya (.mb,
.ma), Cheetah3d (.jas)

 鸞So晴省慧&† 潤潬ovi愠a
 c潬イno獵灰イ搬⁵⁴數t
 p汯屢…潮牡楮瑳
 ﹥畴牡ﰠ灯慫瑨浯n
 T瑨灩灥ﱩ﹥牯ﴠm潤敬楮朠oo晴睡⁴f
楴U
浥牯贈捴′〰㈰ 6
業慴楯湳
 I浰イ搠瑨⁴潤敬牯ﴠ瑨㍄
獯晴睡
keleton
Pﱡ渠景Mix
 C潮獩﹡浩湧
 Cﱥ慲⁈楥牡牣桹
 S敲慲捨a fo獩r楬慲潤敬﹥︠獨慲
獫敬整潮イ畭慮ゥ摳s
2
Game Project 2008-2009 7
Textures
• Unity can import multilayered PSD & tiff
– no need to flat them
• Textures for game objects should be 2
n
x2
m
(2, 4,
256, 512, 1024, 2048, ...)

 old敲慲摳・湯獵灰イ硴畲a牧敲⁴渠㈴
 G啉⁴數U
 dis慢aei瀠m慰a
 us瀠潴数琩

 A汰湮敬整瑨慮⁴牡湳ﹴ敲
 aﱥ慳楮SD
浥牯贈捴′〰㈰ 8
ﹴF
 T灥潮瑳
rttf)異灯牴
 S楺晩﹡楮浰イ楮i
灬楣慴☠獩穥渠業灯牴整瑩湧
 C畳瑯ﴠ景ﹴu
映景ﹴ摩瑯t
潴ウ桯瀬瑣
 f潮瑳⁴數楮﹩
浥牯贈捴′〰㈰ 9
拾楣﹥
 剥慬楳瑩拾楣﹥
A来楡桹獘g⁰桹獩湧楮
 ﱬ楤敲晩﹥散獨慰慮搠獩穥
 R不楤⁂潤楥晩﹥⁰桹獩ﰠ癩オi
ravity
灥楳湣pf 浯癥浥ﹴ
 P桹獩慴敲楡汳
陦riction
扯捩﹥
浥牯贈捴′〰㈰ 
卣物S
 N搠景条浥散﹩
 t⁰桹獩湧楮h
 J慶慳捲楰琬⁃﹤⁂潯癡楬慢ﱥ
 E硡浰ﱥ楮」畭瑩潮渠Ja癡獣物
 B獵灰イ景 fr潭⁵
 M楸楮朠灯楢ﱥ渠獯浥慳
 V慲楡慮數灯搠瑯⁴﹩
杲慰ﰠ楮慣g
 杯潤イ敦楮楮朠条浥散獰散楦楣⁶慬略g
卣物猺潮b慶楯S
wake()
 I﹩瑩慬楺慴楯湳
 S牴
 I﹩瑩慬楺慴楯湳
 A晴敲ﱬ⁁睡步數散畴イﱬfMo湯癩イnin慮捥s
 U灤慴p
 敲礠ﱬ渠E
 ﱡ摡()
 ﱬ晴敲灤慴C
 Uイ潬汯眠浥牡ﰠ整
 Fix摡()
 ﱬ癥特楸r敲慴fra
nGUI():
 ﱬ癥特牡浥
 G啉慮楮朠杯敲U
G
nGUI()
 C慮獣慬⁴漠晩摩晦敲獣楺
 G啉﹭慴物砠ﴠ︮a
 D不渠ﱡ說畴﹤egu鸞el瑳イ潭e
慲瑲慲a楺
 e﹧︬‱㈸へ.
 G啉ﹳ歩U
 G啉…UGU樓オIe瑨潤t
 潮ﰠﱡ氬潸ﰠ︮b
3
Game Project 2008-2009 13
Sound
• Supports common audio formats
• Native support for localized 3D sound
effects
• Plugin (for example FMOD) needed for
more sophisticated soundscapes
– Sync events with the music beat
– Modelling echoes caused 3d space
– Reactive sounds
Game Project 2008-2009 14
Plugins
• Possibilities to extend functionality of
Unity
– Wiimote support
– FMOD
– Audio input
• Plugins are not possible to use with
Web Player
Game Project 2008-2009 15
Optimizing Models
• Aim for 1500–4000 triangles / object
– combine near objects if they have less than 1500 triangles
• Aim for single material (+ texture) for an object
– the object will be drawn once for each material; an object
with 10 materials is drawn 10 times
– texture maps
• Characters
– 2500–5000 triangles
– 15–60 bones
– one material
Game Project 2008-2009 16
Optimizing Scenes
• Pixel lights are expensive
– object is rendered once for every pixel light
– use them for dynamic lights
– light maps for static lights (or draw lights directly
to textures)

 D葉楣摯睳
 s潦獨キ慲浯獩癥⁴渠
 i映潢ﱥﵳ⁷楴牡蘒瑨楮朠畳楮朠潢
獨キ慮搠獨キ⁰牯贈捴イs
浥牯贈捴′〰㈰ 
佰瑩浩穩湧捲楰瑳
 O業楺楦牡浥慴dr潰汯眠㌰
楮キ﹤⁴慲来浡捨楮i
 A癯楤灥牡瑩潮渠摡﹤
楮﹥汯潰i
 U潮b慶楯o.慢ﱥ搠瑯
摩支慢ﱥ捲楰瑳
 J慶愠獣物…⁂潯蘒慶ゥ搠捫殺a
浥牯贈捴′〰㈰ 
佰瑩浩穩湧捲楰瑳
 L不桴灥牡瑩潮猺⁰ﱵ猬楮畳ﰠ瑩浥i
 d略楳楯渠步縲〠瑩浥浯北ﱥi
潭搠瑯不桴灥牡瑩潮猩

 H灥牡瑩潮猺慲牯潴ﰠ獩測ecos
〠瑩浥浯0

 H灥牡瑩潮猺イ浡ﱩ穥ﰠ慮捥
 d楳湣攪摩慮捥‾楦isq慧﹩
 H灥牡瑩潮猺era北慳瑩湧,散琮﹤
﹤「贈捴ヲ灥,
﹤浥「贈捴獗楴桔慧
4
Game Project 2008-2009 19
Lies
• Characters:
– 5000–7000 triangles
– multiple objects (eyes, eyelids, etc.)

 t潯渠獨敲o/ 慴ash
 ﱯ瑩潮潤敬慲牡瑨敲不灯汹
 flat
 潰瑩mizein⁴敲 潦a物慬s
 O﹥楲散瑩潮慬不桴
 Pウ瑰牯捥楮朠e晦散瑳‫⁴數﹩浡瑩潮f
 Pﱡ率楮キ敲ォ⁇l
 f牡re慴縱〠桯畬搠癥㌰d