当前位置: 首页>>代码示例>>C#>>正文


C# RgbSpectrum.y方法代码示例

本文整理汇总了C#中RayDen.Library.Core.Primitives.RgbSpectrum.y方法的典型用法代码示例。如果您正苦于以下问题:C# RgbSpectrum.y方法的具体用法?C# RgbSpectrum.y怎么用?C# RgbSpectrum.y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RayDen.Library.Core.Primitives.RgbSpectrum的用法示例。


在下文中一共展示了RgbSpectrum.y方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompareTo

 public int CompareTo(RgbSpectrum other)
 {
     return this.y().CompareTo(other.y());
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:4,代码来源:PSSpectrum.cs

示例2: Sample_f

        public override void Sample_f(ref Vector wo, ref Normal Normal, ref Normal shadeNormal, ref RgbSpectrum in_f, float u0, float u1, float u2, ref SurfaceTextureData surfaceData, out BsdfSampleData result)
        {
            result.Lambda = 0f;

            EvalParams(ref surfaceData);
            Assert.IsTrue(!Krefl.IsBlack());
            Assert.IsTrue(!Krefrct.IsBlack());

            Vector rayDir = -wo;
            var N = shadeNormal;
            var shadeN = shadeNormal;
            var wi = new Vector();

            var N1 = N.ToVec();
            var reflDir = rayDir - (2f * (Normal.Dot(ref N, ref rayDir))) * N1;

            // Ray from outside going in ?
            bool into = ((Normal.Dot(ref N, ref shadeN)) > 0);

            float nc = ousideIor;
            bool disperse = in_f.y() > u0;


            float nt = ior + (disperse ? (1f - in_f.y())/10f : 0f);
            if (disperse)
            {
                Krefrct = in_f.MaxAsSingle()*in_f;
                //SampledSpectrum.ReflRainbow[(int) Math.Round((SampledSpectrum.ReflRainbow.Length-1)*u2)];
            }

            float nnt = into ? (nc / nt) : (nt / nc);
            float ddn = (rayDir & shadeN.ToVec());
            float cos2t = 1f - nnt * nnt * (1f - ddn * ddn);
            result.F = RgbSpectrum.UnitSpectrum();
            // Total internal reflection
            if (cos2t < 0f)
            {
                wi = reflDir;
                result.Pdf = 1f;
                result.Type = reflectionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
                result.F = Krefl;
                result.Wi = wi;
                return;
            }

            float kk = (into ? 1f : -1f) * (ddn * nnt + MathLab.Sqrt((cos2t)));
            Vector nkk = kk * N1;
            Vector transDir = (nnt * rayDir - nkk).Normalize();

            float c = 1f - (into ? -ddn : (transDir & N1));

            float Re = R0 + (1f - R0) * c * c * c * c * c;
            float Tr = 1f - Re;
            float P = .25f + .5f * Re;

            if (Tr.NearEqual(0f))
            {
                if (Re.NearEqual(0f))
                {
                    result.Pdf = 0f;
                    result.Type = BrdfType.Specular;
                    result.F = new RgbSpectrum(0f);
                }
                else
                {
                    (wi) = reflDir;
                    result.Pdf = 1f;
                    result.Type = reflectionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
                    result.F = Krefl;
                }
            }
            else if (Re.NearEqual(0f))
            {
                (wi) = transDir;

                result.Pdf = 1f;
                result.Type = transmitionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
                result.F = Krefrct;

            }
            else if (u0 < P)
            {
                (wi) = reflDir;
                result.Pdf = P / Re;
                result.Type = reflectionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
                result.F = Krefl;
            }
            else
            {
                if (u0 > u1)
                {
                    //(wi) = SampleTransmissionDirection(u0, u1, ref transDir);
                    wi = transDir;
                    result.F = Krefrct;
                    //SampleTransmission(u1, u2, ref Krefrct);
                }
                else
                {
                    wi = transDir;
                    result.F = Krefrct;
//.........这里部分代码省略.........
开发者ID:HungryBear,项目名称:rayden,代码行数:101,代码来源:DispersiveGlassMaterial.cs

示例3: Add_B

        public void Add_B(ref RgbSpectrum rr)
        {
            if (ImportanceReady) 
                return;
            lock (b_lock)
            {
                if (rr.y() <= 0f)
                    return;
                bSamples++;
                
                var r = rr / rr.y();

                B[0] += r.c1;
                B[1] += r.c2;
                B[2] += r.c3;
                Brightness += rr.y();
            }
        }
开发者ID:HungryBear,项目名称:rayden,代码行数:18,代码来源:MCMCSampler.cs

示例4: Importance

 public static float Importance(ref RgbSpectrum contribution)
 {
     return contribution.y();
     //return contribution.Max();
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:5,代码来源:PssMltEngineController.cs


注:本文中的RayDen.Library.Core.Primitives.RgbSpectrum.y方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。