渲染 过滤

内容表

关于

Render filters are used to post-process rendered images. They are currently used to implement the denoiser filter.

The filter interfaces are defined in the render_filter.framework.

FilterContex

A FilterContexRef is the central class to create and use images, filters and queues.

Context implementations are found at the maxon::FilterContextClasses registry:

  • maxon::FilterContextClasses::OIDNCONTEXT: Open Image Denoiser context implementation.

Queue

A command queue allows queuing of multiple filters.

Queue implementations are found at the maxon::FilterCommandQueueClasses registry:

  • maxon::FilterCommandQueueClasses::OIDNFILTERCOMMANDQUEUE: Open Image Denoiser queue implementation.

过滤

The maxon::FilterInterface allows to use a render filter.

Filter implementations are found at the maxon::FilterClasses registry:

  • maxon::FilterClasses::OIDNFILTERRT: Intel Denoiser Raytracing implementation.

FilterImage

A filter image contains the actual image data.

Image implementations are found at the maxon::FilterImageClasses registry:

  • maxon::FilterImageClasses::OIDNFILTERIMAGE: Open Image Denoiser image implementation.

An image is created with maxon::FilterContextInterface::CreateImage() using these parameters:

  • maxon::FilterImageDescriptionParameters::WIDTH: Image width.
  • maxon::FilterImageDescriptionParameters::HEIGHT: Image height.

Open Image Denoiser parameters

The Open Image Denoiser filter can further be configured with these parameters:

  • maxon::OIDNFilterParameter::HDR: If the input data is in hight dynamic range.
  • maxon::OIDNFilterParameter::SRGB: True if the color data is in sRGB.
  • maxon::OIDNFilterParameter::ALBEDO: Albedo buffer.
  • maxon::OIDNFilterParameter::NORMAL: Normal buffer.

范例

// This example copies the given BaseBitmap into the color buffer and // applies the Intel denoiser filter to the image.

// source image buffer maxon::BaseArray<maxon::Vector4d32> bufferColor; bufferColor. Resize (pixelCount) iferr_return ;

// target image buffer maxon::BaseArray<maxon::Vector4d32> bufferDenoised; bufferDenoised. Resize (pixelCount) iferr_return ;

// covnert BaseBitmap to array

MAXON_SCOPE { Int pos = 0;
for ( Int32 y = 0; y < height; ++y) { for ( Int32 x = 0; x < width; ++x) { UInt16 r, g, b = 0; bitmap-> GetPixel (x, y, &r, &g, &b); const Float32 rf = Float32 (r) / 255.9f; const Float32 gf = Float32 (g) / 255.9f; const Float32 bf = Float32 (b) / 255.9f; const maxon::Vector4d32 color { rf, gf, bf, 1.00f }; bufferColor[pos] = color; ++pos; } } }

// get context for Intel Open Image Denoise maxon::FilterContextRef filterContext = maxon::FilterContextClasses::OIDNCONTEXT().Create() iferr_return ; filterContext.Init() iferr_return ;

// create command queue maxon::FilterCommandQueueRef commandQueue = filterContext.CreateCommandQueue() iferr_return ;

// create filter maxon::FilterRef filter = filterContext.CreateFilter(maxon::FilterClasses::OIDNFILTERRT.GetId()) iferr_return ;

// create images maxon::DataDictionary imgDesc; imgDesc.Set(maxon::FilterImageDescriptionParameters::WIDTH, static_cast< UInt32 > (width)) iferr_return ; imgDesc.Set(maxon::FilterImageDescriptionParameters::HEIGHT, static_cast< UInt32 > (height)) iferr_return ; maxon::FilterImageRef beauty = filterContext.CreateImage(imgDesc) iferr_return ; maxon::FilterImageRef output = filterContext.CreateImage(imgDesc) iferr_return ;

// Load image data beauty.ReadFromCPUMemory(bufferColor) iferr_return ;

// execute queue commandQueue.AttachFilter(filter, beauty, output) iferr_return ; filterContext.ExecuteCommandQueue(commandQueue) iferr_return ;

// get result image output.WriteToBuffer(bufferDenoised) iferr_return ;

延伸阅读

Int
maxon::Int Int
定义: ge_sys_math.h:62
UInt32
maxon::UInt32 UInt32
定义: ge_sys_math.h:59
Float32
maxon::Float32 Float32
定义: ge_sys_math.h:66
maxon::BaseArray::Resize
ResultMem Resize(Int newCnt, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::DEFAULT)
定义: basearray.h:1077
maxon::Vec4
A vector consisting of four components X, Y, Z and W.
定义: vec4.h:14
iferr_return
#define iferr_return
定义: resultbase.h:1434
maxon::BaseArray
定义: basearray.h:366
UInt16
maxon::UInt16 UInt16
定义: ge_sys_math.h:57
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
BaseBitmap::GetPixel
void GetPixel(Int32 x, Int32 y, UInt16 *r, UInt16 *g, UInt16 *b) const
定义: c4d_basebitmap.h:682
MAXON_SCOPE
#define MAXON_SCOPE
定义: apibase.h:2645

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1