OpenVDB 13.0.1
Loading...
Searching...
No Matches
DiffuseShader< GridT, SamplerType > Class Template Reference

Simple diffuse Lambertian surface shader. More...

#include <openvdb/tools/RayTracer.h>

Public Types

using RayT = math::Ray<Real>

Public Member Functions

 DiffuseShader (const GridT &grid)
 DiffuseShader (const DiffuseShader &)=default
 ~DiffuseShader () override=default
Film::RGBA operator() (const Vec3R &xyz, const Vec3R &normal, const Vec3R &rayDir) const override
 Sample the color grid at xyz and apply Lambertian shading based on the surface normal and ray direction.
BaseShadercopy () const override

Detailed Description

template<typename GridT = Film::RGBA, typename SamplerType = tools::PointSampler>
class openvdb::v13_0::tools::DiffuseShader< GridT, SamplerType >

Simple diffuse Lambertian surface shader.

The diffuse color can either be constant (if GridT = Film::RGBA which is the default) or defined in a separate Vec3 color grid. Lambertian implies that the (radiant) intensity is directly proportional to the cosine of the angle between the surface normal and the direction of the light source. Use SamplerType to define the order of interpolation (default is zero order, i.e. closes-point).

Member Typedef Documentation

◆ RayT

using RayT = math::Ray<Real>
inherited

Constructor & Destructor Documentation

◆ DiffuseShader() [1/2]

template<typename GridT = Film::RGBA, typename SamplerType = tools::PointSampler>
DiffuseShader ( const GridT & grid)
inline

◆ DiffuseShader() [2/2]

template<typename GridT = Film::RGBA, typename SamplerType = tools::PointSampler>
DiffuseShader ( const DiffuseShader< GridT, SamplerType > & )
default

◆ ~DiffuseShader()

template<typename GridT = Film::RGBA, typename SamplerType = tools::PointSampler>
~DiffuseShader ( )
overridedefault

Member Function Documentation

◆ copy()

template<typename GridT = Film::RGBA, typename SamplerType = tools::PointSampler>
BaseShader * copy ( ) const
inlineoverridevirtual

Implements BaseShader.

◆ operator()()

template<typename GridT = Film::RGBA, typename SamplerType = tools::PointSampler>
Film::RGBA operator() ( const Vec3R & xyz,
const Vec3R & normal,
const Vec3R & rayDir ) const
inlineoverridevirtual

Sample the color grid at xyz and apply Lambertian shading based on the surface normal and ray direction.

Implements BaseShader.