public override RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice, RayEngineScene scene, 
     IImageFilm flm,IFrameManager manager, SamplingContext samplingContext)
 {
     if (this.film == null)
         film = flm;
     return new SpectralRenderThread(threadIndex, intersectionDevice, scene, samplingContext.LowLatency, this.film, samplingContext, manager,sceneManager);
 }
        public virtual void Initialize() {
            this.IntersectionDevice =
                new DadeCudaIntersectionDevice(Scene, null);
                //new MCOpenClIntersectionDevice(Scene, lowLatency, 0);

            this.engine = EngineFactory.CreateEngine(engineType, Scene, lowLatency);
            this.Film = (ImageFilmBase)engine.CreateFilm(width, height);
            
            var renderThreadsCount = Math.Min(engine.MaxThreadCount, this.RenderThreadsCount);
            this.RenderThreads = new RenderThread[renderThreadsCount];
            int ht = height / renderThreadsCount;
            var samplingContext = new SamplingContext()
            {
                LightSampler = new LightSampler(Scene),
                SurfaceSampler = new SurfaceSampler(Scene)
            };
            for (int i = 0; i < renderThreadsCount; i++)
            {
                var sampler = engine.CreateSampler(width, height, Scene.MaxPathDepth, i, ht*i, ht);
                samplingContext.PrimarySpaceSampler = sampler;
                RenderThreads[i] = engine.CreateRenderThread(i, IntersectionDevice, Scene, Film, new StillFrameManager(), samplingContext);
            }

            Tracer.TraceLine("Starting {0}", engineType);
        }
Exemple #3
0
        private void InitDevices(int renderThreadCount, int width, int height, IFrameManager fM)
        {
            engine.LowLatencySampling = false;

            this.IntersectionDevice =
                //new MCOpenClIntersectionDevice(scene, true, 0);
                //new DadeCudaIntersectionDevice(scene, null);
                new OptixIntersectionDevice(scene, engine.LowLatencySampling);
            //new OptixPrimeIntersectionDevice(scene, engine.LowLatencySampling);

            //new CpuBvhIntersectionEngine(scene);
            var renderThreadsCount = Math.Min(engine.MaxThreadCount, renderThreadCount);
            this.RenderThreads = new RenderThread[renderThreadsCount];
            int ht = height / renderThreadsCount;
            var samplingContext = new SamplingContext()
                {
                    LightSampler = new LightSampler(scene),
                    SurfaceSampler = new SurfaceSampler(scene)
                };
            for (int i = 0; i < renderThreadsCount; i++)
            {
                var sampler = engine.CreateSampler(width, height, scene.MaxPathDepth, i, ht * i, ht);
                samplingContext.PrimarySpaceSampler = sampler;
                RenderThreads[i] = engine.CreateRenderThread(i, IntersectionDevice, scene, 
                    SingleFilm ? FilmFactory.Cache :
                    FilmFactory.CreateFilm(width, height, GlobalConfiguration.Instance.AdaptiveFilm)
                    , fM, samplingContext);
            }
        }
 public override RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice,
                                                 RayEngineScene scene, IImageFilm film, IFrameManager frameManager, SamplingContext samplingContext)
 {
     if (this.Context == null)
     {
         Context = new PhotonMappingContext() { Film = film, surfaceSampler = (SurfaceSampler)samplingContext.SurfaceSampler };
     }
     return new PhotonMappingRenderThread(threadIndex, intersectionDevice, scene, LowLatencySampling, film, Context, samplingContext ,frameManager);
 }
 public override void Preprocess(RayEngineScene scene, IntersectionEngine ie)
 {
     this.Context.BuildMaps(ie, scene);
 }
 public override RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice, RayEngineScene scene, IImageFilm film, IFrameManager frameManager, SamplingContext samplingContext)
 {
     return new DeviceRenderThread<PathBuffer<VolumePathTracerPath>> (threadIndex, intersectionDevice, scene, LowLatencySampling, film, samplingContext, frameManager);
 }
 public override RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice, RayEngineScene scene, IImageFilm film, IFrameManager manager, SamplingContext samplingContext)
 {
     return new DeviceRenderThread(threadIndex, intersectionDevice, scene, this.LowLatencySampling, film, samplingContext, manager);
 }
 public override RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice, RayEngineScene scene,
                                                 IImageFilm film, IFrameManager manager, SamplingContext samplingContext)
 {
     return new DeviceRenderThread<PathBuffer<UnidirectionalSpectralPathSampler>>(threadIndex, intersectionDevice, scene,
                                                             LowLatencySampling, film, samplingContext, manager);
 }
 public virtual void Preprocess(RayEngineScene scene, IntersectionEngine ie)
 {
     
 }
 public abstract RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice, RayEngineScene scene, IImageFilm film, IFrameManager manager, SamplingContext samplingContext);