Skip to main content

Renderer3D

Struct Renderer3D 

Source
pub struct Renderer3D { /* private fields */ }
Expand description

Zero-allocation UE5-class Deferred GGX PBR + Persistent Multi-Core SIMD BVH4/BVH8 + Nanite Hi-Z + Lumen GI + VSM + Clustered Lighting + TSR 3D renderer.

Implementations§

Source§

impl Renderer3D

High-FPS UE5-class Deferred GGX PBR + Persistent Multi-Core Tiled SIMD BVH4/BVH8 + Lumen GI + Volumetric Fog + SIMD Bloom + Morphological AA/TAA renderer.

Source

pub fn sample_sky(dir: Vec3, sun: &DirectionalLight3D) -> Vec3

Evaluates physically inspired Rayleigh + Mie atmospheric sky, clouds, and HDR solar disk radiance along dir.

§Arguments
  • Vec3 - Unit view or reflection direction.
  • &DirectionalLight3D - Active sky & sun lighting parameters.
§Returns
  • Vec3 - Linear HDR sky radiance.
Source

pub fn attach_gpu_target(&mut self, handle: GpuTextureHandle, rect: Rect)

Attaches a shared-device GPU 3D render target texture handle for zero-readback single-pass UI+3D compositing.

§Arguments
  • &Self - Mutable 3D renderer.
  • GpuTextureHandle - Shared-device GPU texture backing the 3D render target.
  • Rect - Viewport rectangle in logical UI pixels.
Source

pub fn prepare_gpu_composite_descriptor( &mut self, frame_index: u64, ) -> Option<GpuCompositeDescriptor>

Prepares a GpuCompositeDescriptor referencing the attached shared-device GPU 3D render target for single-pass UI+3D compositing.

§Arguments
  • &Self - Mutable 3D renderer.
  • u64 - Monotonic compositor frame index.
§Returns
  • Option<GpuCompositeDescriptor> - Single-pass composite descriptor when a GPU target is attached.
Source

pub fn invalidate_taa_history(&mut self)

Explicitly resets temporal anti-aliasing history on camera cuts or world teleports without touching unrelated HUD state.

§Arguments
  • &Self - Mutable 3D renderer.
Source

pub fn can_reuse_cached_world( &self, world: &World3D, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, ) -> bool

Returns true when the cached 3D framebuffer can be reused across a HUD-only dirty frame without re-running 3D rasterization or starving TAA accumulation.

§Arguments
  • &Self - 3D renderer reference.
  • &World3D - Active 3D world.
  • u32 - Viewport width in pixels.
  • u32 - Viewport height in pixels.
  • &RenderQualityConfig - Active quality settings.
§Returns
  • bool - true when the cached 3D frame is valid and TAA accumulation does not require another sample.
Source

pub fn render_world_or_reuse_cached( &mut self, world: &mut World3D, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, ) -> (&[u8], bool)

Renders world into rgba_scratch only when 3D state changed or TAA needs another temporal sample, otherwise reusing the cached 3D buffer across HUD-only dirty updates.

§Arguments
  • &Self - Mutable 3D renderer.
  • &mut World3D - Open-world 3D scene graph.
  • u32 - Target viewport width in logical pixels.
  • u32 - Target viewport height in logical pixels.
  • &RenderQualityConfig - Runtime quality settings.
§Returns
  • (&[u8], bool) - Borrowed RGBA8 pixel slice and true if satisfied from cache without re-rasterization.
Source

pub fn render_world_into_pool( &mut self, world: &mut World3D, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, pool: &RenderBufferPool, fence_id: u64, ) -> Option<PooledFrameLease>

Renders world directly into a bounded zero-allocation RenderBufferPool slot tagged with fence_id.

§Arguments
  • &Self - Mutable 3D renderer.
  • &mut World3D - Open-world 3D scene graph.
  • u32 - Target viewport width in logical pixels.
  • u32 - Target viewport height in logical pixels.
  • &RenderQualityConfig - Runtime quality settings.
  • &RenderBufferPool - Bounded CPU output buffer pool.
  • u64 - Submission fence value guarding reclamation.
§Returns
  • Option<PooledFrameLease> - Populated pooled RGBA8 lease, or None if all bounded pool slots are in flight.
Source

pub fn render_world_interpolated_into_pool( &mut self, world: &mut World3D, snapshots: &DoubleBufferedSnapshot<World3DSnapshot>, alpha: f32, viewport: (u32, u32), quality: &RenderQualityConfig, target_pool: (&RenderBufferPool, u64), ) -> Option<PooledFrameLease>

Renders world using a discontinuity-safe interpolated World3DSnapshot sampled at alpha with object-space inverse-interpolated dynamic RT (zero dynamic_bvh rebuilds per VSync).

