찾기
내용으로 건너뛰기
추적
문서의 이전 판을 선택했습니다!
저장하면 이 자료로 새 판을 만듭니다.
미디어 파일
======Draw Call Batching====== To draw an object on the screen, the engine has to issue a draw call to the graphics API (e.g. //OpenGL ES// in the case of iOS). Every single draw call requires a significant amount of work on the part of the graphics API, causing significant performance overhead on the CPU side. Unity combines a number of objects at runtime and draws them together with a single draw call. This operation is called "batching". The more objects Unity can batch together, the better rendering performance you will get. Built-in batching support in Unity has significant benefit over simply combining geometry in the modeling tool (or using the //CombineChildren// script from the Standard Assets package). Batching in Unity happens _after_ visibility determination step. The engine does culling on each object individually, and the amount of rendered geometry is going to be the same as without batching. Combining geometry in the modeling tool, on the other hand, prevents effecient culling and results in much higher amount of geometry being rendered. =====Materials===== Only objects sharing the same material can be batched together. Therefore, if you want to achieve good batching, you need to share as many materials among different objects as possible. If you have two identical materials which differ only in textures, you can combine those textures into a single big texture - a process often called [[http://en.wikipedia.org/wiki/Texture_atlas|//texture atlasing//]]. Once textures are in the same atlas, you can use single material instead. If you need to access shared material properties from the scripts, then it is important to note that modifying [[ScriptRef:Renderer-material.html|Renderer.material]] will create a copy of the material. Instead, you should use [[ScriptRef:Renderer-sharedMaterial.html|Renderer.sharedMaterial]] to keep material shared. =====Dynamic Batching===== Unity can automatically batch moving objects into the same draw call if they share the same material. Dynamic batching is done automatically and does not require any additional effort on your side. Tips: * Batching dynamic objects has certain overhead _per vertex_, so batching is applied only to meshes containing less than _900_ vertex attributes in total. * If your shader is using Vertex Position, Normal and single UV, then you can batch up to 300 verts and if your shader is using Vertex Position, Normal, UV0, UV1 and Tangent, then only 180 verts. * _Please note: attribute count limit might be changed in future_ * Don't use scale. Objects with scale (1,1,1) and (2,2,2) won't batch. * Uniformly scaled objects won't be batched with non-uniformly scaled ones. * Objects with scale (1,1,1) and (1,2,1) won't be batched. On the other hand (1,2,1) and (1,3,1) will be. * Using different material instances will cause batching to fail. * Objects with lightmaps have additional (hidden) material parameter: offset/scale in lightmap, so lightmapped objects won't be batched (unless they point to same portions of lightmap) * Multi-pass shaders will break batching. E.g. Almost all unity shaders supports several lights in forward rendering, effectively doing additional pass for them * Using instances of a prefab automatically are using the same mesh and material. =====Static Batching===== Static batching, on the other hand, allows the engine to reduce draw calls for geometry of any size (provided it does not move and shares the same material). Static batching is significantly more efficient than dynamic batching. You should choose static batching as it will require less CPU power. In order to take advantage of static batching, you need explicitly specify that certain objects are static and will _not_ move, rotate or scale in the game. To do so, you can mark objects as static using the Static checkbox in the Inspector: {{:unity3d:StaticTagInspector.png}} Using static batching will require additional memory for storing the combined geometry. If several objects shared the same geometry before static batching, then a copy of geometry will be created for each object, either in the Editor or at runtime. This might not always be a good idea - sometimes you will have to sacrifice rendering performance by avoiding static batching for some objects to keep a smaller memory footprint. For example, marking trees as static in a dense forest level can have serious memory impact. Static batching is only available in Unity Pro for each platform. {{tag>유니티 unity}} * 출처: [[http://unitykoreawiki.com/index.php?n=KrMain.DrawCallBatching|유니티코리아위키]] (CC BY-NC-SA 2.0)
2+1?
이 필드는 비어 있도록 유지하세요:
저장
미리 보기
취소
편집 요약
참고: 이 문서를 편집하면 내용은 다음 라이선스에 따라 배포하는 데 동의하는 것으로 간주합니다:
CC Attribution-Noncommercial-Share Alike 4.0 International
연결문서
유니티3D ( Unity3D )
그래픽 성능 최적화
문서 도구
문서 보기
이전 판
연결문서
맨 위로
다크 모드로 보기
☀️
Toggle Menu
유니티3D ( Unity3D )
너두 고쳐두 됩니다.
사이트 도구
최근 바뀜
미디어 관리자
사이트맵
사용자 도구
등록
로긴
최근 수정된 문서
misuse_topical5
노박
unique_items
dinner_bell
deputy_beagle
ratslayer
one_for_my_baby
alerio
power_fist
제거됨
fixer
climb_ev_ry_mountain
companion
[장비 분실]
crashed_vertibird
brotherhood_t-51b_power_armor
marco
i_forgot_to_remember_to_forget
cateye