本文整理汇总了C++中Spectrum::HasNaNs方法的典型用法代码示例。如果您正苦于以下问题:C++ Spectrum::HasNaNs方法的具体用法?C++ Spectrum::HasNaNs怎么用?C++ Spectrum::HasNaNs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spectrum
的用法示例。
在下文中一共展示了Spectrum::HasNaNs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddSplat
void Film::AddSplat(const Point2f &p, const Spectrum &v) {
if (v.HasNaNs()) {
Warning("Film ignoring splatted spectrum with NaN values");
return;
}
ProfilePhase pp(Prof::SplatFilm);
if (!InsideExclusive((Point2i)p, croppedPixelBounds)) return;
Float xyz[3];
v.ToXYZ(xyz);
Pixel &pixel = GetPixel((Point2i)p);
for (int i = 0; i < 3; ++i) pixel.splatXYZ[i].Add(xyz[i]);
}
示例2: EstimateDirectIllumination
//.........这里部分代码省略.........
// light source sampling evaluation
Objects * light;
light = thisScene->AquireOneOfEmissiveObjects();
double light_pdf = 0; // to be added
double brdf_pdf = 0;
double light_weight = 0;
double brdf_weight = 0;
Pnt3D pointOnLight;
int i = 0;
while ( i < 2 && occludedByObjects == true )
{
pointOnLight = light->samplePointOnObject();
occludedByObjects = thisScene->Occluded(
intersectionInfo->intersectionPoint,
pointOnLight,
light
);
i++;
}
if ( occludedByObjects == false )
{
newRayDirection = pointOnLight - intersectionInfo->intersectionPoint;
brdf->BRDF(
ray.direction,
newRayDirection,
attenuationFactor
);
attenuationFactor.Scaled_by_Spectrum_Value( obj->material_type->color );
// light pdf
light_pdf = light->PDF_in_solid_angle ( pointOnLight, intersectionInfo->intersectionPoint, newRayDirection );
// brdf_pdf = obj->brdf_model->PDF ( ray.direction , newRayDirection );
// geomery term????
// according to PBRT page 765, geometric term cancel out ???
Vector normal_on_light;
light->getNormalDirection( pointOnLight, normal_on_light );
double geometryTerm = GeometricTerm( ray, normalDirection, pointOnLight, normal_on_light );
lightIntensity = light->emission;
lightSourceSamplingContribution =
Attenuate_Light_Spectrum(
attenuationFactor,
lightIntensity
) * geometryTerm / light_pdf;
}
// evaluate BRDF sampling
if ( light->isDeltaEmitter == false )
{
attenuationFactor = brdf->SampleBRDF(
ray.direction,
newRayDirection,
normalDirection
);
Ray newRay( intersectionInfo->intersectionPoint, newRayDirection );
Intersection newIntersectionInfo;
if ( thisScene->IntersectionWithScene( newRay, newIntersectionInfo ) )
if ( newIntersectionInfo.object->emitter == true )
{
{
brdf_pdf = obj->brdf_model->PDF( ray.direction, newIntersectionInfo.normal, newRayDirection );
// weight = BalanceHeuristic ( 1 , brdf_pdf , 1 , light_pdf );
attenuationFactor.Scaled_by_Spectrum_Value( obj->material_type->color );
double cos_i = AbsDot( ray.direction, normalDirection );
brdfSamplingContribution += Attenuate_Light_Spectrum(
attenuationFactor,
newIntersectionInfo.object->emission
) * cos_i / brdf_pdf;
}
}
}
light_weight = light_pdf / ( brdf_pdf + light_pdf );
brdf_weight = brdf_pdf / ( brdf_pdf + light_pdf );
intensity += lightSourceSamplingContribution * light_weight;
intensity += brdfSamplingContribution * brdf_weight;
if ( intensity.HasNaNs() )
// printf ( "has nan" );
return Spectrum();
return intensity;
}
}