Home Game Development unity – How to know when and the place overdraw happens

unity – How to know when and the place overdraw happens

0
unity – How to know when and the place overdraw happens

[ad_1]

I’ve realized that I haven’t got a transparent understanding of a number of the technical specifics of overdraw in Unity. I typically work on cell, the place overdraw is far more of a priority than it might be on a pc or console.

I perceive the fundamentals: Overdraw happens when pixels on the display screen are drawn a number of instances; this consumes extra GPU time and causes the body to take longer to render. The extra pixels on-screen which can be affected by overdraw, and the extra instances these pixels are redrawn, the larger the efficiency affect. One of the first causes of overdraw is clear sprites, notably with overlapping particle results. Post-processing results additionally trigger overdraw.

The Unity crew does not present quite a lot of details about overdraw of their documentation, and the visualization mode within the Editor doesn’t precisely mirror what occurs on the GPU. There are a handful of articles from third events, however they depend on clumsy real-world analogies and are frustratingly obscure on the technical specifics.

Question 1

Say that we’ve got two partially overlapping sprites which can be totally opaque (no alpha channel):

Partially overlapping fully opaque sprites

Here, the yellow sprite is partially obscured by the purple sprite.

I can consider two attainable outcomes:
A) Because the yellow sprite is partially seen, the engine attracts the entire sprite, then attracts the purple sprite on high of it. Overdraw happens the place the 2 sprites overlap.
B) The engine is ready to decide that a number of the yellow sq. is totally obscured by the purple sq., and solely attracts the pixels that are not obscured. No overdraw happens.

1.i) Which is the case right here?
1.ii) Would the conduct be the identical if the 2 squares had been rendered by Mesh Renderer with a completely opaque materials? I’m assuming it might, since sprites are internally rendered with polygons identical to a daily mesh.

Question 2

Say we’ve got {a partially} clear sprite overlapping one other sprite:

Overlapping sprites with partial transparency

Here, the blue sprite has an alpha channel. The edges are feathered and partially clear, whereas the pixels within the interior portion are totally opaque (alpha of 1).

I can consider three attainable outcomes:

A. Because the inexperienced sprite is partially seen, the engine attracts the entire inexperienced sprite, then attracts the blue sprite on high of it. Overdraw happens the place the 2 sprites overlap.
B. Because the blue sprite is partially clear, the engine should deal with the entire sprite as clear (even the totally opaque pixels). The engine attracts the entire yellow sprite, then attracts the purple blue on high of it. Overdraw happens the place the 2 sprites overlap.
C. The engine is ready to decide that a number of the pixels of the blue sprite are totally opaque, and never draw the inexperienced sprite beneath these pixels. Overdraw happens, however solely the place the feathered edges of the blue sprite overlap the inexperienced sprite.

Which is the case right here?

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here