§Arguments
  • &Self - Mutable 3D renderer.
  • &mut World3D - 3D world holding shared mesh library, lighting, and BVH acceleration structures.
  • &DoubleBufferedSnapshot<World3DSnapshot> - Immutable (prev_state, curr_state) snapshot buffer.
  • f32 - Normalized interpolation alpha in [0.0, 1.0].
  • (u32, u32) - Target viewport (width, height) in logical pixels.
  • &RenderQualityConfig - Runtime quality settings.
  • (&RenderBufferPool, u64) - Bounded CPU output buffer pool and submission fence value.
§Returns
  • Option<PooledFrameLease> - Rendered interpolated frame lease, or None under pool backpressure.
Source

pub fn render_world( &mut self, world: &mut World3D, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, ) -> ImageBuffer

Renders world at runtime-configured quality into an ImageBuffer without zero-filling output memory.

§Arguments
  • &Self - Mutable 3D renderer.
  • &mut World3D - Open-world 3D scene graph.
  • u32 - Target viewport width in logical pixels.
  • u32 - Target viewport height in logical pixels.
  • &RenderQualityConfig - Live runtime quality, resolution scale, LOD, and ray-tracing settings.
§Returns
  • ImageBuffer - Ready RGBA8 rendered 3D frame for immediate presentation.
Source

pub fn render_world_rgba( &mut self, world: &mut World3D, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, ) -> &[u8] ⓘ

Renders world into the persistent internal rgba_scratch buffer, eliminating per-frame output heap allocations.

§Arguments
  • &Self - Mutable 3D renderer.
  • &mut World3D - Open-world 3D scene graph.
  • u32 - Target viewport width in logical pixels.
  • u32 - Target viewport height in logical pixels.
  • &RenderQualityConfig - Live runtime quality, resolution scale, LOD, and ray-tracing settings.
§Returns
  • &[u8] - Borrowed RGBA8 pixel slice of the rendered 3D frame.
Source

pub fn render_world_tsr_into_vec( &mut self, world: &mut World3D, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, out_pixels: &mut Vec<u8>, ) -> (u32, u32)

Renders world at sub-native resolution and reconstructs a sharp native (viewport_w, viewport_h) frame via UE5 Temporal Super Resolution (TSR).

§Arguments
  • &mut World3D - Open-world 3D scene graph.
  • u32 - Target native output width in pixels.
  • u32 - Target native output height in pixels.
  • &RenderQualityConfig - Runtime quality settings supplying internal resolution_scale.
  • &mut Vec<u8> - Reusable full-resolution destination RGBA8 buffer.
§Returns
  • (u32, u32) - Actual reconstructed output dimensions (dst_w, dst_h).
Source

pub fn render_world_tsr( &mut self, world: &mut World3D, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, ) -> ImageBuffer

Renders world using UE5 Temporal Super Resolution (TSR) upscaling and returns a full-resolution ImageBuffer.

§Arguments
  • &mut World3D - Open-world 3D scene graph.
  • u32 - Target native output width in pixels.
  • u32 - Target native output height in pixels.
  • &RenderQualityConfig - Runtime quality settings supplying internal scale and RT/Lumen toggles.
§Returns
  • ImageBuffer - Reconstructed native-resolution RGBA8 frame.
Source

pub fn render_world_tsr_into_pool( &mut self, world: &mut World3D, viewport: (u32, u32), quality: &RenderQualityConfig, target_pool: (&RenderBufferPool, u64), ) -> Option<PooledFrameLease>

Renders world at sub-native resolution and writes the TSR-reconstructed native frame directly into a bounded zero-allocation RenderBufferPool slot.

§Arguments
  • &mut World3D - Open-world 3D scene graph.
  • (u32, u32) - Target native output (viewport_w, viewport_h) in pixels.
  • &RenderQualityConfig - Runtime quality configuration controlling internal TSR scale.
  • (&RenderBufferPool, u64) - Bounded output frame pool and fence value.
§Returns
  • Option<PooledFrameLease> - Populated native-resolution TSR frame lease, or None under pool backpressure.
Source

pub fn apply_frame_pacing_feedback( &mut self, frame_ms: f32, quality: &mut RenderQualityConfig, ) -> FramePacingTelemetry3D

Feeds measured frame_ms into the damped PI AdaptiveFrameGovernor and applies smooth DRS scale, LOD bias, and RT probe stride adjustments to quality without FPS oscillation.

§Arguments
  • f32 - Measured render duration of the most recent frame in milliseconds.
  • &mut RenderQualityConfig - Mutable runtime quality settings updated when dynamic_resolution is enabled.
§Returns
  • FramePacingTelemetry3D - Updated smoothed frame-time and stability telemetry.
Source

pub fn compile_frame_graph( &mut self, viewport_w: u32, viewport_h: u32, quality: &RenderQualityConfig, ) -> RenderGraphSchedule3D

Builds and compiles the UE5 Render Dependency Graph (RDG) for (viewport_w, viewport_h) and quality, reporting dead-pass culling and transient memory aliasing savings.

