渲染 过滤
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.
A FilterContexRef is the central class to create and use images, filters and queues.
Context implementations are found at the maxon::FilterContextClasses registry:
A command queue allows queuing of multiple filters.
Queue implementations are found at the maxon::FilterCommandQueueClasses registry:
The maxon::FilterInterface allows to use a render filter.
Filter implementations are found at the maxon::FilterClasses registry:
A filter image contains the actual image data.
Image implementations are found at the maxon::FilterImageClasses registry:
An image is created with maxon::FilterContextInterface::CreateImage() using these parameters:
The Open Image Denoiser filter can further be configured with these parameters:
// 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
// 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 ;