pub struct Post {Show 23 fields
pub render_scale: f32,
pub sharpen: f32,
pub ambient_occlusion: AmbientOcclusion,
pub ao_half_resolution: bool,
pub ao_temporal: bool,
pub contact_shadows: f32,
pub ssr: f32,
pub ssr_max_distance: f32,
pub anti_aliasing: AntiAliasing,
pub taa_sharpness: f32,
pub exposure: f32,
pub tonemap: Tonemap,
pub bloom: f32,
pub bloom_threshold: f32,
pub contrast: f32,
pub saturation: f32,
pub temperature: f32,
pub tint: f32,
pub vignette: f32,
pub chromatic_aberration: f32,
pub lens_distortion: f32,
pub lens_scale: f32,
pub lut: Option<Texture>,
}Expand description
What happens to the lit 3D frame before it reaches the screen. Sprites and UI drawn on top are not changed.
ctx.post.exposure = 0.5; // half a stop brighter
ctx.post.bloom = 0.15;
ctx.post.tonemap = Tonemap::Neutral;
ctx.post.temperature = 0.2; // warmerFields§
§render_scale: f32The 3D scene is drawn at this fraction of the window’s size in each
direction, then scaled to the window before sprites and UI, which stay
at the window’s resolution: below 1 is cheaper and softer, above 1
(supersampling) sharper and costlier. From MIN_RENDER_SCALE to
MAX_RENDER_SCALE; anything else is clamped. Default 1 (no extra
pass).
sharpen: f32How much the scaled image is sharpened, 0 to 1 (an adaptive
contrast filter that only touches soft edges). Only used with a
render_scale other than 1. Default 0.
ambient_occlusion: AmbientOcclusionAmbient-only GTAO, before opaque lighting.
ao_half_resolution: boolTrace GTAO at half width and height, then bilaterally upsample. Contact shadows remain full resolution. Default false.
ao_temporal: boolAccumulate GTAO over frames with rotating slices, following the camera and moving models (the same motion vectors as TAA) and rejecting history whose depth disagrees. Independent of TAA. Default false; enable to trade history cost for fewer samples.
contact_shadows: f32Contact shadows: how far, in world units, each pixel looks toward
the sun across the depth buffer for something close that blocks
it. They catch the small shadows the shadow map is too coarse for:
under feet, pebbles and cups, in creases. 0 (the default) is off;
0.3 suits people and props. Only things on screen cast them. Shares
a full-screen pass with AmbientOcclusion (one pass for both).
ssr: f32Screen-space reflections: how strongly glossy surfaces (roughness
below about 0.7, fully below 0.4) reflect what’s on screen, 0 to 1,
on top of the sky and reflection probes they reflect anyway. Where
the reflected ray finds nothing on screen (it leaves the screen, goes
behind something, or runs past
ssr_max_distance), the environment’s
reflection stays. Wet streets, polished floors, still water. Things
off screen or hidden aren’t reflected, and normal maps don’t bend the
reflection. The colors come from the last frame’s image, so the
first frame after a camera cut reflects only the environment. A
half-resolution pass after the depth prepass; AntiAliasing::Taa
smooths its grain. Reflections use depth-aware filtered mips as roughness
increases; the blur footprint is bounded in screen pixels. 0 (the default) is off.
use ponko::*;
assert_eq!(Post::default().ssr, 0.0);
let wet_street = Post { ssr: 1.0, ..Default::default() };
assert_eq!(wet_street.ssr_max_distance, 30.0);ssr_max_distance: f32How far, in world units, a screen-space reflection looks along the reflected ray; it fades out toward the end. Default 30.
anti_aliasing: AntiAliasingPost antialiasing. Default off to preserve existing scenes.
taa_sharpness: f32How much AntiAliasing::Taa sharpens the result (it softens the
image a little), 0 to 1. Default 0.25.
exposure: f32Brightness in stops: +1 doubles the light, -1 halves it. Default 0.
tonemap: TonemapHow light maps to the screen. Default Tonemap::Aces.
bloom: f32How strongly bright light glows into its surroundings; 0 turns bloom off. Default 0.05.
bloom_threshold: f32How bright light must be to glow (1 is white). Default 1.
contrast: f321 keeps the contrast, higher is punchier, lower flatter. Default 1.
saturation: f321 keeps the colors, 0 is grey, higher is more vivid. Default 1.
temperature: f32White balance, -1 (cool, blue) to 1 (warm, orange). Default 0.
tint: f32White balance, -1 (green) to 1 (magenta). Default 0.
vignette: f32How much the corners darken, 0 to 1. Default 0.
chromatic_aberration: f32Color fringes toward the edges, as a cheap lens splits red, green and blue apart, 0 to 1. Default 0.
use ponko::*;
let speed = Post { chromatic_aberration: 0.8, lens_distortion: -0.26, lens_scale: 1.04, ..Default::default() };
assert_eq!(Post::default().chromatic_aberration, 0.0);lens_distortion: f32Bends the picture as a lens would, -1 to 1: above 0 bulges the middle out (barrel), below 0 pinches it in (pincushion). Default 0.
lens_scale: f32Zooms the picture in (above 1) or out after the distortion, to hide the edges it pulls in. Above zero; default 1.
lut: Option<Texture>A color lookup table for grading, applied after tone mapping: a
strip of n squares of n x n pixels (for example 1024 x 32),
red across each square, green down it, blue from square to square.
A neutral one changes nothing; paint over it in an image editor to
grade. Default none.
Implementations§
Source§impl Post
impl Post
Sourcepub fn render_size(&self, window: (u32, u32)) -> (u32, u32)
pub fn render_size(&self, window: (u32, u32)) -> (u32, u32)
The size the 3D scene is drawn at in a window of window pixels:
scaled by render_scale (clamped; a NaN counts
as 1), at least 1 pixel and at most limit wide (0: no limit).
use ponko::*;
let post = Post { render_scale: 0.5, ..Default::default() };
assert_eq!(post.render_size((1920, 1080)), (960, 540));Trait Implementations§
impl Copy for Post
impl StructuralPartialEq for Post
Auto Trait Implementations§
impl Forget for Post
impl Freeze for Post
impl RefUnwindSafe for Post
impl Send for Post
impl Sync for Post
impl Unpin for Post
impl UnsafeUnpin for Post
impl UnwindSafe for Post
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Component for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
impl<T> MaybeSync for T
impl<T> MaybeSync for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().impl<T> Scalar for T
impl<T> SerializableAny for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.