§Arguments
  • u32 - Target viewport width in pixels.
  • u32 - Target viewport height in pixels.
  • &RenderQualityConfig - Active quality configuration controlling RT, Lumen, VSM, and TSR passes.
§Returns
  • RenderGraphSchedule3D - Compiled pass schedule with transient memory aliasing telemetry.
Source§

impl Renderer3D

Source

pub fn get_color_buffer(&self) -> &Vec<u8> ⓘ

Source

pub fn get_mut_color_buffer(&mut self) -> &mut Vec<u8> ⓘ

Source

pub fn set_color_buffer(&mut self, val: Vec<u8>) -> &mut Self

Source

pub fn get_aa_buffer(&self) -> &Vec<u8> ⓘ

Source

pub fn get_mut_aa_buffer(&mut self) -> &mut Vec<u8> ⓘ

Source

pub fn set_aa_buffer(&mut self, val: Vec<u8>) -> &mut Self

Source

pub fn get_depth_buffer(&self) -> &Vec<f32>

Source

pub fn get_mut_depth_buffer(&mut self) -> &mut Vec<f32>

Source

pub fn set_depth_buffer(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_last_executed_rdg_passes(&self) -> usize

Source

pub fn get_mut_last_executed_rdg_passes(&mut self) -> &mut usize

Source

pub fn set_last_executed_rdg_passes(&mut self, val: usize) -> &mut Self

Source

pub fn get_frame_governor(&self) -> &AdaptiveFrameGovernor

Source

pub fn get_mut_frame_governor(&mut self) -> &mut AdaptiveFrameGovernor

Source

pub fn set_frame_governor(&mut self, val: AdaptiveFrameGovernor) -> &mut Self

Source

pub fn get_render_graph(&self) -> &RenderGraph3D

Source

pub fn get_mut_render_graph(&mut self) -> &mut RenderGraph3D

Source

pub fn set_render_graph(&mut self, val: RenderGraph3D) -> &mut Self

Source

pub fn get_rt_stride_bias(&self) -> usize

Source

pub fn get_mut_rt_stride_bias(&mut self) -> &mut usize

Source

pub fn set_rt_stride_bias(&mut self, val: usize) -> &mut Self

Source

pub fn get_adapted_exposure(&self) -> f32

Source

pub fn get_mut_adapted_exposure(&mut self) -> &mut f32

Source

pub fn set_adapted_exposure(&mut self, val: f32) -> &mut Self

Source

pub fn get_last_world_revision(&self) -> u64

Source

pub fn get_mut_last_world_revision(&mut self) -> &mut u64

Source

pub fn set_last_world_revision(&mut self, val: u64) -> &mut Self

Source

pub fn get_taa_accumulated_frames(&self) -> u32

Source

pub fn get_mut_taa_accumulated_frames(&mut self) -> &mut u32

Source

pub fn set_taa_accumulated_frames(&mut self, val: u32) -> &mut Self

Source

pub fn get_cached_world_reuses(&self) -> u64

Source

pub fn get_mut_cached_world_reuses(&mut self) -> &mut u64

Source

pub fn set_cached_world_reuses(&mut self, val: u64) -> &mut Self

Source

pub fn get_width(&self) -> u32

Source

pub fn get_mut_width(&mut self) -> &mut u32

Source

pub fn set_width(&mut self, val: u32) -> &mut Self

Source

pub fn get_height(&self) -> u32

Source

pub fn get_mut_height(&mut self) -> &mut u32

Source

pub fn set_height(&mut self, val: u32) -> &mut Self

Source

pub fn get_last_stats(&self) -> RenderStats3D

Source

pub fn get_mut_last_stats(&mut self) -> &mut RenderStats3D

Source

pub fn set_last_stats(&mut self, val: RenderStats3D) -> &mut Self

Trait Implementations§

Source§

impl Clone for Renderer3D

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Renderer3D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Renderer3D

Default zero-allocation UE5-class Renderer3D with identity motion-vector matrices and pre-allocated subsystems.

Source§

fn default() -> Self

Creates an empty Renderer3D initialized with identity previous projection, Hi-Z pyramid, Lumen cache, VSM, Clustered Lighting, TSR, and frame governor.

§Returns
  • Self - Ready UE5-class 3D renderer.

Auto Trait Implementations§

§

impl Forget for Renderer3D

§

impl Freeze for Renderer3D

§

impl Move for Renderer3D

§

impl RefUnwindSafe for Renderer3D

§

impl Send for Renderer3D
where RawVecInner: Send, RawTable<(usize, ())>: Send,

§

impl Sync for Renderer3D
where RawVecInner: Sync, RawTable<(usize, ())>: Sync,

§

impl Unpin for Renderer3D
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Renderer3D

§

impl UnwindSafe for Renderer3D
where RawVecInner: UnwindSafe, NonNull<u8>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.