本文整理汇总了C++中BSDF::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ BSDF::Add方法的具体用法?C++ BSDF::Add怎么用?C++ BSDF::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BSDF
的用法示例。
在下文中一共展示了BSDF::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Bump
// PlasticMaterial Method Definitions
BSDF *PlasticMaterial::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading,
MemoryArena &arena) const {
// Allocate _BSDF_, possibly doing bump mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(arena, BSDF)(dgs, dgGeom.nn);
Spectrum kd = Kd->Evaluate(dgs).Clamp();
if (!kd.IsBlack()) {
BxDF *diff = BSDF_ALLOC(arena, Lambertian)(kd);
bsdf->Add(diff);
}
Spectrum ks = Ks->Evaluate(dgs).Clamp();
if (!ks.IsBlack()) {
Fresnel *fresnel = BSDF_ALLOC(arena, FresnelDielectric)(1.5f, 1.f);
float rough = roughness->Evaluate(dgs);
BxDF *spec = BSDF_ALLOC(arena, Microfacet)
(ks, fresnel, BSDF_ALLOC(arena, Blinn)(1.f / rough));
bsdf->Add(spec);
}
return bsdf;
}
示例2: Bump
// TranslucentMaterial Method Definitions
BSDF *TranslucentMaterial::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading, MemoryArena &arena) const {
float ior = 1.5f;
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(arena, BSDF)(dgs, dgGeom.nn, ior);
Spectrum r = reflect->Evaluate(dgs).Clamp();
Spectrum t = transmit->Evaluate(dgs).Clamp();
if (r.IsBlack() && t.IsBlack()) return bsdf;
Spectrum kd = Kd->Evaluate(dgs).Clamp();
if (!kd.IsBlack()) {
if (!r.IsBlack()) bsdf->Add(BSDF_ALLOC(arena, Lambertian)(r * kd));
if (!t.IsBlack()) bsdf->Add(BSDF_ALLOC(arena, BRDFToBTDF)(BSDF_ALLOC(arena, Lambertian)(t * kd)));
}
Spectrum ks = Ks->Evaluate(dgs).Clamp();
if (!ks.IsBlack()) {
float rough = roughness->Evaluate(dgs);
if (!r.IsBlack()) {
Fresnel *fresnel = BSDF_ALLOC(arena, FresnelDielectric)(ior, 1.f);
bsdf->Add(BSDF_ALLOC(arena, Microfacet)(r * ks, fresnel,
BSDF_ALLOC(arena, Blinn)(1.f / rough)));
}
if (!t.IsBlack()) {
Fresnel *fresnel = BSDF_ALLOC(arena, FresnelDielectric)(ior, 1.f);
bsdf->Add(BSDF_ALLOC(arena, BRDFToBTDF)(BSDF_ALLOC(arena, Microfacet)(t * ks, fresnel,
BSDF_ALLOC(arena, Blinn)(1.f / rough))));
}
}
return bsdf;
}
示例3: GetBSDF
BSDF* Phong::GetBSDF(const Vector& normal, const Vector& incident) const
{
BSDF* bsdf = new BSDF();
bsdf->Add(new Ambient(baseColor * ca));
bsdf->Add(new Lambert(cd, baseColor));
bsdf->Add(new Specular(exp, specularColor));
return bsdf;
}
示例4: Spectrum
// Skin Method Definitions
BSDF *Skin::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const {
// Declare skin coefficients
static float diffuse[3] = { 0.428425f, 0.301341f, 0.331054f};
static float xy0[3] = { -1.131747f, -1.016939f, -0.966018f};
static float z0[3] = { -1.209182f, -1.462488f, -1.222419f};
static float e0[3] = { 6.421658f, 3.699932f, 3.524889f};
static float xy1[3] = { -0.546570f, -0.643533f, -0.638934f};
static float z1[3] = { 0.380123f, 0.410559f, 0.437367f};
static float e1[3] = { 3.685044f, 4.266495f, 4.539742f};
static float xy2[3] = { -0.998888f, -1.020153f, -1.027479f};
static float z2[3] = { 0.857998f, 0.703913f, 0.573625f};
static float e2[3] = { 64.208486f, 63.919687f, 43.809866f};
static Spectrum xy[3] = { Spectrum(xy0), Spectrum(xy1), Spectrum(xy2) };
static Spectrum z[3] = { Spectrum(z0), Spectrum(z1), Spectrum(z2) };
static Spectrum e[3] = { Spectrum(e0), Spectrum(e1), Spectrum(e2) };
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
bsdf->Add(BSDF_ALLOC(Lafortune)(Spectrum(diffuse), 3, xy, xy, z, e,
BxDFType(BSDF_REFLECTION | BSDF_DIFFUSE)));
return bsdf;
}
示例5: Spectrum
// BluePaint Method Definitions
BSDF *BluePaint::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const {
// Declare bluepaint coefficients
static float diffuse[3] = { 0.3094f, 0.39667f, 0.70837f };
static float xy0[3] = { 0.870567f, 0.857255f, 0.670982f };
static float z0[3] = { 0.803624f, 0.774290f, 0.586674f };
static float e0[3] = { 21.820103f, 18.597755f, 7.472717f };
static float xy1[3] = { -0.451218f, -0.406681f, -0.477976f };
static float z1[3] = { 0.023123f, 0.017625f, 0.227295f };
static float e1[3] = { 2.774499f, 2.581499f, 3.677653f };
static float xy2[3] = { -1.031545f, -1.029426f, -1.026588f };
static float z2[3] = { 0.706734f, 0.696530f, 0.687715f };
static float e2[3] = { 66.899060f, 63.767912f, 57.489181f };
static Spectrum xy[3] = { Spectrum(xy0), Spectrum(xy1), Spectrum(xy2) };
static Spectrum z[3] = { Spectrum(z0), Spectrum(z1), Spectrum(z2) };
static Spectrum e[3] = { Spectrum(e0), Spectrum(e1), Spectrum(e2) };
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
bsdf->Add(BSDF_ALLOC(Lafortune)(Spectrum(diffuse), 3, xy, xy, z, e,
BxDFType(BSDF_REFLECTION | BSDF_DIFFUSE)));
return bsdf;
}
示例6: Bump
// MirrorMaterial Method Definitions
BSDF *MirrorMaterial::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading, MemoryArena &arena) const {
// Allocate _BSDF_, possibly doing bump mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(arena, BSDF)(dgs, dgGeom.nn);
Spectrum R = Kr->Evaluate(dgs).Clamp();
if (!R.IsBlack()) {
float x,y,z;
x = dgs.p.x;
y = dgs.p.y;
z = dgs.p.z;
float rad = sqrt((x-(-4))*(x-(-4)) + (y-1)*(y-1) + (z-15)*(z-15));
float c = 15.f;
// if (rad < c) {// 11->20, 14
bsdf->Add(BSDF_ALLOC(arena, SpecularReflection)(R,
BSDF_ALLOC(arena, FresnelNoOp)()));
// } else {
// bsdf->Add(BSDF_ALLOC(arena, SpecularReflection)(R,
// BSDF_ALLOC(arena, FresnelNoOp)()));
// }
}
return bsdf;
}
示例7: Spectrum
// Primer Method Definitions
BSDF *Primer::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const {
// Declare primer coefficients
static float diffuse[3] = { 0.118230f, 0.121218f, 0.133209f};
static float xy0[3] = { -0.399286f, -1.033473f, -1.058104f};
static float z0[3] = { 0.167504f, 0.009545f, -0.068002f};
static float e0[3] = { 2.466633f, 7.637253f, 8.117645f};
static float xy1[3] = { -1.041861f, -1.100108f, -1.087779f};
static float z1[3] = { 0.014375f, -0.198147f, -0.053605f};
static float e1[3] = { 7.993722f, 29.446268f, 41.988990f};
static float xy2[3] = { -1.098605f, -0.379883f, -0.449038f};
static float z2[3] = { -0.145110f, 0.159127f, 0.173224f};
static float e2[3] = { 31.899719f, 2.372852f, 2.636161f};
static Spectrum xy[3] = { Spectrum(xy0), Spectrum(xy1), Spectrum(xy2) };
static Spectrum z[3] = { Spectrum(z0), Spectrum(z1), Spectrum(z2) };
static Spectrum e[3] = { Spectrum(e0), Spectrum(e1), Spectrum(e2) };
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
bsdf->Add(BSDF_ALLOC(Lafortune)(Spectrum(diffuse), 3, xy, xy, z, e,
BxDFType(BSDF_REFLECTION | BSDF_DIFFUSE)));
return bsdf;
}
示例8: Spectrum
// Felt Method Definitions
BSDF *Felt::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const {
// Declare felt coefficients
static float diffuse[3] = { 0.025865f, 0.025865f, 0.025865f};
static float xy0[3] = { -0.304075f, -0.304075f, -0.304075f};
static float z0[3] = { -0.065992f, -0.065992f, -0.065992f};
static float e0[3] = { 3.047892f, 3.047892f, 3.047892f};
static float xy1[3] = { -0.749561f, -0.749561f, -0.749561f};
static float z1[3] = { -1.167929f, -1.167929f, -1.167929f};
static float e1[3] = { 6.931827f, 6.931827f, 6.931827f};
static float xy2[3] = { 1.004921f, 1.004921f, 1.004921f};
static float z2[3] = { -0.205529f, -0.205529f, -0.205529f};
static float e2[3] = { 94.117332f, 94.117332f, 94.117332f};
static Spectrum xy[3] = { Spectrum(xy0), Spectrum(xy1), Spectrum(xy2) };
static Spectrum z[3] = { Spectrum(z0), Spectrum(z1), Spectrum(z2) };
static Spectrum e[3] = { Spectrum(e0), Spectrum(e1), Spectrum(e2) };
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
bsdf->Add(BSDF_ALLOC(Lafortune)(Spectrum(diffuse), 3, xy, xy, z, e,
BxDFType(BSDF_REFLECTION | BSDF_DIFFUSE)));
return bsdf;
}
示例9: Spectrum
// BrushedMetal Method Definitions
BSDF *BrushedMetal::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const {
// Declare brushedmetal coefficients
static float diffuse[3] = { 0, 0, 0 };
static float xy0[3] = { -1.11854f, -1.11845f, -1.11999f };
static float z0[3] = { 1.01272f, 1.01469f, 1.01942f };
static float e0[3] = { 15.8708f, 15.6489f, 15.4571f };
static float xy1[3] = { -1.05334f, -1.06409f, -1.08378f };
static float z1[3] = { 0.69541f, 0.662178f, 0.626672f };
static float e1[3] = { 111.267f, 88.9222f, 65.2179f };
static float xy2[3] = { -1.01684f, -1.01635f, -1.01529f };
static float z2[3] = { 1.00132f, 1.00112f, 1.00108f };
static float e2[3] = { 180.181f, 184.152f, 195.773f };
static Spectrum xy[3] = { Spectrum(xy0), Spectrum(xy1), Spectrum(xy2) };
static Spectrum z[3] = { Spectrum(z0), Spectrum(z1), Spectrum(z2) };
static Spectrum e[3] = { Spectrum(e0), Spectrum(e1), Spectrum(e2) };
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
bsdf->Add(BSDF_ALLOC(Lafortune)(Spectrum(*diffuse), 3, xy, xy, z, e,
BxDFType(BSDF_REFLECTION | BSDF_GLOSSY)));
return bsdf;
}
示例10:
BSDF *custom_material_phong::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
//not sure about this yet
DifferentialGeometry dgs=dgShading;
//or this:
//allocate memory for BSDF, poiting bsdf to a new BSDF
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
//allocate to diff a custom BxDF with reflection spectrum kd
Spectrum kd = Kd->Evaluate(dgs).Clamp();
BxDF *diff = BSDF_ALLOC(custom_BxDF_phongDiffuse)(kd);
//my specular reflectance
Spectrum ks = Ks->Evaluate(dgs).Clamp();
BxDF *spec = BSDF_ALLOC(custom_BxDF_phongSpecular)(ks,float(n));
//add both diff and spec BSDFS to the BSDF of this material
//***sets the BSDF of this material
bsdf->Add(diff);
bsdf->Add(spec);
return bsdf;
}
示例11: GetBSDF
BSDF* GlassMaterial::GetBSDF( const Vector2f& uv , const Point3f& point , const Vector3f& normal ) const
{
BSDF* bsdf = new BSDF();
Spectrum R = Kr->Evalute( uv , point );
Spectrum T = Kt->Evalute( uv , point );
Spectrum ior = RefraIndex->Evalute( uv , point );
bsdf->Add( new SpecularReflection( R , new FresnelDielectric( 1.0 , ior[0] ) ) );
bsdf->Add( new SpecularTransmission( 1.0 , ior[0] , T ) );
return bsdf;
}
示例12:
// custom_material Method Definitions
BSDF *custom_material::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
//issue debugging warning
//Warning("custom_material\n");
//declare geometry that will be used in BRDF
DifferentialGeometry dgs;
//if there is to be a bump map, call Bump, which modifies dgs
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
//allocate memory for BSDF, poiting bsdf to a new BSDF
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
//set a spectrum kd to the spectrum stored in texure Kd
//***gets color spectrum of diffuse reflection***
Spectrum kd = Kd->Evaluate(dgs).Clamp();
//allocate to diff a custom BxDF with reflection spectrum kd
//***diffuse reflection characteristics***
BxDF *diff = BSDF_ALLOC(custom_BxDF3)(kd);
/* commented dpl 10 august 2005
// specular reflectance from pbrt's plastic model
//allocate to (temp) fresnes a fresneldielectric bsdf with
//parameters (1.5, 1)
//***will set part of specular reflection properties***
Fresnel *fresnel =
BSDF_ALLOC(FresnelDielectric)(1.5f, 1.f);
//set a spectrum ks to the spectrum stored in the texture Ks
//***gets color spectrum of specular reflection***
Spectrum ks = Ks->Evaluate(dgs).Clamp();
//get the roughness from roughness (?)
float rough = roughness->Evaluate(dgs);
//allocate memory for specular reflection BSDF
//***sets specular BSDF according to microfacet model
//with color params ks, fresnel and blinn models (?) ***
BxDF *spec = BSDF_ALLOC(Microfacet)(ks, fresnel,
BSDF_ALLOC(Blinn)(1.f / rough));
*/
//my specular reflectance
Spectrum ks = Ks->Evaluate(dgs).Clamp();
BxDF *spec = BSDF_ALLOC(custom_BxDF2)(ks);
//add both diff and spec BSDFS to the BSDF of this material
//***sets the BSDF of this material
bsdf->Add(diff);
bsdf->Add(spec);
return bsdf;
}
示例13: Clamp
// Matte Method Definitions
BSDF *danMatte::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
// Evaluate textures for _Matte_ material and allocate BRDF
Spectrum r = Kd->Evaluate(dgs).Clamp();
float sig = Clamp(sigma->Evaluate(dgs), 0.f, 90.f);
if (sig == 0.)
bsdf->Add(BSDF_ALLOC(Lambertian)(r));
else
bsdf->Add(BSDF_ALLOC(OrenNayar)(r, sig));
return bsdf;
return bsdf;
}
示例14: Bump
// UberMaterial Method Definitions
BSDF *UberMaterial::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading, MemoryArena &arena) const {
// Allocate _BSDF_, possibly doing bump mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(arena, BSDF)(dgs, dgGeom.nn);
Spectrum op = opacity->Evaluate(dgs).Clamp();
if (op != Spectrum(1.)) {
BxDF *tr = BSDF_ALLOC(arena, SpecularTransmission)(-op + Spectrum(1.), 1., 1.);
bsdf->Add(tr);
}
Spectrum kd = op * Kd->Evaluate(dgs).Clamp();
if (!kd.IsBlack()) {
BxDF *diff = BSDF_ALLOC(arena, Lambertian)(kd);
bsdf->Add(diff);
}
float e = eta->Evaluate(dgs);
Spectrum ks = op * Ks->Evaluate(dgs).Clamp();
if (!ks.IsBlack()) {
Fresnel *fresnel = BSDF_ALLOC(arena, FresnelDielectric)(e, 1.f);
float rough = roughness->Evaluate(dgs);
BxDF *spec = BSDF_ALLOC(arena, Microfacet)(ks, fresnel, BSDF_ALLOC(arena, Blinn)(1.f / rough));
bsdf->Add(spec);
}
Spectrum kr = op * Kr->Evaluate(dgs).Clamp();
if (!kr.IsBlack()) {
Fresnel *fresnel = BSDF_ALLOC(arena, FresnelDielectric)(e, 1.f);
bsdf->Add(BSDF_ALLOC(arena, SpecularReflection)(kr, fresnel));
}
Spectrum kt = op * Kt->Evaluate(dgs).Clamp();
if (!kt.IsBlack())
bsdf->Add(BSDF_ALLOC(arena, SpecularTransmission)(kt, e, 1.f));
return bsdf;
}
示例15: Bump
BSDF *SkinSubsurfaceMaterial::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading,
MemoryArena &arena) const {
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(arena, BSDF)(dgs, dgGeom.nn);
Spectrum kd = Kd->Evaluate(dgs).Clamp();
if (!kd.IsBlack()){
BxDF *diff = BSDF_ALLOC(arena, Lambertian)(kd);
bsdf->Add(diff);
}
float e = eta->Evaluate(dgs);
Fresnel *fresnel = BSDF_ALLOC(arena,FresnelDielectric)(1.,e);
float rough = 0.35f;
BxDF *spec = BSDF_ALLOC(arena,Microfacet)(rho_s, fresnel, BSDF_ALLOC(arena, Beckmann)(rough));
bsdf->Add(spec);
return bsdf;
}