public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); MaxRaysPerPath = 1; this.scene = pathIntegrator.Scene; var pssSampler = (PsMltSampler)this.pathIntegrator.Sampler; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); if (this.Sample == null || this.Sample.LargeStep || pssSampler.BurnInPhase ||this.Sample.MutationsCount > (pssSampler.MaxMutations)) { this.Sample = (PsSample)pssSampler.GetSample(this.Sample); } else { this.Sample.imageX = MC.Mutate(this.Sample.imageX, pssSampler.NextFloat(), pssSampler.NextFloat(),2.0f/(2000),0.1f); this.Sample.imageY = MC.Mutate(this.Sample.imageY, pssSampler.NextFloat(), pssSampler.NextFloat(), 2.0f / (2000), 0.1f); pssSampler.TotalSamples++; } IRay ray; pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out ray); this.PathRay = (RayData)ray; this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.depth = 0; this.specularBounce = true; }
public Sample GetSample(Sample prevSample = null) { totalSamples++; if (prevSample == null) { var ns = new PsSample(this); ns.imageX = ns.GetLazyValue() * screenWidth; ns.imageY = ns.GetLazyValue() * screenHeight; ns.pass = pass; return ns; } prevSample.imageX = prevSample.GetLazyValue() * screenWidth; prevSample.imageY = prevSample.GetLazyValue() * screenHeight; prevSample.pass = pass; (prevSample as PsSample).MutationsCount = 0; (prevSample as PsSample).CurrentDim = 0; (prevSample as PsSample).MaxDimPrev = 0; return prevSample; }
public void Reject(PsSample sample) { sample.CurrentDim = 0; }
public void Accept(PsSample sample) { for (int i = 0; i < sample.CurrentDim; i++) { sample.PrevSamples[i] = sample.sampleData[i]; } sample.MaxDimPrev = sample.CurrentDim; sample.CurrentDim = 0; }