public override BSDF GetBSDF(ref Intersection intersection)
        {
            var bsdf = new BSDF(ref intersection);

            bsdf.AddBxDF(_transmission);
            return(bsdf);
        }
        public override BSDF GetBSDF(ref Intersection intersection)
        {
            var bsdf = new BSDF(ref intersection);

            bsdf.AddBxDF(_lambertianReflection);
            return(bsdf);
        }
Beispiel #3
0
        public override BSDF GetBSDF(ref Intersection intersection)
        {
            var bsdf = new BSDF(ref intersection);

            bsdf.AddBxDF(_specular);
            return(bsdf);
        }
Beispiel #4
0
        private SampledSpectrum SampleLights(Scene scene, BSDF bsdf, ref Intersection intersection,
                                             ref Vector3 leaving)
        {
            var lights   = scene.Lights;
            var spectrum = SampledSpectrum.Black();

            foreach (var light in lights)
            {
                var nsamples          = _strategy == LightSamplingStrategy.Multiple ? light.NSamples : 1;
                var lightContribution = SampledSpectrum.Black();
                for (var i = 0; i < nsamples; ++i)
                {
                    Vector3          incoming;
                    VisibilityTester visibilityTester;
                    var lightSpectrum = light.Sample(ref intersection.Point, scene, out incoming, out visibilityTester);
                    if (lightSpectrum.IsBlack() || visibilityTester.Occluded())
                    {
                        continue;
                    }
                    var cosangle = Math.Abs(Vector3.Dot(incoming, intersection.NormalVector));
                    // we get the light coming to us from transmission + reflection
                    var distribution = bsdf.F(incoming, leaving, BxDF.BxDFType.All);
                    // we scale the light by the incident angle of light on the surface and by the distribution
                    // function from light to us and we add it to the spectrum
                    lightContribution += distribution * lightSpectrum * cosangle;
                }
                spectrum += lightContribution / nsamples;
            }
            return(spectrum);
        }
        public override BSDF GetBSDF(ref Intersection intersection)
        {
            var bsdf = new BSDF(ref intersection);

            //bsdf.AddBxDF(new LambertianReflection(_spectrum));
            bsdf.AddBxDF(new SpecularReflection(new FresnelDielectric(1.23f, 1.0f)));
            return(bsdf);
        }
Beispiel #6
0
        public override BSDF GetBSDF(ref Intersection intersection)
        {
            var bsdf = new BSDF(ref intersection);

            bsdf.AddBxDF(new LambertianReflection(_kd));
            //bsdf.AddBxDF(new SpecularReflection());
            //bsdf.AddBxDF(new SpecularTransmission(1f, 1.14f, _kd));
            return(bsdf);
        }