material_t Class Reference

#include <material.h>

Inheritance diagram for material_t:
Inheritance graph
[legend]
Collaboration diagram for material_t:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 material_t ()
virtual ~material_t ()
virtual void initBSDF (const renderState_t &state, const surfacePoint_t &sp, BSDF_t &bsdfTypes) const =0
virtual color_t eval (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo, const vector3d_t &wl, BSDF_t types) const =0
virtual color_t sample (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo, vector3d_t &wi, sample_t &s) const =0
virtual float pdf (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo, const vector3d_t &wi, BSDF_t bsdfs) const
virtual bool isTransparent () const
virtual color_t getTransparency (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const
virtual void getSpecular (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo, bool &reflect, bool &refract, vector3d_t *const dir, color_t *const col) const
virtual color_t getReflectivity (const renderState_t &state, const surfacePoint_t &sp, BSDF_t flags) const
virtual color_t emit (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const
virtual bool volumeTransmittance (const renderState_t &state, const surfacePoint_t &sp, const ray_t &ray, color_t &col) const
const volumeHandler_tgetVolumeHandler (bool inside) const
virtual CFLOAT getAlpha (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wo) const
virtual bool scatterPhoton (const renderState_t &state, const surfacePoint_t &sp, const vector3d_t &wi, vector3d_t &wo, pSample_t &s) const
BSDF_t getFlags () const
size_t getReqMem () const
virtual float getMatIOR () const

Protected Member Functions

void applyBump (const surfacePoint_t &sp, PFLOAT dfdNU, PFLOAT dfdNV) const

Protected Attributes

BSDF_t bsdfFlags
size_t reqMem
 the amount of "temporary" memory required to compute/store surface point specific data
volumeHandler_tvolI
 volumetric handler for space inside material (opposed to surface normal)
volumeHandler_tvolO
 volumetric handler for space outside ofmaterial (where surface normal points to)

Detailed Description

Definition at line 61 of file material.h.


Constructor & Destructor Documentation

material_t::material_t (  )  [inline]

Definition at line 64 of file material.h.

virtual material_t::~material_t (  )  [inline, virtual]

Definition at line 65 of file material.h.


Member Function Documentation

void material_t::applyBump ( const surfacePoint_t sp,
PFLOAT  dfdNU,
PFLOAT  dfdNV 
) const [protected]

Definition at line 72 of file material.cc.

virtual color_t material_t::emit ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wo 
) const [inline, virtual]

allow light emitting materials, for realizing correctly visible area lights. default implementation returns black obviously.

Reimplemented in blendMat_t, maskMat_t, shinyDiffuseMat_t, simplemat_t, and lightMat_t.

Definition at line 111 of file material.h.

virtual color_t material_t::eval ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wo,
const vector3d_t wl,
BSDF_t  types 
) const [pure virtual]

evaluate the BSDF for the given components.

Parameters:
types the types of BSDFs to be evaluated (e.g. diffuse only, or diffuse and glossy)

Implemented in blendMat_t, maskMat_t, roughGlassMat_t, shinyDiffuseMat_t, simplemat_t, coatedGlossyMat_t, glassMat_t, mirrorMat_t, nullMat_t, glossyMat_t, and lightMat_t.

virtual CFLOAT material_t::getAlpha ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wo 
) const [inline, virtual]

special function, get the alpha-value of a material, used to calculate the alpha-channel

Reimplemented in blendMat_t, maskMat_t, shinyDiffuseMat_t, and glassMat_t.

Definition at line 127 of file material.h.

BSDF_t material_t::getFlags (  )  const [inline]

Definition at line 133 of file material.h.

virtual float material_t::getMatIOR (  )  const [inline, virtual]

Get materials IOR (for refracted photons)

Reimplemented in glassMat_t.

Definition at line 140 of file material.h.

color_t material_t::getReflectivity ( const renderState_t state,
const surfacePoint_t sp,
BSDF_t  flags 
) const [virtual]

get the overall reflectivity of the material (used to compute radiance map for example)

Definition at line 48 of file material.cc.

size_t material_t::getReqMem (  )  const [inline]

Materials may have to do surface point specific (pre-)calculation that need extra storage. returns the required amount of "userdata" memory for all the functions that require a render state

Definition at line 136 of file material.h.

virtual void material_t::getSpecular ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wo,
bool &  reflect,
bool &  refract,
vector3d_t *const   dir,
color_t *const   col 
) const [inline, virtual]

evaluate the specular components for given direction. Somewhat a specialization of sample(), because neither sample values nor pdf values are necessary for this. Typical use: recursive raytracing of integrators.

Parameters:
dir dir[0] returns reflected direction, dir[1] refracted direction
col col[0] returns reflected spectrum, dir[1] refracted spectrum

