Friday, October 28, 2022
HomeGame Developmentunity - The way to perceive when and the place overdraw happens

unity – The way to perceive when and the place overdraw happens


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

I perceive the fundamentals: Overdraw happens when pixels on the display screen are drawn a number of occasions; this consumes extra GPU time and causes the body to take longer to render. The extra pixels on-screen which are affected by overdraw, and the extra occasions these pixels are redrawn, the higher the efficiency impression. One of many major causes of overdraw is clear sprites, significantly with overlapping particle results. Submit-processing results additionally trigger overdraw.

The Unity workforce does not present loads of details about overdraw of their documentation, and the visualization mode within the Editor doesn’t precisely replicate 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.

Query 1

Say that we’ve two partially overlapping sprites which are absolutely opaque (no alpha channel):

Partially overlapping fully opaque sprites

Right here, the yellow sprite is partially obscured by the purple sprite.

I can consider two doable outcomes:
A) As a result of the yellow sprite is partially seen, the engine attracts the entire sprite, then attracts the purple sprite on prime of it. Overdraw happens the place the 2 sprites overlap.
B) The engine is ready to decide that a few of the yellow sq. is absolutely 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 habits be the identical if the 2 squares have been rendered by Mesh Renderer with a completely opaque materials? I am assuming it could, since sprites are internally rendered with polygons similar to an everyday mesh.

Query 2

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

Overlapping sprites with partial transparency

Right here, the blue sprite has an alpha channel. The perimeters are feathered and partially clear, whereas the pixels within the interior portion are absolutely opaque (alpha of 1).

I can consider three doable outcomes:

A. As a result of the inexperienced sprite is partially seen, the engine attracts the entire inexperienced sprite, then attracts the blue sprite on prime of it. Overdraw happens the place the 2 sprites overlap.
B. As a result of the blue sprite is partially clear, the engine should deal with the entire sprite as clear (even the absolutely opaque pixels). The engine attracts the entire yellow sprite, then attracts the purple blue on prime of it. Overdraw happens the place the 2 sprites overlap.
C. The engine is ready to decide that a few of the pixels of the blue sprite are absolutely 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?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments