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 override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.PathState = PathTracerPathState.EyeVertex; if (this.secRays == null) this.secRays = new ConnectRayInfo[MaxEyeRays]; this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.depth = 0; this.specularBounce = true; this.Radiance = new RgbSpectrum(0f); this.Sample = pathIntegrator.Sampler.GetSample(null); LightSample ls; var light = scene.Lights[scene.SampleLights(Sample.GetLazyValue())]; light.EvaluatePhoton(scene, Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), out ls); PathRay = ls.LightRay; var lightPdf = ls.Pdf; Throughput = (RgbSpectrum)(ls.Spectrum); //* scene.Lights.Length) / lightPdf; //buffer.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.PathState = BDPTSamplerState.InitPath; if (this.connectRays == null) this.connectRays = new ConnectRayInfo[scene.MaxPathDepth * scene.MaxPathDepth]; lightPath = new VertexInfo[MaxLightDepth]; this.Sample = pathIntegrator.Sampler.GetSample(null); lightVertices = 0; //Init eye ray this.EyeThroughput = new RgbSpectrum(1f); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); this.RayIndex = -1; this.LightRayIndex = -1; this.eyePdf = 1f; //Init light path LightSample ls; var light = scene.Lights[scene.SampleLights(Sample.GetLazyValue())]; light.EvaluatePhoton(scene, Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), out ls); LightRay = ls.LightRay; lightPdf = ls.Pdf * (1f / scene.Lights.Length); LightThroughput = (RgbSpectrum)(ls.Spectrum); this.tracedConnectRayCount = 0; this.eyeDepth = 0; this.lightDepth = 0; this.eyeStop = false; this.lightStop = false; }
private void Awake() { instance = this; cache = new PathCache(); pathProcessor = new RemoveRedundantPathPoints(new RemoveEndBacktracking(new RemoveStartBacktracking(null))); }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.waveRadiance = 0f; this.waveThroughput = 1f; this.PathState = PathTracerPathState.EyeVertex; if (this.secRays == null) this.secRays = new ShadowRayInfo[scene.ShadowRaysPerSample]; if (lambdaSample == 0) { this.Sample = pathIntegrator.Sampler.GetSample(this.Sample); this.Sample.InitSample(scene.MaxPathDepth*8); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); } this.HeroWavelength = this.wlSampler.SampleWavelength( lambdaSample); //Sample.GetLazyValue(0)); this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.depth = 0; this.specularBounce = true; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); scene = pathIntegrator.Scene; this.Sample = new Sample(pathIntegrator.Sampler); this.RayIndex = -1; float lspdf; int li = scene.SampleLights(this.Sample.GetLazyValue(), out lspdf); var ls = new LightSample(); bool done = false; while (!done) { scene.Lights[li].EvaluatePhoton( scene, Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), out ls); done = ls.Pdf > 0f; } var pathWeight = (ls.Pdf * lspdf); this.ThroughtPut = ((RgbSpectrum)(ls.Spectrum) / pathWeight); this.PathRay = ls.LightRay; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; if (this.secRays == null) this.secRays = new ShadowRayInfo[scene.ShadowRayCount]; if (this.volumeComp == null) { this.volumeComp = scene.GetVolumeComputation(); } else { this.volumeComp.Reset(); } this.Sample = pathIntegrator.Sampler.GetSample(null); 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; this.rayID = (int)(Sample.imageX + Sample.imageY * 640f); }
public override void InitPath(IPathProcessor buffer) { //Choose lightsource //Sample it base.InitPath(buffer); this.Sample = new Sample(pathIntegrator.Sampler); this.RayIndex = -1; float lspdf; int li = scene.SampleLights(this.Sample.GetLazyValue(), out lspdf); RayData ray; var ls = new LightSample(); bool done = false; while (!done) { scene.Lights[li].EvaluatePhoton( scene, Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), Sample.GetLazyValue(), out ls); done = ls.Pdf > 0f; } this.pathWeight = 10000 /(ls.Pdf * lspdf); ls.Spectrum.Mul(pathWeight); this.ThroughtPut = new RgbSpectrum(ls.Spectrum.ToArray()); this.PathRay = ls.LightRay; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; if (this.secRays == null) { this.secRays = new ShadowRayInfo[scene.ShadowRaysPerSample]; continueRays = new ShadowRayInfo[scene.ShadowRaysPerSample]; } if (volumeComp == null) { volumeComp = new VolumeComputation(scene.VolumeIntegrator); } contCount = 0; this.Sample = pathIntegrator.Sampler.GetSample(this.Sample); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.depth = 0; this.specularBounce = true; this.inVolume = false; }
public PermutationProcessor(List <Vertex> vertices) { this._vertices = vertices; this._pathProcessor = new PathProcessor(); this.ShortestDistance = 0; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); if (secRays == null) { secRays = new ShadowRayInfo[scene.ShadowRayCount]; } PathState = PathTracerPathState.EyeVertex; }
public GAProcessor(string filename) { _fileReader = new TSPReader(); _pathProcessor = new PathProcessor(); _vertices = new List <Vertex>(_fileReader.ReadTSP(filename)); ParentGenerationList = new List <List <Vertex> >(); _childGenerationList = new List <List <Vertex> >(); FitnessList = new List <int>(); _rng = new Random(); }
public DFSProcessor() { _fileReader = new TSPReader(); _vertices = new List <Vertex>(); _pathProcessor = new PathProcessor(); ShortestDist = Double.MaxValue; }
public TSPGUI() { InitializeComponent(); _fileReader = new TSPReader(); _vertices = new List <Vertex>(); _pathProcessor = new PathProcessor(); chrtMain.ChartAreas[0].AxisX.Minimum = 0; chrtMain.ChartAreas[0].AxisY.Minimum = 0; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); volumes.Clear(); volumes.Push(new VolumeInfo() { IndexOfRefraction = 1.00005f, Sigma_E = new RgbSpectrum(0.5f), S_A = 1.64f / 1000f, Extinction = new RgbSpectrum(0.5f).y() + 1.64f / 1000f }); }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); depth = 0; specularBounce = false; pathWeight = 1.0f; this.Sample = pathIntegrator.Sampler.GetSample(null); scene = pathIntegrator.Scene; if (this.engine == null) { var ppb = buffer as PPMPathBuffer; this.engine = ppb.context; } }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new SampledSpectrum(0f); this.Throughput = new SampledSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; if (this.secRays == null) this.secRays = new SpectralShadowRayInfo[scene.ShadowRaysPerSample]; this.Sample = pathIntegrator.Sampler.GetSample(null); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.depth = 0; this.specularBounce = true; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); maxDepth = Buffer.Scene.MaxPathDepth; RussianRuletteImportanceCap = Buffer.Scene.RussianRuletteImportanceCap; this.Radiance = ColorManager.Instance.Zero(); this.Throughput = ColorManager.Instance.Unit(); this.PathState = PurePathTracerPathState.EyeVertex; //if (this.secRays == null) this.secRays = new PurePathTracerPath.ShadowRayInfo[scene.ShadowRayCount]; this.Sample = Buffer.Sampler.GetSample(this.Sample); IRay ray; Buffer.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 override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; if (Vertices == null) { Vertices = new PathVertex[scene.MaxPathDepth * 3]; Xvertices = new PathVertex[scene.MaxPathDepth * 3]; } this.pathDensity = 1.0f; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; if (!mutate) { this.Sample = pathIntegrator.Sampler.GetSample(this.Sample); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); pathStart = PathRay.Org; XRadiance = new RgbSpectrum(); xPathDensity = 1.0f; } else { PathRay.Org = pathStart; PathRay.Dir = -Vertices[0].Wo; this.BackupPath(); this.MutatePath(); mutationCount++; if (mutationCount > MaxMutations) { this.mutate = false; this.mutationCount = 0; this.InitPath(buffer); } } this.RayIndex = -1; this.depth = 0; this.bsdfEvent = BsdfEvent.Specular; this.prevEvent = BsdfEvent.None; shadowRayEvent = BsdfEvent.None; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; if (this.secRays == null) { this.secRays = new ShadowRayInfo[scene.ShadowRaysPerSample]; continueRays = new ShadowRayInfo[scene.ShadowRaysPerSample]; } if (paths == null) { paths = new List<PathInfo>(); } if (CurrentVertices == null) { CurrentVertices = new List<PathVertex>(); } else { CurrentVertices.Clear(); } contCount = 0; this.Sample = pathIntegrator.Sampler.GetSample(this.Sample); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); this.EyeSample = new CameraSample() { imageX = (float)Sample.imageX, imageY = (float)Sample.imageY, EyeRay = this.PathRay }; this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.depth = 0; this.specularBounce = true; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = GenericPathSamplerState.Initialize; //vertices = new PathVertex[scene.MaxPathDepth * 2]; this.Sample = pathIntegrator.Sampler.GetSample(null); IRay ray; pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out ray); currentVertice = 0; vertices[currentVertice] = new ObserverPathElement() { CameraSample = new CameraSample() { EyeRay = (RayData)ray, imageX = (float)Sample.imageX, imageY = (float)Sample.imageY } }; currentVertice++; this.PathRay = (RayData)ray; this.RayIndex = -1; this.pathWeight = 1.0f; this.depth = 0; this.verticesCount = 0; this.specularBounce = true; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; this.secRays = new ShadowRayInfo[scene.ShadowRayCount]; this.sampler = (MarkovChainSampler)pathIntegrator.Sampler; this.Sample = this.sampler.EvalNextSample(this.Sample, xImportance); 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 override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; if (this.secRays == null) { this.secRays = new ShadowRayInfo[scene.ShadowRaysPerSample]; } if (State == RayTracerPathState.Eye || State == RayTracerPathState.OnlyShadow || depth >= scene.MaxPathDepth) { this.Sample = pathIntegrator.Sampler.GetSample(this.Sample); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.depth = 0; this.Throughput = new RgbSpectrum(1f); this.Radiance = Ambient; this.specularBounce = true; this.State = RayTracerPathState.Eye; this.finished = false; } else if (State == RayTracerPathState.Reflection) { this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.specularBounce = true; } else if (State == RayTracerPathState.Refraction) { this.RayIndex = -1; this.pathWeight = 1.0f; this.tracedShadowRayCount = 0; this.specularBounce = true; } }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.currentVertex = 0; this.Throughput = new RgbSpectrum(1f); this.PathState = PurePathTracerPathState.EyeVertex; if (this.secRays == null) this.secRays = new ShadowRayInfo[scene.ShadowRayCount]; if (vertices == null) vertices = Enumerable.Range(0, scene.MaxPathDepth*2).Select(i => new PathVertex()).ToArray(); this.Sample = pathIntegrator.Sampler.GetSample(this.Sample); 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 override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; if (this.secRays == null) { this.secRays = new ShadowRayInfo[scene.ShadowRaysPerSample+10]; continueRays = new ShadowRayInfo[scene.ShadowRaysPerSample+10]; } contCount = 0; this.Sample = pathIntegrator.Sampler.GetSample(this.Sample); pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out this.PathRay); this.RayIndex = -1; this.tracedShadowRayCount = 0; this.depth = 0; this.bsdfEvent = BsdfEvent.Specular; this.prevEvent = BsdfEvent.None; shadowRayEvent = BsdfEvent.None; }
public override void InitPath(IPathProcessor buffer) { this.samplers[currentSampler].InitPath(buffer); }
public TSPUserConsole() { _tspProcessor = new TSPProcessor(); _pathProcessor = new PathProcessor(); }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); this.PathState = PathTracerPathState.EyeVertex; this.secRays = new ShadowRayInfo[scene.ShadowRayCount]; this.sampler = (MCMCSampler)pathIntegrator.Sampler; switch (this.SamplerState) { case MCMCSamplerState.LargeStep: case MCMCSamplerState.Initialized: time = 0; this.mutationsCount = 0; this.rejectCount = 0; //this.sampleCache.Clear(); this.Sample = pathIntegrator.Sampler.GetSample(null); break; case MCMCSamplerState.SmallStep: { //if (rejectCount > 0) //{ // Print("Rejects : " + rejectCount); //} this.time++; this.Sample = this.sampler.SmallStep(this.Sample); ; } break; } 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 virtual void InitPath(IPathProcessor buffer) { this.Buffer = (PathBuffer) buffer; }
public RemoveEndBacktracking(IPathProcessor processor) : base(processor) { }
public PathProcessorBase(IPathProcessor decoratedProcessor) { this.decoratedProcessor = decoratedProcessor; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); secondTechniqueWeight = 1.0f; samplingWeight = 1.0f; }
public override void InitPath(IPathProcessor buffer) { base.InitPath(buffer); this.scene = pathIntegrator.Scene; this.Radiance = new RgbSpectrum(0f); this.Throughput = new RgbSpectrum(1f); if (secRays == null) this.secRays = new ShadowRayInfo[scene.ShadowRayCount]; if (pathIntegrator.Sampler.GetPass() > PssMltEngineController.WarmupIterations && SamplerState == PssmltSamplerState.WarmUp) { SamplerState = PssmltSamplerState.Initialize; } @restart: switch (SamplerState) { case PssmltSamplerState.WarmUp: this.Sample = pathIntegrator.Sampler.GetSample(); this.Sample.InitSample(SamplesPerVertex * scene.MaxPathDepth); this.contributionMap[this.Sample].Sample = this.Sample; this.contributionMap[this.Sample].Weight = 1.0f; break; case PssmltSamplerState.Initialize: var s = pathIntegrator.Sampler.GetSample(); if (this.contributionMap[s].Sample != null) { this.Sample = this.contributionMap[s].Sample; } else { this.Sample.InitSample(SamplesPerVertex * scene.MaxPathDepth); this.contributionMap[this.Sample].Sample = this.Sample; this.contributionMap[this.Sample].Weight = 1.0f; } break; case PssmltSamplerState.LargeMutation: s = pathIntegrator.Sampler.GetSample(); if (this.contributionMap[s].Sample != null) { this.Sample = this.contributionMap[s].Sample; } else { this.Sample = pathIntegrator.Sampler.GetSample(); this.Sample.InitSample(SamplesPerVertex * scene.MaxPathDepth); } this.mutationsCount = 0; break; case PssmltSamplerState.SmallMutation: mutationsCount++; if (mutationsCount > PssMltEngineController.MaxMutations) { this.SamplerState = PssmltSamplerState.Initialize; goto restart; } if (pathIntegrator.Sampler.GetLazyValue(this.Sample) < PssMltEngineController.LargeStepProbability) { this.SamplerState = PssmltSamplerState.LargeMutation; goto restart; } if (this.XSample == null) this.XSample = new Sample(this.Sample); this.Sample = Mutate(this.Sample, mutationsCount, pathIntegrator.Sampler); break; } RayData ray; if (Sample == null) { Debugger.Break(); } pathIntegrator.Scene.Camera.GetRay(Sample.imageX, Sample.imageY, out ray); this.PathRay = ray; this.RayIndex = -1; this.depth = 0; this.specularBounce = true; }
public RemoveRedundantPathPoints(IPathProcessor processor) : base(processor) { }