撞正Unreal 4 Free咗又接到個Oculus job 做,
就好快手咁玩咗一陣。
初步感覺Crash嘅情況係有但係唔多,
除咗load新project會有啲耐之外performance都算好好,
document好簡陋但有unreal answer補夠。
新engine多咗fancy嘢,又唔洗錢,
明顯係Unity做得太好,佢地要急起直追啦XD
Unreal / Oculus Notes
- Unreal本身就support oculus,唔洗裝plugin,就咁run個app fullscreen就會自動開stereo mode
- 我部mbp一開stereo就好鬼慢,暫時未知個bottleneck喺邊。不過做Oculus app就一定要搞好performance
- Quality Settings: https://answers.unrealengine.com/questions/23023/trouble-configuring-game-settings.html
P.S. sg.ResolutionQuality好似影響唔到Oculus - Disable smooth frame rate: Project Settings -> Engine -> General Settings -> Framerate -> turn off smooth frame rate. 啲人話呢個唔會影響framerate但我見會減咗少少,而且frame rate好低嘅時候唔需要control frame rate
- Ambient Sound: 記住個聲音檔format要係wav,仲一定要係Mono,否則個engine會做唔到因應player位置嘅立體聲
- 自動fullscreen: 建立 DefaultGameUserSettings.ini 放入去 project_folder/Config 入面:
[/Script/Engine.GameUserSettings] bUseVSync=False ResolutionSizeX=1920 ResolutionSizeY=1080 LastUserConfirmedResolutionSizeX=1920 LastUserConfirmedResolutionSizeY=1080 WindowPosX=-1 WindowPosY=-1 bUseDesktopResolutionForFullscreen=False FullscreenMode=0 LastConfirmedFullscreenMode=2 Version=5
P.S. bUseDesktopResolutionForFullscreen唔肯定係唔係False
- Trick: 個scene冇光源,加ambient cubmap,用有illumination 嘅material做燈光效果,物件加reflection,就可以冇lighting 嘅情況下做到好似有lighting咁,Performace超高。P.S. Unreal 嘅reflection做得出奇地快
Post Process Volume
喺Modes入面search “Post Process Volume” 加入去個scene度,喺Details做settings(將個feature嘅intensity set做0就可以熄咗佢):
- Post Process Volume – Unbound: turn on令佢影響整個scene,而唔理佢個brush settings
- Bloom: 光暈。呢個效果出奇地重,較細啲會好啲,但係冇咗又差好遠。就算個scene冇光源,佢對illumination都有效
- Ambient Cubmap: Unreal冇 “Ambient Light”,所以要用cubmap。Unreal 只係Support 32bits/Channel, 8.8.8.8 ARGB 32 bpp, unsigned。如果做咗個cubmap import唔到可能係因為未set 32 bpp https://docs.unrealengine.com/latest/INT/Engine/Content/Types/Textures/Cubemaps/CreatingCubemaps/index.html
- Lens Flares: 都係熄咗佢好啲⋯⋯
- Global Illumination: 可以一次過調整所有illumination。注意有illumination嘅物件唔會令周圍嘅嘢光咗,所以要加cubmap
- Motion Blur: 喺Oculus Rift見到Motion Blur仲衰過見唔到,一定要熄咗佢
Animation Transition Blending
唔知點解網上面search到嘅blending都好鬼複雜,如果你只係想做個好簡單嘅transition blending,由一個animation blend去另一個animation,首先create個animation blueprint,係入面create個state machine:
https://docs.unrealengine.com/latest/INT/Engine/Animation/StateMachines/CreatingStateMachines/index.html
然後喺個transition rules度set高返 Blend Settings -> Transition Crossfade Sharing -> Duration 就OK了。
Matinee
識用真係幾好用,雖然又多bug又多唔方便嘢XD
首先我解釋下點用:
- create一個matinee actor,然後select佢,喺details度click “Open Matinee” 就會開咗個Matinee Editor。
- 喺個scene度㨂咗個actor之後係Matinee Editor -> Tracks -> 左邊個section度add new empty group就會出咗嗰個actor嘅group。
- 再對個group right click -> Add New Movement Track就可以animation個action走黎走去
- 㨂咗track同時間之後按enter開keyframe
- 返去個scene度set position / rotation 等等
- 見到有條線track住點郁就成功啦
- 返去matinee editor可以調整個curve
不過好多唔方便嘢大家要記得:
- 如果喺matinee editor select個keyframe就會select返相應嘅actor,但係一deselect咗個actor就會deselect個keyframe,再郁個actor都唔會edit個keyframe。你要返去matinee editor select返個keyframe再返黎個scene度改。
- 有個UI bug係click details panel會click到個scene 啲嘢,令你deselect個actor -> deselect個keyframe :@ 解決方法係留意下個cursor over detail panel嘅時候有冇轉到cursor icon,如果仲係十字就select另一個application(Cmd+tab for Mac, 去另一個app例如Chrome)再返去Unreal。
- 又有個UI bug係right click個group冇menu出,呢個時候right click下curve panel至有menu出,然後right click個group就有返menu
- 記住唔好開住Matinee Editor,而又唔係改緊keyframe個陣改其他actor,因為一熄咗Matinee Editor就會冇曬。
- Matinee嘅animation track係冇blending 嘅,所以我用咗個好迂迴嘅方法做⋯⋯有人知道好啲嘅方法請話我知⋯⋯首先做個animation blueprint (custom_animation_blueprint) -> state machine,個transition rule用public variable determine (anim_var)。喺Matinee event track set 個keyframe,然後去Level blueprint -> add matinee controller(去level blueprint之前喺個scene要select緊個matinee actor),個controller會有之前係matinee editor度加嘅event。再跟住令個event改個public variable: actor ref -> get anim instance -> cast to custom_animation_blueprint -> set anim_var
- 如果你睇Matinee 嘅tutorial會見到佢好容易就做都一個cut scene,因為佢加條track就會自動多咗個camera然後好易就郁到佢。不過如果做Oculus,嗰個camera就唔會跟個oculus郁。可能你會想加個script入去個camera度就得,或者唔同camera track,而係直接郁個player actor。不過我又唔知點解rotate個actor向下望嗰陣個cam又唔跟住rotate⋯⋯