public CorrectorRenderer(FrameConfiguration currentFrame, CorrectorImageFilm film) { this.film = film; this.currentFrame = currentFrame; this.ImagePlaneSampler = new RandomImagePlaneSampler(currentFrame.Width, currentFrame.Height); this.LightsourceSampler = new LightsourceSampler(currentFrame.Scene); this.GenerateImageSamples(); }
public FrameConfiguration(FrameConfiguration parent) : base(parent) { SamplesPerPass = 1; this.Width = parent.Width; this.Height = parent.Height; this.MaxSamplesPerPixel = parent.MaxSamplesPerPixel; this.FramePath = parent.FramePath; this.ImageSavePath = parent.ImageSavePath; this.SaveImage = parent.SaveImage; }
public void OpenFrame(Library.Entity.Frames.FrameDescription frame) { this.CurrentFrame = new FrameConfiguration(); this.config.Merge(frame); this.OutputSettings = new OutputSettingsInfo(frame); this.QualitySettings = new QualitySettingsInfo(frame); this.FrameName = frame.FrameName; if (!string.IsNullOrWhiteSpace(frame.WorkingDir)) Directory.SetCurrentDirectory(frame.WorkingDir); /* foreach (var frameElement in frame.Elements.Where(frameElement => frameParsers.ContainsKey(frameElement.GetType()))) { frameParsers[frameElement.GetType()](frameElement); }*/ if (Scene == null) { SceneGraphService svc = new SceneGraphService(); svc.Populate( //new ObjLoader(), new GlobalIndexObjLoader(), new MaterialLoader()); //svc.OpenFrame(frame); _builder = new SceneBuilder() { SGService = svc }; _builder.Setup(); this.SceneGraph = _builder.SGService.SceneGraph; this.Scene = _builder.OpenFrame(frame, this.AreaLightAsMeshLight); this.Scene.DefaultLightGain = config.Get("LightGain", new RgbSpectrum(1.0f)); this.Scene.MaxPathDepth = config.Get("MaxPathDepth", 10); this.Scene.RussianRuletteImportanceCap = config.Get("RRImportanceCap", 0.75f); this.Scene.MaxPaths = config.Get("PathBufferSize", 65536); this.Scene.ShadowRayCount = config.Get("ShadowRayCount", 1); this.Scene.TextureSamplingQuality = this.QualitySettings.TextureSamplingQuality; this.Scene.LightSamplingStrategy = this.QualitySettings.LightSamplingStrategy; RgbSpectrum.Gamma = true; /* if (GlobalConfiguration.Instance.SpectralRendering) { this.Scene.SpectralMats = new BxDFLibrary(new LambertianBrdf(new[] { 0.5f, 0.5f, 0.5f })); this.Scene.SpectralMats.Populate(_builder.MaterialInfos.ToArray()); } else*/ { this.Scene.MatLib = this.dependencyManager.GetMaterialPlugin(_builder.MaterialInfos.ToArray()); if (_builder.FrameMaterialBuilder != null) { this.Scene.MatLib.Add(_builder.FrameMaterialBuilder.Materials); _builder.FrameMaterialBuilder.CreateRayEngineMaterials(this.Scene); } //if (EnableMaterialOverrides) FrameMaterialBuilder.ApplyMaterialOverrides((this.Scene.MatLib as OptimizedBsdfLibrary).Materials, Scene); } RenderThreadsCount = config.Get("RenderThreadsCount", 1); this.scene = _builder.SceneGeo; var sceneBound = new AABB(scene.BoundingSphereCenter - scene.BoundingSphereRadius, scene.BoundingSphereCenter + scene.BoundingSphereRadius); sceneBound.Expand(1f); //var viewBound = new AABB(Scene.Camera.Target - 5f, Scene.Camera.Target + 5f); var c = new Point(Scene.Camera.Target); var bb = new AABB(c - 1f, c + 1f); var volumeBound = sceneBound; Scene.VolumeIntegrator = new SingleScatteringIntegrator(volumeBound, volumeBound.Size.Length / 10f, //step 0.05f, //Probability RgbSpectrum.UnitSpectrum() * 0.05f, //Inscatering new RgbSpectrum(0.000f) //Emission ); new RayEngineMaterialBuilder().BuildMaterials(this.Scene); } this.CurrentFrame.Width = frame.Get<int>("ImageWidth"); this.CurrentFrame.Height = frame.Get<int>("ImageHeight"); this.CurrentFrame.ImageSavePath = this.SavePath; this.CurrentFrame.LowLatency = lowLatency; this.CurrentFrame.MaxSamplesPerPixel = this.QualitySettings.SamplesPerPixel; this.Initialize(); this.Scene.BuildPrimitives(); }