Skip to main content

RtFilter

Struct RtFilter 

Source
pub struct RtFilter<'a> { /* private fields */ }
Expand description

Ray tracing denoising filter (OIDN “RT” filter).

Denoises a beauty (color) image, optionally using albedo and normal AOVs. Reuse the same filter for multiple frames when dimensions match.

Implementations§

Source§

impl<'a> RtFilter<'a>

Source

pub fn new(device: &'a OidnDevice) -> Result<Self, Error>

Creates a new RT filter. Reuse the same filter for multiple frames when dimensions match.

§Errors

Returns Error::FilterCreationFailed if the RT filter type is not available, or the device’s last error (e.g. Error::OidnError).

Source

pub fn set_dimensions(&mut self, width: u32, height: u32) -> &mut Self

Image dimensions (must be set before execute).

Source

pub fn set_hdr(&mut self, hdr: bool) -> &mut Self

Whether the input is HDR. Default: true.

Source

pub fn set_srgb(&mut self, srgb: bool) -> &mut Self

Whether the input is sRGB (LDR). Default: false.

Source

pub fn set_clean_aux(&mut self, clean: bool) -> &mut Self

Whether albedo/normal are noise-free (prefiltered). Default: false.

Source

pub fn set_input_scale(&mut self, scale: f32) -> &mut Self

Input scale (e.g. for HDR). NaN = auto.

Source

pub fn set_quality(&mut self, quality: Quality) -> &mut Self

Filter quality. Default: High.

Source

pub fn get_bool(&self, name: &str) -> bool

Gets a boolean filter parameter (e.g. "hdr", "srgb").

Source

pub fn get_int(&self, name: &str) -> i32

Gets an integer filter parameter (e.g. "quality").

Source

pub fn get_float(&self, name: &str) -> f32

Gets a float filter parameter (e.g. "inputScale").

Source

pub unsafe fn set_progress_monitor_raw( &self, func: Option<unsafe extern "C" fn(user_ptr: *mut c_void, n: f64) -> bool>, user_ptr: *mut c_void, )

Sets the progress monitor callback. Callback receives progress in [0,1]; return false to cancel. Safe to call with (None, null) to clear. Callback must not panic.

Source

pub fn execute_in_place(&self, color: &mut [f32]) -> Result<(), Error>

Denoises color in-place. color must be width * height * 3 floats (RGB).

§Errors

Returns Error::InvalidDimensions if dimensions are unset or buffer sizes do not match, or an OIDN error from the device.

Source

pub fn execute_in_place_with_aux( &self, color: &mut [f32], albedo: Option<&[f32]>, normal: Option<&[f32]>, ) -> Result<(), Error>

Denoises color in-place with optional albedo and normal AOVs (each width * height * 3 floats).

Source

pub fn execute( &self, color: Option<&[f32]>, output: &mut [f32], ) -> Result<(), Error>

Denoises color into output. Slices must be width * height * 3 floats (RGB).

Source

pub fn execute_with_aux( &self, color: Option<&[f32]>, output: &mut [f32], albedo: Option<&[f32]>, normal: Option<&[f32]>, ) -> Result<(), Error>

Denoises color into output with optional albedo and normal AOVs (each width * height * 3 floats).

Trait Implementations§

Source§

impl Debug for RtFilter<'_>

Source§

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

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

impl Drop for RtFilter<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for RtFilter<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for RtFilter<'a>

§

impl<'a> RefUnwindSafe for RtFilter<'a>

§

impl<'a> !Sync for RtFilter<'a>

§

impl<'a> Unpin for RtFilter<'a>

§

impl<'a> UnwindSafe for RtFilter<'a>

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,