pub enum ViewBackground {
Scene,
Transparent,
}Expand description
What a view’s picture holds where no geometry covers a pixel — see
ViewDesc::background.
Variants§
Scene
The frame’s own background: the sky where one is set, SCENE_CLEAR
where none is, and an alpha of one at every pixel. What the primary
camera draws, and what every view drew before this choice existed.
Transparent
Nothing: the view clears to transparent black, draws no sky, and its target’s alpha is the frame’s coverage — one where geometry was drawn and zero where it was not.
For a picture composited over something else, such as a model rendered
into an icon. The colour is straight, not premultiplied, which is
what SpriteRenderer blends: a covered pixel
holds the colour an opaque view would have drawn there, and a
transparent one holds whatever light the air in front of the far plane
scattered — zero on a frame without volumetric fog — which a
straight-alpha blend weighs by zero.
§What keeps the alpha, and what cannot
The forward pass, grass and water write coverage; the volumetric
composite, the reflection composite and the bloom composite carry the
alpha they read; the tonemap writes it into the target. The two
antialiasing tiers cannot: each blends a pixel’s colour with its
neighbours’ across exactly the edges the coverage has, so an edge
pixel would come out mixed with the transparent black beside it — a
premultiplied colour under a straight-alpha consumer, which is a dark
fringe. ForwardRenderer::create_view refuses a transparent view
whose ViewDesc::effects name either of them, and
ViewDesc::transparent is a description it accepts.
render_scale’s upscale filters on
the same terms and so does not apply: a transparent view is drawn at
its target’s own extent whatever the scale is.
Bloom and auto-exposure keep the alpha and change the colour. Bloom’s
glow past a silhouette lands on pixels the coverage says are empty and
is dropped with them; auto-exposure meters the background as black —
see ViewDesc::transparent.
Implementations§
Source§impl ViewBackground
impl ViewBackground
Sourcepub const REFUSED_ON_TRANSPARENT: RenderEffects
pub const REFUSED_ON_TRANSPARENT: RenderEffects
The effects a ViewBackground::Transparent view is refused with —
see that variant.