+ All Categories
Home > Documents > Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference:...

Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference:...

Date post: 14-Dec-2015
Category:
Upload: samantha-bradford
View: 218 times
Download: 2 times
Share this document with a friend
37
Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)
Transcript
Page 1: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Introduction to Level Optimization

Sai-Keung WongChiao Tung University, Taiwan, R.O.C.

Reference: Mastering Unreal Technology (MUT)

Page 2: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Contents

• Introduction to level optimization

Page 3: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Introduction to Level Optimization• You just finish one half of the game after a game level is done. • Prepare to finish the second half

– Level optimization• Why?• Some players cannot play your game smoothly on their own computer

due to too high “complexity” of your game– Lighting– Texture density– Model complexity– Scene computation, e.g. occlusion

• The strategy– Remove something that is unnecessary– Reduce the texture density– Reduce the model complexity

Page 4: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization:Simple approach

• Occlusion– If something cannot be seen, remove it

• If a model cannot hide something, don’t use it as an occluder

occluded visible

occluder

eye

Page 5: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

System Consumption

• Total computation time in different items– Program execution• e.g. Data management, game control

– Rendering• e.g. Display objects on screen, lighting computation

Page 6: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

In-Game Statistics

• An overview of the system consumption in different aspects

• Play the game and check the statistics– Press TAB, and enter “View scenerendering

• Examples– Frame rate– CPU Rendering time– GPU Rendering time

Page 7: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)
Page 8: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Commands for statistics

• STAT FPS ( Frames per second / frame rate ) – Show frames per second

• STAT SCENERENDERING (統計場景渲染) – Rendering time for lighting, translucent, occlusion

• STAT MEMORY (統計内存) – Memory usage

• STAT ENGINE (統計引擎) – Terrain, foliage, HUD, skeletal mesh

Page 9: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Commands for statistics

• STAT STREAMING (統計流) – Statistics about streaming

• STAT AUDIO (統計音频)

Page 10: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

SHOW Commands ( 顯示命令 )

• Show or hide items

• SHOW BSP (顯示 BSP ) – Show binary space partition planes

• SHOW DYNAMICSHADOWS (顯示動態陰影)

• SHOW UNLITTRANSLUCENCY (顯示未照亮的半透明物體)

Page 11: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

SHOW Commands ( 顯示命令 )

• SHOW POSTPROCESS (顯示後處理) • SHOW PARTICLES (顯示粒子) • SHOW FOLIAGE (顯示植被) – for terrain

• SHOW RIGIDBODY (顯示剛體)

Page 12: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

VIEWMODE Commands ( 查看模式命令 )

• VIEWMODE commands: change the in-game view mode – Show information about rendering

• VIEWMODE WIREFRAME (綫框查看模式)

Page 13: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

VIEWMODE Commands ( 查看模式命令 )

• VIEWMODE UNLIT (無光照查看模式) – No lighting and shadows

• VIEWMODE LIT (光照查看模式) – Display with textures, lightings and shadows

• VIEWMODE LIGHTINGONLY(僅光照查看模式) – No textures

Page 14: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

VIEWMODE Commands ( 查看模式命令 )

• VIEWMODE LIGHTCOMPLEXITY(光照複雜度查看模式) – Display surfaces affected by lighting

Page 15: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

VIEWMODE Commands ( 查看模式命令 )

• VIEWMODE TEXTUREDENSITY (貼圖密度查看模式) • High density: red• Medium density: green• Low density: blue

Page 16: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step one: statistics and lighting complexity

• Load a game level• Play from here • Press TAB or ‘`’

Page 17: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step one: statistics and lighting complexity

View modelcomplexity

Page 18: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step one: statistics and lighting complexity

VIEWMODE TEXTUREDENSITY

Page 19: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step one: statistics and lighting complexity

VIEWMODE LIGHTINGONLY

Page 20: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step one: statistics and lighting complexity

VIEWMODE UNLIT

Page 21: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

STAT SCENERENDERING

Page 22: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Occlusion

• If an object is occluded, it is not rendered.• How to determine whether an object is

occluded or not?• Check whether its bounding volume is visible

or not.

Page 23: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Occlusion

• If an object is not good to be an occluder, disable it.

Page 24: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step two:lighting and shadows

• For dynamic shadows, shader is used for manipulating the shadow buffer for softening the edges of shadows.

• Move the light sources farther away from the objects so as to make the shadows smaller.

Page 25: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Light Maps

• Light maps are pre-computed. Consume memory space only.

• Almost no rendering penalty• Use them extensively• For example, if an object is not affected y

dynamic lighting, set bForceDirectLightMap = true– Shadow buffer will not be used

Page 26: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Lighting environments( 光源環境 )

• Create a single modulated shadow for several light sources.

• Better performance compared to dynamic lighting.

Page 27: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Light functions (光照函數)• Any light maps associated with a light source

cannot be used if light functions are applied for the light source.

• Avoid using them.

Page 28: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Lighting on MLM_Unlit materials

• Materials with MLM_Unlit

• If a material is not affected by lighting, set bAcceptsLights = false

Page 29: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Statistics browser for geometry

• Content browser->Primitive stats

Page 30: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Statistics browser for geometry • Type – types of the objects• Count – numbers • Triangles – number of triangles • Resource Size – memory size• Lights (avg LM) – number of light maps• Lights (avg other) – number of non-light maps • Lights (Avg total) – Lights (avg LM) + Lights (avg other) • Obj/ Light cost – number of times a mesh is drawn per frame

Page 31: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

• Triangle cost – cost of rendering triangles• Lightmap – number of light maps• Shadowmap – number of shadow maps• LM Res – average light map resolution• Sections – number of sections• Radius (min) – minimum radius of bounding volumes• Radius (max) – maximum radius of bounding volumes• Radius (avg) – average radius of bounding volumes• Radius (min/max/avg) – the radius information of each mesh

Statistics browser for geometry

Page 32: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Material optimization

• Use fewer materials

Page 33: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Material optimization

• The most complex materials should not be too complex.

Page 34: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Unlit translucent Objects ( 無光照的半透明物體 )

• Overdraw problem

Page 35: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step three: light environment for dynamic shadows

• Use shadow volume• Light environment

Page 36: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Optimization step three: light environment for dynamic shadows

• Press F4->DynamicSMActor > Light Environment > LightEnvironmentComponent– bEnabled 。

• Make the environment brighter• LightShadowMode (光源陰影模式)

-> set as LightShadow_Modulate( 調制陰影 )

Page 37: Introduction to Level Optimization Sai-Keung Wong Chiao Tung University, Taiwan, R.O.C. Reference: Mastering Unreal Technology (MUT)

Level optimization

• Check fps after optimization


Recommended