Reimplemented in blendMat_t, maskMat_t, shinyDiffuseMat_t, simplemat_t, coatedGlossyMat_t, glassMat_t, and mirrorMat_t.

Definition at line 102 of file material.h.

virtual color_t material_t::getTransparency ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wo 
) const [inline, virtual]

used for computing transparent shadows. Default implementation returns black (i.e. solid shadow). This is only used for shadow calculations and may only be called when isTransparent returned true.

Reimplemented in blendMat_t, maskMat_t, shinyDiffuseMat_t, and glassMat_t.

Definition at line 96 of file material.h.

const volumeHandler_t* material_t::getVolumeHandler ( bool  inside  )  const [inline]

get the volumetric handler for space at specified side of the surface

Parameters:
inside true means space opposite of surface normal, which is considered "inside"

Definition at line 124 of file material.h.

virtual void material_t::initBSDF ( const renderState_t state,
const surfacePoint_t sp,
BSDF_t bsdfTypes 
) const [pure virtual]

Initialize the BSDF of a material. You must call this with the current surface point first before any other methods (except isTransparent/getTransparency)! The renderstate holds a pointer to preallocated userdata to save data that only depends on the current sp, like texture lookups etc.

Parameters:
bsdfTypes returns flags for all bsdf components the material has

Implemented in blendMat_t, maskMat_t, roughGlassMat_t, shinyDiffuseMat_t, simplemat_t, coatedGlossyMat_t, glassMat_t, mirrorMat_t, nullMat_t, glossyMat_t, and lightMat_t.

virtual bool material_t::isTransparent (  )  const [inline, virtual]

indicate whether light can (partially) pass the material without getting refracted, e.g. a curtain or even very thin foils approximated as single non-refractive layer. used to trace transparent shadows. Note that in this case, initBSDF was NOT called before!

Reimplemented in blendMat_t, maskMat_t, shinyDiffuseMat_t, simplemat_t, and glassMat_t.

Definition at line 92 of file material.h.

virtual float material_t::pdf ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wo,
const vector3d_t wi,
BSDF_t  bsdfs 
) const [inline, virtual]

return the pdf for sampling the BSDF with wi and wo

Reimplemented in blendMat_t, maskMat_t, roughGlassMat_t, shinyDiffuseMat_t, coatedGlossyMat_t, glassMat_t, and glossyMat_t.

Definition at line 86 of file material.h.

virtual color_t material_t::sample ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wo,
vector3d_t wi,
sample_t s 
) const [pure virtual]

take a sample from the BSDF, given a 2-dimensional sample value and the BSDF types to be sampled from

Parameters:
s s1, s2 and flags members give necessary information for creating the sample, pdf and sampledFlags need to be returned

Implemented in blendMat_t, maskMat_t, roughGlassMat_t, shinyDiffuseMat_t, simplemat_t, coatedGlossyMat_t, glassMat_t, mirrorMat_t, nullMat_t, glossyMat_t, and lightMat_t.

__BEGIN_YAFRAY bool material_t::scatterPhoton ( const renderState_t state,
const surfacePoint_t sp,
const vector3d_t wi,
vector3d_t wo,
pSample_t s 
) const [virtual]

specialized function for photon mapping. Default function uses the sample function, which will do fine for most materials unless there's a less expensive way or smarter scattering approach

Reimplemented in blendMat_t, shinyDiffuseMat_t, coatedGlossyMat_t, and glossyMat_t.

Definition at line 30 of file material.cc.

virtual bool material_t::volumeTransmittance ( const renderState_t state,
const surfacePoint_t sp,
const ray_t ray,
color_t col 
) const [inline, virtual]

allow attenuation (or even amplification) due to intra-object volumetric effects, e.g. "beer's law"; should only be called by surface integrators when entering an object.

Parameters:
sp the point the current ray hit
ray the ray that hit sp, tmax shall be sett accordingly, the direction is pointing from origin to sp
col the filter spectrum that gets applied to the exitant radiance computed for sp
Returns:
return true when light gets modified, false otherwise. The global volume integrator may be used in the latter case

Reimplemented in blendMat_t, and glassMat_t.

Definition at line 120 of file material.h.


Member Data Documentation

Definition at line 147 of file material.h.

size_t material_t::reqMem [protected]

the amount of "temporary" memory required to compute/store surface point specific data

Definition at line 148 of file material.h.

volumetric handler for space inside material (opposed to surface normal)

Definition at line 149 of file material.h.

volumetric handler for space outside ofmaterial (where surface normal points to)

Definition at line 150 of file material.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 18 Dec 2009 for YafaRay by  doxygen 1.6.1