本文整理汇总了C#中RayDen.Library.Core.Primitives.RgbSpectrum.IsBlack方法的典型用法代码示例。如果您正苦于以下问题:C# RgbSpectrum.IsBlack方法的具体用法?C# RgbSpectrum.IsBlack怎么用?C# RgbSpectrum.IsBlack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RayDen.Library.Core.Primitives.RgbSpectrum
的用法示例。
在下文中一共展示了RgbSpectrum.IsBlack方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EstimateDirect
public static RgbSpectrum EstimateDirect(ref Vector wo, IAccellerationStructure intersector, SceneGeometryInfo scene, ILight light, IntersectionInfo isect, SurfaceBsdf bsdf, FastRandom rnd)
{
RgbSpectrum Ld = new RgbSpectrum();
Vector wi;
float lightPdf, bsdfPdf;
RayInfo shadowRay;
RgbSpectrum Li = light.Sample(ref isect.GeometryInfo.HitPoint, ref isect.GeometryInfo.GeoNormal, rnd.NextFloat(), rnd.NextFloat(), rnd.NextFloat(),
out shadowRay, out lightPdf);
if (lightPdf > 0f && !Li.IsBlack())
{
wi = -shadowRay.Dir;
RgbSpectrum f ;
bsdf.f(ref wo, ref wi, ref isect.GeometryInfo.GeoNormal, ref Ld, out f);
if (!f.IsBlack() && !intersector.Intersect(shadowRay))
{
// Add light's contribution to reflected radiance
//Li *= visibility.Transmittance(scene, renderer, NULL, rng, arena);
if (light.IsDelta)
Ld += f * Li * (Vector.AbsDot(ref wi, ref isect.GeometryInfo.GeoNormal) / lightPdf);
else
{
bsdfPdf = bsdf.Pdf(ref wo, ref wi, BxDFTypes.BSDF_ALL_TYPES);
float weight = MC.PowerHeuristic(1, lightPdf, 1, bsdfPdf);
Ld += f * Li * (Vector.AbsDot(ref wi, ref isect.GeometryInfo.GeoNormal) * weight / lightPdf);
}
}
}
if (!light.IsDelta)
{
//float bsdfPdf;
bool spb;
BsdfSampleData result;
bsdf.Sample_f(ref wo, ref isect.GeometryInfo.GeoNormal, ref isect.GeometryInfo.ShadingNormal, ref Ld, rnd.NextFloat(),
rnd.NextFloat(), rnd.NextFloat(), ref isect.TextureData, out result);
bsdfPdf = result.Pdf;
if (!result.F.IsBlack() && result.Pdf > 0f)
{
if (lightPdf > 0f)
{
float weight = MC.PowerHeuristic(1, bsdfPdf, 1, lightPdf);
IntersectionInfo lightIsect;
RgbSpectrum li = new RgbSpectrum();
var ray = new RayInfo(isect.GeometryInfo.HitPoint, result.Wi, 1e-4f, 1e+4f);
if (intersector.Intersect(ray, out lightIsect))
{
if (light is TriangleLight && lightIsect.PrimitiveId.Equals(((TriangleLight)light).Owner.Id))
li = light.Le(-result.Wi);
}
else
li = light.Le(ray.Dir);
if (!li.IsBlack())
{
//Li *= scene->Transmittance(ray);
Ld += result.F * li * Vector.AbsDot(ref result.Wi, ref isect.GeometryInfo.GeoNormal) * weight / bsdfPdf;
}
}
}
}
/*
if (!light->IsDeltaLight()) {
BxDFType flags = BxDFType(BSDF_ALL & ~BSDF_SPECULAR);
Spectrum f = bsdf->Sample_f(wo, &wi,
bs1, bs2, bcs, &bsdfPdf, flags);
if (!f.Black() && bsdfPdf > 0.) {
lightPdf = light->Pdf(p, n, wi);
if (lightPdf > 0.) {
// Add light contribution from BSDF sampling
float weight = PowerHeuristic(1, bsdfPdf, 1, lightPdf);
Intersection lightIsect;
Spectrum Li(0.f);
RayDifferential ray(p, wi);
if (scene->Intersect(ray, &lightIsect)) {
if (lightIsect.primitive->GetAreaLight() == light)
Li = lightIsect.Le(-wi);
}
else
Li = light->Le(ray);
if (!Li.Black()) {
Li *= scene->Transmittance(ray);
Ld += f * Li * AbsDot(wi, n) * weight / bsdfPdf;
}
}
}
}
*/
return Ld;
}
示例2: Variance
public float Variance(int imageX, int imageY)
{
var i = imageX + imageY * Width;
var A = new RgbSpectrum(pixelData[i].Radiance);
var B = new RgbSpectrum(adaptiveImage[i].Radiance);
var I = new RgbSpectrum((A.c1 + B.c1) * 0.5f,
(A.c2 + B.c2) * 0.5f,
(A.c3 + B.c3) * 0.5f);
var e = Math.Abs(I.c1 - A.c1) + Math.Abs(I.c2 - A.c2) + Math.Abs(I.c3 - A.c3);
if (I.IsBlack())
return 0;
e /= MathLab.Sqrt(I.c1 + I.c2 + I.c3);
return e;
}
示例3: Black
public bool Black(int imageX, int imageY)
{
var i = imageX + imageY * Width;
var A = new RgbSpectrum(pixelData[i].Radiance);
var B = new RgbSpectrum(adaptiveImage[i].Radiance);
return A.IsBlack() && B.IsBlack();
}
示例4: EvalBrdf
private void EvalBrdf(out RgbSpectrum fs, ref Vector lwi, ref Vector lwo)
{
float sinthetai = SinTheta(ref lwi);
float sinthetao = SinTheta(ref lwo);
// Compute cosine term of Oren--Nayar model
float sinphii = SinPhi(ref lwi), cosphii = CosPhi(ref lwi);
float sinphio = SinPhi(ref lwo), cosphio = CosPhi(ref lwo);
float dcos = cosphii*cosphio + sinphii*sinphio;
#if VERBOSE
Assert.IsNotNaN(cosphii,"cosphii "+lwi.ToString());
Assert.IsNotNaN(cosphio, "cosphio " + lwo.ToString());
Assert.IsNotNaN(sinphii, "sinphii " + lwi.ToString());
Assert.IsNotNaN(sinphio, "sinphio " + lwo.ToString());
#endif
float maxcos = Math.Max(0f, dcos);
// Compute sine and tangent terms of Oren--Nayar model
float sinalpha, tanbeta;
if (Math.Abs(CosTheta(ref lwi)) > Math.Abs(CosTheta(ref lwo)))
{
sinalpha = sinthetao;
tanbeta = sinthetai/Math.Abs(CosTheta(ref lwi));
}
else
{
sinalpha = sinthetai;
tanbeta = sinthetao/Math.Abs(CosTheta(ref lwo));
}
fs = R*MathLab.INVPI*
(A + B*maxcos*sinalpha*tanbeta);
#if VERBOSE
if (fs.IsNegative())
{
Tracer.TraceLine("OrenNayar - f - negative");
}
if (fs.IsBlack())
{
Tracer.TraceLine("OrenNayar - f - black");
}
#endif
}