[null,null,["上次更新時間:2023-11-13 (世界標準時間)。"],[],[],null,["# Com2uS uses Vulkan for better graphics\n\n*Summoners War: Chronicles* [US(WW)](https://play.google.com/store/apps/details?id=com.com2us.chronicles.android.google.us.normal)\nand [KR](https://play.google.com/store/apps/details?id=com.com2us.chronicles.android.google.kr.normal)\nby Com2uS exclusively utilizes Vulkan for rendering on Android, with up to 30%\nperformance improvements.\n\n[Vulkan](/games/develop/use-vulkan) is a modern, cross-platform 3D graphics API\ndesigned to minimize abstraction between device graphics hardware and your game.\nVulkan has lower CPU overhead compared with OpenGL ES, and Vulkan offers a\nwider range of features.\n**Figure 1.** In game screenshot. Your browser doesn't support the video tag. **Figure 2.** In game video.\n\nRendering features\n------------------\n\nCom2uS developed advanced rendering features for *Summoners War: Chronicles*\nincluding:\n\n- Custom deferred rendering system with pre-render light culling and up to sixteen active lights in the [view frustum](https://en.wikipedia.org/wiki/Viewing_frustum) simultaneously\n- Indirect rendering instancing method (called `Clay`) to draw many meshes, materials, and textures at once\n- Extensive use of compute shaders for pre-rendering tasks\n- Ability to dynamically adjust active shadow rendering and post-processing effects based on camera movement, graphic options, and runtime performance\n\nMobile hardware accommodations\n------------------------------\n\n*Summoners War: Chronicles* uses the same renderer for Android devices, personal\ncomputers, and dedicated gaming consoles. To achieve optimal performance on\nmobile hardware, Com2uS tuned rendering settings including draw depth and\ndensity. To accommodate certain devices running on Android 11 (API level 30) and\nlower, Com2uS created alternate versions of some shaders and used reduced\ninstance counts. *Summoners War: Chronicles* also uses\n[adaptive performance](/games/optimize/adpf) features on Android to dynamically\nadjust graphic options in response to device thermal conditions.\n\nVulkan-only rationale\n---------------------\n\nCom2uS used Vulkan exclusively for *Summoners War: Chronicles* for several\nreasons:\n\n- Minimum device requirements excluded older, less powerful devices lacking [Vulkan support](/about/dashboards#Vulkan)\n- Customization of the [Unity engine](/games/engines/unity/start-in-unity) Built-in Render Pipeline (BiRP) required features only available in the game's Vulkan backend\n- Implementation of rendering features utilizing compute shader output and shader storage buffer objects (SSBOs) can be done on Vulkan but not OpenGL ES\n\nCompute workloads\n-----------------\n\n*Summoners War: Chronicles* performs significant compute shader work to produce\ndata for rendering. Compute shaders are used for:\n\n- Object culling\n- Collision inspection\n- Animation tasks\n- Indirect rendering data generation\n\nThe resulting compute data is written to Unity engine RWBuffer objects. To\nachieve optimal performance *Summoners War: Chronicles* runs all its compute\njobs with a single dispatch, which requires the use of multiple RWBuffers\nsimultaneously. This approach was only possible using Vulkan, as the Unity BiRP\nOpenGL ES backend only supports the use of one single RWBuffer a time.\n\nThe data sets generated for rendering are often larger than device size limits\nfor uniform buffer objects (UBOs). *Summoners War: Chronicles* instead uses\nShader storage buffer objects (SSBOs), which have larger capacity limits.\nHowever, binding SSBOs to vertex stage operations requires read-only SSBO\nsupport. OpenGL ES only supports read-write SSBOs while Vulkan can mark SSBOs as\nread-only.\n\nIndirect instanced rendering with Clay\n--------------------------------------\n\nFor *Summoners War: Chronicles* , Com2uS developed a method to batch multiple\nmaterials, meshes, and textures into a single draw call. Com2uS refers to this\nsystem as *Clay*. Clay improves game performance by 30% as a result of\nsignificantly reducing draw calls.\n\nClay begins during the culling and collision phase by building a list of\ncompatible visible renderable objects. Clay then generates rendering information\nfor each identified object into SSBOs. This process is performed with compute\nshaders, which enable the use of indirect instanced rendering using the Unity\nrenderer [DrawMeshInstancedIndirect](https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstancedIndirect.html)\nfunction. With indirect rendering, the instance information and instance count\nparameters are generated directly on the GPU. When drawing objects, instead of\nbinding a traditional object mesh, Clay binds a cone mesh as pictured:\n**Figure 3.** A cone mesh.\n\nClay then transforms the cone mesh in the vertex shader using a bound SSBO of\nvertex transformation data generated by the compute shaders. Binding SSBOs to\nthe vertex stage requires the use of Vulkan. Clay can use multiple transformed\ncones to render a single object. The object's complexity determines the number\nof cones.\n**Figure 4.** How cone mesh is transformed to tree.\n\nMaterial data for objects is batched in another buffer generated by the compute\nshaders. The buffer is bound to the fragment shader. Textures for the objects\nbeing drawn are configured in a texture array. The array indices for an object\\`s\ntextures are included in the object's material data. Under ideal circumstances,\nClay can render with a maximum of seven draw calls:\n\n- Static objects\n- Animated objects\n- Shadows (four iterations)\n- Reflections\n\nUnity plus Vulkan\n-----------------\n\n*Summoners War: Chronicles* demonstrates that the powerful combination of the\nUnity game engine and Vulkan graphics API enables developers to bring advanced\nconsole quality graphics to Android devices."]]