HDK
|
#include <BRAY_PixelFilter.h>
Classes | |
class | Factory |
Public Types | |
using | FactoryPtr = UT_UniquePtr< Factory > |
using | SampleData = BRAY_SampleFilter::SampleData |
Public Member Functions | |
BRAY_PixelFilter (const UT_Options *options) | |
virtual | ~BRAY_PixelFilter () |
virtual const char * | className () const =0 |
Class name for the pixel filter. More... | |
virtual void | filter (BRAY_PixelState &pstate, const SampleData &data, const UT_Vector4 *sample_locations, size_t nsamples)=0 |
virtual bool | checkpoint (UT_JSONWriter &w) const =0 |
virtual bool | loadCheckpoint (UT_JSONParser &p) |
bool | sampleHitOrMiss (const BRAY_PixelState &ps, int sidx) const |
Test whether the sample hit or missed intersecting an object. More... | |
void | writePixel (BRAY_PixelState &ps, const SampleData &data, const UT_Vector4 *sample_locations, int sidx) |
void | overwritePixel (BRAY_PixelState &ps, const SampleData &data, const UT_Vector4 *sample_locations, int sidx) |
void | accumulatePixel (BRAY_PixelState &ps, const SampleData &data, const UT_Vector4 *sample_locations, int sidx) |
Add to existing data without any filtering. More... | |
bool | hasWrittenPixel (const BRAY_PixelState &ps, const UT_Vector4 *sample_locations, int sidx) const |
Test to see if data has been written to a given sample. More... | |
const UT_IntArray & | aovs () const |
virtual int | aovLimit () const |
bool | saveState (UT_JSONWriter &w) const |
bool | loadState (UT_JSONParser &p) |
Static Public Member Functions | |
static void | listFactories (UT_StringArray &result, bool include_deprecated=false) |
static void | registerPlugin (const UT_StringHolder &name, FactoryPtr factory) |
static UT_UniquePtr < BRAY_PixelFilter > | instancePlugin (const UT_StringRef &style, const UT_Options *options=nullptr) |
static void | releasePlugin (UT_UniquePtr< BRAY_PixelFilter > p) |
static void | freePluginCache () |
Protected Member Functions | |
virtual void | setResolution (BRAY_FilterInit &init, int xres, int yres, const UT_StringArray &aovnames) |
int | addAOV (BRAY_FilterInit &init, const UT_StringHolder &name, const UT_StringHolder &var, int tuple_size, const BRAY::OptionSet &options) |
BRAY::OptionSet | planeProperties (BRAY_FilterInit &init) const |
Create an option set before adding creating an extra AOV. More... | |
void | setAOVs (const UT_IntArray &aovs) |
SYS_HashType | optionsHash () const |
Pixel filters take raw samples as generated by the renderer and can adjust the sample data values prior to sending it to pixel filtering. A pixel filter might average all the samples for a given pixel, or it might just select a single sample for the pixel value.
Definition at line 34 of file BRAY_PixelFilter.h.
Definition at line 48 of file BRAY_PixelFilter.h.
Sample data passed to the pixel filter is the same as the data processed by sample filters.
Definition at line 75 of file BRAY_PixelFilter.h.
BRAY_PixelFilter::BRAY_PixelFilter | ( | const UT_Options * | options | ) |
|
virtual |
void BRAY_PixelFilter::accumulatePixel | ( | BRAY_PixelState & | ps, |
const SampleData & | data, | ||
const UT_Vector4 * | sample_locations, | ||
int | sidx | ||
) |
Add to existing data without any filtering.
|
protected |
If the filter needs an additional AOV, you can call this method during setResolution(). The function returns the index of the new AOV (or -1 on failure). If there are errors, the messages will be printed out to UT_ErrorLog.
Data from this AOV will be available in the SampleData at the returned index.
If options are required, they can be initialized by planeProperties() Passing in an empty OptionSet is legal.
|
inlinevirtual |
By default(0) one pixel filter instance can be applied to any number of AOVs. Some filters (e.g. minmax under "min" or "max" mode) shouldn't be shared between multiple AOVs, in which case this may return 1.
Definition at line 163 of file BRAY_PixelFilter.h.
|
inline |
Return the AOVs that this pixel filter is applied to. This may not be a subset of all the AOVs. The filter should only write to these planes and no others.
Definition at line 149 of file BRAY_PixelFilter.h.
|
pure virtual |
The checkpoint function is called to save the state of the pixel filter to a checkpoint file.
|
pure virtual |
Class name for the pixel filter.
|
pure virtual |
Process the sample data. Each AOV plane of the data
will point to a contiguous array of sample data which contains at least npixels
of data. The filter should be applied to each pixel in the sample data.
The sample_locations
are stored as:
Note that with Filtered Importance Sampling, the jitter values may be outside the given pixel.
The BRAY_PixelState
object is an opaque object that should be passed to writePixel()
The typical filtering code looks like:
|
static |
Access to factory
bool BRAY_PixelFilter::hasWrittenPixel | ( | const BRAY_PixelState & | ps, |
const UT_Vector4 * | sample_locations, | ||
int | sidx | ||
) | const |
Test to see if data has been written to a given sample.
|
static |
Access to factory
|
static |
Access to factory
|
virtual |
loadCheckpoint
is called to restore the state of the pixel filter. In theory, all the settings for the pixel filter should match. Only per-pixel data should be different.
bool BRAY_PixelFilter::loadState | ( | UT_JSONParser & | p | ) |
Save and restore state
|
inline |
This method is used to create the weight buffer.
Definition at line 157 of file BRAY_PixelFilter.h.
void BRAY_PixelFilter::overwritePixel | ( | BRAY_PixelState & | ps, |
const SampleData & | data, | ||
const UT_Vector4 * | sample_locations, | ||
int | sidx | ||
) |
Overwrite the color in the pixel with the given sample data. This doesn't filter data, but writes the data directly to the AOVs, overwriting the data that was there previously.
|
protected |
Create an option set before adding creating an extra AOV.
|
static |
Access to factory
|
static |
Access to factory
bool BRAY_PixelFilter::sampleHitOrMiss | ( | const BRAY_PixelState & | ps, |
int | sidx | ||
) | const |
Test whether the sample hit or missed intersecting an object.
bool BRAY_PixelFilter::saveState | ( | UT_JSONWriter & | w | ) | const |
Save and restore state
|
inline |
This method is used to create the weight buffer.
Definition at line 156 of file BRAY_PixelFilter.h.
|
protectedvirtual |
This method can be used to perform any setup required prior to filtering. This method may be called when re-rendering. That is, this method may be called on an existing object.
The AOV names passed in will be in the same order as the sample data passed in.
void BRAY_PixelFilter::writePixel | ( | BRAY_PixelState & | ps, |
const SampleData & | data, | ||
const UT_Vector4 * | sample_locations, | ||
int | sidx | ||
) |
Write sample data to a pixel. The weight
is the filter weight for the given sample. The sample data is passed directly from the BRAY_SampleFilters.