MIP map class with support for elliptically weighted averages. More...
#include <mitsuba/render/mipmap.h>
Classes | |
struct | MIPMapHeader |
Header file for MIP map cache files. More... | |
Public Types | |
typedef BlockedArray < QuantizedValue > | Array2DType |
Use a blocked array to store MIP map data. More... | |
typedef ReconstructionFilter::EBoundaryCondition | EBoundaryCondition |
Shortcut. More... | |
Public Member Functions | |
TMIPMap (Bitmap *bitmap_, Bitmap::EPixelFormat pixelFormat, Bitmap::EComponentFormat componentFormat, const ReconstructionFilter *rfilter, EBoundaryCondition bcu=ReconstructionFilter::ERepeat, EBoundaryCondition bcv=ReconstructionFilter::ERepeat, EMIPFilterType filterType=EEWA, Float maxAnisotropy=20.0f, fs::path cacheFilename=fs::path(), uint64_t timestamp=0, Float maxValue=1.0f, Spectrum::EConversionIntent intent=Spectrum::EReflectance) | |
Construct a new MIP map from the given bitmap. More... | |
TMIPMap (fs::path cacheFilename, Float maxAnisotropy=20.0f) | |
Construct a new MIP map from a previously created cache file. More... | |
~TMIPMap () | |
Release all memory. More... | |
size_t | getBufferSize () const |
Return the size of all buffers. More... | |
const Vector2i & | getSize () const |
Return the size of the underlying full resolution texture. More... | |
int | getWidth () const |
Return the width of the represented texture. More... | |
int | getHeight () const |
Return the height of the represented texture. More... | |
int | getLevels () const |
Return the number of mip-map levels. More... | |
EMIPFilterType | getFilterType () const |
Return the filter type that is used to pre-filter lookups. More... | |
const Value & | getMinimum () const |
Get the component-wise maximum at the zero level. More... | |
const Value & | getMaximum () const |
Get the component-wise minimum. More... | |
const Value & | getAverage () const |
Get the component-wise average. More... | |
const Array2DType & | getArray (int level=0) const |
Return the blocked array used to store a given MIP level. More... | |
ref< Bitmap > | toBitmap (int level=0) const |
Return a bitmap representation of the given level. More... | |
Value | evalTexel (int level, int x, int y) const |
Return the texture value at a texel specified using integer coordinates, while accounting for boundary conditions. More... | |
Value | evalBox (int level, const Point2 &uv) const |
Evaluate the texture at the given resolution using a box filter. More... | |
Value | evalBilinear (int level, const Point2 &uv) const |
Evaluate the texture using fractional texture coordinates and bilinear interpolation. The desired MIP level must be specified. More... | |
void | evalGradientBilinear (int level, const Point2 &uv, Value *gradient) const |
Evaluate the gradient of the texture at the given MIP level. More... | |
Value | eval (const Point2 &uv, const Vector2 &d0, const Vector2 &d1) const |
Perform a filtered texture lookup using the configured method. More... | |
std::string | toString () const |
Return a human-readable string representation. More... | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
Static Public Member Functions | |
static bool | validateCacheFile (const fs::path &path, uint64_t timestamp, Bitmap::EPixelFormat pixelFormat, EBoundaryCondition bcu, EBoundaryCondition bcv, EMIPFilterType filterType, Float gamma) |
Check if a MIP map cache is up-to-date and matches the desired configuration. More... | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Static Public Attributes | |
static Class * | m_theClass = new Class("MIPMap", false, "Object") |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
Value | evalEWA (int level, const Point2 &uv, Float A, Float B, Float C) const |
Calculate the elliptically weighted average of a sample and associated Jacobian. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
MIP map class with support for elliptically weighted averages.
This class stores a precomputed collection of images that provide a hierarchy of resolution levels of an input image. These are used to prefilter texture lookups at render time, reducing aliasing artifacts. The implementation here supports non-power-of two images, different data types and quantizations thereof, as well as the computation of elliptically weighted averages that account for the anisotropy of texture lookups in UV space.
Generating good mip maps is costly, and therefore this class provides the means to cache them on disk if desired.
Value | This class can be parameterized to yield MIP map classes for RGB values, color spectra, or just plain floats. This parameter specifies the underlying type. |
QuantizedValue | If desired, the MIP map can store its contents using a quantized representation (e.g. half precision). In that case, this type denotes the associated data type. |
typedef BlockedArray<QuantizedValue> mitsuba::TMIPMap< Value, QuantizedValue >::Array2DType |
Use a blocked array to store MIP map data.
typedef ReconstructionFilter::EBoundaryCondition mitsuba::TMIPMap< Value, QuantizedValue >::EBoundaryCondition |
Shortcut.
|
inline |
Construct a new MIP map from the given bitmap.
bitmap | An arbitrary input bitmap that will (if necessary) be transformed into a representation that is compatible with the desired MIP map pixel format. |
pixelFormat A pixel format that is compatible with the Value
and QuantizedValue
types
componentFormat A component format that is compatible with the Value
type.
rfilter | An image reconstruction filter that is used to create progressively lower-resolution versions of the input image. |
bcu | Specifies how to handle texture lookups outside of the horizontal range [0, 1] |
bcv | Specifies how to handle texture lookups outside of the vertical range [0, 1] |
filterType | Denotes the desired filter type to use for lookups; the default is to use elliptically weighted averages. |
maxAnisotropy | Denotes the highest tolerated anisotropy of the lookup kernel. This is necessary to bound the computational cost of filtered lookups. |
cacheFilename | Optional filename of a memory-mapped cache file that is used to keep MIP map data out of core, and to avoid having to load and downsample textures over and over again in subsequent Mitsuba runs. |
maxValue | Maximum image value. This is used to clamp out-of-range values that occur during the image resampling process |
intent | When an RGB image is transformed into a spectral representation, this parameter specifies what conversion method should be used. See Spectrum::EConversionIntent for further details. |
|
inline |
Construct a new MIP map from a previously created cache file.
cacheFilename | Filename of a memory-mapped cache file that is used to keep MIP map data out of core, and to avoid having to load and downsample textures over and over again in subsequent Mitsuba runs. |
maxAnisotropy | Denotes the highest tolerated anisotropy of the lookup kernel. This is necessary to bound the computational cost of filtered lookups. This parameter is independent of the cache file that was previously created. |
|
inline |
Release all memory.
|
inline |
Perform a filtered texture lookup using the configured method.
|
inline |
Evaluate the texture using fractional texture coordinates and bilinear interpolation. The desired MIP level must be specified.
|
inline |
Evaluate the texture at the given resolution using a box filter.
|
inlineprotected |
Calculate the elliptically weighted average of a sample and associated Jacobian.
|
inline |
Evaluate the gradient of the texture at the given MIP level.
|
inline |
Return the texture value at a texel specified using integer coordinates, while accounting for boundary conditions.
|
inline |
Return the blocked array used to store a given MIP level.
|
inline |
Get the component-wise average.
|
inline |
Return the size of all buffers.
|
virtual |
Retrieve this object's class.
Reimplemented from Object.
|
inline |
Return the filter type that is used to pre-filter lookups.
|
inline |
Return the height of the represented texture.
|
inline |
Return the number of mip-map levels.
|
inline |
Get the component-wise minimum.
|
inline |
Get the component-wise maximum at the zero level.
|
inline |
Return the size of the underlying full resolution texture.
|
inline |
Return the width of the represented texture.
|
inline |
Return a bitmap representation of the given level.
|
inlinevirtual |
Return a human-readable string representation.
Reimplemented from Object.
|
inlinestatic |
Check if a MIP map cache is up-to-date and matches the desired configuration.
path | File system path of the MIP map cache |
timestamp | Timestamp of the original texture file |
bcu | Horizontal boundary condition used when creating the MIP map pyramid |
bcv | Vertical boundary condition used when creating the MIP map pyramid |
gamma | If nonzero, it is verified that the provided gamma value matches that of the cache file. |
true
if the texture file is good for use
|
static |