1 / 47

به نام یزدان پاک

به نام یزدان پاک. جزئیاتی از طراحی موتور بازی ایمان پولادین. مقدمه و معرفی. موضوع و سبک بازی فن آوری های مورد استفاده اهداف پروژه وبلاگ توسعه بازی: http://www.tochalco.com/blog. تاریخچه موتور. تکرار اول: ارتفاء موتور موجود تکرار دوم: تبدیل به DirectX10/11

wenda
Download Presentation

به نام یزدان پاک

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. به نام یزدان پاک

  2. جزئیاتی از طراحی موتور بازی ایمان پولادین

  3. مقدمه و معرفی • موضوع و سبک بازی • فن آوری های مورد استفاده • اهداف پروژه • وبلاگ توسعه بازی: http://www.tochalco.com/blog

  4. تاریخچه موتور • تکرار اول: ارتفاء موتور موجود • تکرار دوم: تبدیل به DirectX10/11 • تکرار سوم: Deferred Rendering • دمو

  5. تصمیمات استراتژیک • نوشتن موتور از پایه • Deferred Rendering • DirectX 10/11 API

  6. نوشتن موتور؟ • مزایا • طبق تحقیقات انجام شده اکثر (حدودا 75%) بازیهای AAA دنیا با موتور داخلی تولید شده اند (اطلاعات و مستندات این تحقیق در وبلاگ پروژه موجود است) • عدم وابستگی، توسعه آسانتر، انعطاف پذیری • معایب • زمان و هزینه بالا • ریسک بسیار بالا • عدم وجود تخصص و تجربه کافی ” آقا جان !!! - نوشتن موتور، اختراع دوباره چرخ نیست“

  7. Deferred Rendering? • مزایا • قابلیت رندر تعداد زیادی نور دینامیک • کاهش ترکیب شیدرها مخصوصاً در نور پردازی • وجود اطلاعات لازم برای پیاده سازی افکت های Post Process (Depth of Field, SSAO، Motion Blur، Soft Particles) به علت وجود Gbuffer • دارا بودن سرعتی خطی به نسبت تعداد نورها • O = Number of Objects • L = Number of Lights • Forward: (O*L) Draws, example: 1000 objects + 20 lights = 20000 draw calls • Deferred: (O + L) Draws, example: 1000 objects + 20 lights = 1020 draw calls • صرفه جویی در زمان pixel processing با اعمال شیدرها فقط روی پیکسلهایی که دیده میشوند • اکثر موتورهای مطرح از نور پردازی deferred استفاده می کنند : • CryEngine2, Battlefield3 (Next-gen), Rockstar RAGE (GTA4, Red dead redemption), X-Ray engine (Stalker), Metro2033, Dead Space engine, KillZone2, 3, … and the list is growing.

  8. DirectX 10+? • آینده • آمار از سایت Steam :http://store.steampowered.com/hwsurvey/ با توجه موارد ذکر شده، در زمان اتمام پروژه سخت افزارها و سیستم عامل مورد نیاز متداول خواهند بود و سرمایه گذاری روی این API نوعی آینده نگری است.

  9. تولید محتوای گرافیکی

  10. تولید محتوای گرافیکی

  11. تولید محتوای گرافیکی

  12. تولید محتوای گرافیکی

  13. Deferred Rendering - GBuffer Depth Normals Material (MaterialD + AO) Color + Specular

  14. Deferred Rendering - Lighting • Tile based deferred lighting • Andrew Lauritzen - http://visual-computing.intel-research.net/art/publications/deferred_rendering/lauritzen_deferred_shading_siggraph_2010.pptx • Divide screen in tiles • Cull screen space lights with each tile • Do deferred lighting • Repeat for next tile

  15. Deferred Rendering - Performance • Scene ~ 350k triangles – PSSM Shadows • Intel Core2 E5300 (low-end) • ATI – 4850 (mid-range) • 200 Lights - 1024x768 – 133fps • 100 Lights – 1024x768 – 200fps • 1000 Lights – 1024x768 – 31 fps • 1 Light (sun) – 1024x768 – 302 fps • Still room for more optimization • Isn’t it NICE ?! • Throw dynamic lights everywhere. Explosions, gun fire, car head lights, city lights, etc.

  16. Shadows - PSSM • PSSM is just Cascaded shadow maps with efficient frustum spliting scheme • Split view frustum in N parts with PSSM splitting scheme • Adjust imaginary sun position on the bounding sphere of the world • Detect shadow caster/receiver objects in each split from light’s point of view • Draw shadow maps for each split (total N shadow maps) • When rendering objects, read back from proper shadow map within position range

  17. Shadows – PSSM 2 • PROS • Best looking shadows on big outdoor environments • Preseves shadow quality within the whole view range • Used in many big games : Red dead redemption, Assassin’s Creed, KillZone2, Battlefield2, … • CONS • Very GPU/CPU intensive (usually 3-4 big shadow map renders, and 3-4 shadow map read backs with branching, culling, etc.)

  18. Shadows – PSSM – Speed Problem • Here comes D3D10 ! • Using D3D10 specific stuff • Texture Arrays • Geometry shaders • D3D10 Instancing • Branching (also applicable to D3d9 sm3.0 hw) • With the help of D3D10 : Generating 4 CSM shadow maps from … • Main Bottleneck – Object Culling , DrawCalls 80 Objects ~ 400 Draw calls 4 Render target changes 80 Objects ~ 100 Draw calls 1 Render target change ~ 3x speed increase D3D9 D3D10/10.1

  19. Shadows – PSSM

  20. HDR Lighting No HDR

  21. HDR Lighting HDR + Bloom

  22. HDR Lighting Final Luminance Value Downscale Luminance Map Blur Bright Filter

  23. Engine Core • Memory Management: • Leak Detection • Memory Tracking (By ID) • Alignement • Data Structure : SkipList • Profiling: • Hierarchal Profiling of subsystems • TOCHAL_BEGIN_PROFILE • TOCHAL_END_PROFILE • Live display of profiling data for debugging purposes, using scaleform ui integration (discussed later)

  24. Engine Core - Memory • SkipList ->

  25. Engine Core - Memory // Allocate Rigid bodies into physics sybsystem byte* ptr = tnew(TOCHAL_MEMID_PHYSICS) tlCRigidBody[100]; tdelete ptr;

  26. Engine Core • Exception Handling: • Suitable for Load/Initialization • We don’t use them in Render Frame • Call Stack, Details • Error/Event Log: • LOG_TEXT, LOG_WARNING, LOG_LOAD, LOG_ERROR • Exceptions – Call Stack • Containers: • We have our own custom Containers, Don’t use STL • STL: No custom memory management, code overhead

  27. Terrain • History: • Our Voxel Terrain Demo • The Two Aspects: • Terrain Geometry (VSD, LOD,…) • Terrain Material

  28. Terrain Contd • Geometry Algorithms: • Brute Force • ROAM • Geo Mip Mapping • Quad Trees • Geo ClipMap • Problems: • Some algorithms are not for games • Some algorithms are not GPU Friendly • Some algorithms do not use the modern hardware features like instancing, geometry shaders, etc

  29. Terrain Contd • Chunk Based Methods: • Divide whole terrain into chunks • A Chunk must be drawn using 1 DrawCall • Use some scene management for visibility check & culling • Do some LOD management on chunks • Problems: • LOD Switches and T-Junction removal

  30. Terrain Contd • Scene Management/Partitioning: • Quad Tree variant • More on this later • LOD Management: • Heuristic function deciding which LOD Chunk to use • Take into account, distance, camera fov, viewing angle, terrain height difference

  31. T-Junction Problem

  32. T-Junction Problem

  33. T-Junction Problem

  34. T-Junction Removal • Methods: • Draw an skirt geometry (ugly) • Interpolate the middle vertex (process intensive) • The FrostBite Engine 1 method • Method we have used (FrostBite One): • LOD level of adjacent chunks is limited to one • Prepare some connection strip in the borders of each chunk • Generate permutations for each chunk connecting from different sides to adjacent neighbors

  35. T-Junction Problem Solved

  36. Terrain Materials • Methods: • Use a middle size texture map+detail textures • Use texture splatting • Use middle size texture map+detail weight map+detail textures • Use a gigantic texture to paint and cover whole terrain (MegaTexture: id Tech5 Engine) • Shader Splatting (FrostBite Engine) • Hybrid methods

  37. Terrain Materials • Our Method: • Hybrid one using both procedural and pre-calculated details • Uses channels and layers like terrain Height, Slope, AO, Curvature, Angle to generate detail texture blend weights • Uses several detail texture maps via DX10’s Texture Arrays to reduce draw calls • Terrain Material Editor: • Node Based (Graph Based) material editor • Automatically generates shader code from user created material graph

  38. Scene Management • Why we need them? • Visibility determination (reducing GPU load) • Update cancelation (reducing CPU load) • Fast ray intersection tests • Fast Line of Sight tests • … • Methods : • Quad-Tree • BSP Tree • Octree • AABB Tree

  39. Scene Management Contd • What we do • Quad-Tree for terrain , why? • AABB-Tree for other geometry/objects, why? • Recursive data structure are bad for both instruction/data cache • We use some trick to store a tree in a linear and non-recursive structure • The traversal code is non-recursive tricky too • Does not disturb memory caching! • SSE optimized Box/Frustum test routine will be used on this data (to be implemented) • The way we store/traverse trees, makes the possibility of using multiple cores to speed-up culling routine

  40. User interface • Strategies • Writing your own controls and UI stuff (Pros/Cons) • Using third party custom controls (Pros/Cons) • Using Flash or HTML (Hikari, Webkit,…) • Scaleform Solution • Why using scaleform • Widely used by well knows brands, AAA titles • The UI content creation and authoring tools are real pain!, Scaleform uses flash so you have Adobe Flash as a powerful UI authoring tool • You can save too much budget by hiring a flash developer for your UI • Fancy game menus, in-game UI, HUDs are possible at no cost • What we use • We integrated scaleform into our engine

  41. User interface • Strategies • Writing your own controls and UI stuff (Pros/Cons) • Using third party custom controls (Pros/Cons) • Using Flash or HTML (Hikari, Webkit,…) • Scaleform Solution • Why using scaleform • Widely used by well knows brands, AAA titles • The UI content creation and authoring tools are real pain!, Scaleform uses flash so you have Adobe Flash as a powerful UI authoring tool • You can save too much budget by hiring a flash developer for your UI • Fancy game menus, in-game UI, HUDs are possible at no cost • What we use • We integrated scaleform into our engine

  42. Current Tasks • Havok Physics Integration • Animation Subsystem w/Havok Animation binding • Particle System Integration/Rendering • Game Entity System • Game World Editor • Terrain Stuff • AABB-Tree implementation

  43. دمو • برنامه نویس: سپهر تقدیسیان علی سیداف هادی رحیمی • گرافیست: مهام بری بهزاد حسین زاده

  44. سوال؟

  45. اطلاعات پروژه • وبلاگ توسعه بازی: http://www.tochalco.com/blog • فرصت های شغلی موجود برای نیروهای برنامه نویس، گرافیست،... (تماس از طریق ایمیل) jobs@tochalco.com

  46. پایان

More Related