Beispiel #1
0
        public override void Initialize()
        {
            builder = new OptixSceneBuilder(2);
            int avgIteration = (int)(rrBeginDepth + maxDepth) / 2;

            RaysTracedPerFrame *= (int)(sqrtSamples*sqrtSamples* avgIteration);
            builder.OnMaterialScriptsResolve += delegate
            {
                return new[]
                {
                    new OptixScript()
                    {
                        Method = "radiance",
                        PtxPath = ScriptManager.GetScript("rt_engine.ptx")
                    },
                     new OptixScript()
                    {
                        Method = "shadow",
                        PtxPath = ScriptManager.GetScript("rt_engine.ptx")
                    },

                };
            };

            builder.OnLightMaterialScriptsResolve += delegate
            {
                return
                    new[]
                {
                    new OptixScript()
                    {
                        Method = "emitter",
                        PtxPath = ScriptManager.GetScript("rt_engine.ptx")
                    },
                     new OptixScript()
                    {
                        Method = "shadow",
                        PtxPath = ScriptManager.GetScript("rt_engine.ptx")
                    }
                };
            };

            CameraScript = new OptixScript
            {
                PtxPath = ScriptManager.GetScript("rt_engine.ptx"),
                Method = "pinhole_camera"
            };
            IntersectionScript = new OptixScript
            {
                PtxPath = ScriptManager.GetScript("triangle_mesh.ptx"),
                Method = "mesh_intersect"
            };
            builder.IntersectionScript = this.IntersectionScript.PtxPath;
            MissMethod = "miss";
            ExceptionMethod = "exception";
            EntryPointCount = 1;
            RayTypeCount = 2;

            base.Initialize();
        }
Beispiel #2
0
        public override void Initialize()
        {
            builder = new OptixSceneBuilder(2);
            builder.OnMaterialScriptsResolve += delegate
            {
                return new[]
                {
                    new OptixScript()
                    {
                        Method = "radiance",
                        PtxPath = ScriptManager.GetScript("ao_engine.ptx")
                    },
                     new OptixScript()
                    {
                        Method = "occlusion",
                        PtxPath = ScriptManager.GetScript("ao_engine.ptx")
                    },

                };
            };

            builder.OnLightMaterialScriptsResolve += delegate
            {
                return
                    new[]
                {
                    new OptixScript()
                    {
                        Method = "radiance",
                        PtxPath = ScriptManager.GetScript("ao_engine.ptx")
                    },
                     new OptixScript()
                    {
                        Method = "occlusion",
                        PtxPath = ScriptManager.GetScript("ao_engine.ptx")
                    }
                };
            };

            CameraScript = new OptixScript
            {
                PtxPath = ScriptManager.GetScript("ao_engine.ptx"),
                Method = "pinhole_camera"
            };
            IntersectionScript = new OptixScript
            {
                PtxPath = ScriptManager.GetScript("triangle_mesh.ptx"),
                Method = "mesh_intersect"
            };
            builder.IntersectionScript = this.IntersectionScript.PtxPath;
            MissMethod = "miss";
            ExceptionMethod = "exception";
            EntryPointCount = 1;
            RayTypeCount = 2;

            var context = ComponentPipeline.Instance.Session.OptixContext;
            context.EntryPointCount = this.EntryPointCount;
            context.RayTypeCount = this.RayTypeCount;
            context.PrintingEnabled = true;
            context.EnableAllExceptions = true;
            context.StackSize = 10284;

            var rayGen_prog = new Program(context, CameraScript.PtxPath, CameraScript.Method);
            var exception_prog = new Program(context, CameraScript.PtxPath, ExceptionMethod);
            var miss_prog = new Program(context, CameraScript.PtxPath, MissMethod);

            context.SetRayGenerationProgram(0, rayGen_prog);
            context.SetExceptionProgram(0, exception_prog);
            context.SetRayMissProgram(0, miss_prog);
        }
Beispiel #3
0
        public override void Initialize()
        {
            //maxDepth = 64;
            builder = new OptixSceneBuilder(2) { DefaultSceneEmission = new Vector3(8, 8, 8) };
            int avgIteration = (int)(rrBeginDepth + maxDepth) / 2;

            RaysTracedPerFrame *= (int)(sqrtSamples * sqrtSamples * avgIteration);
            builder.OnMaterialScriptsResolve += delegate(MaterialResolveArgs args)
            {
                if (args.IsVolume)
                {
                    return new[]
                        {
                            new OptixScript()
                            {
                                Method = "volume_radiance",
                                PtxPath = ScriptManager.GetScript("lt_engine.ptx")
                            },
                             new OptixScript()
                            {
                                Method = "volume_shadow",
                                PtxPath = ScriptManager.GetScript("lt_engine.ptx")
                            },

                        };
                }

                return new[]
                {
                    new OptixScript()
                    {
                        Method = "surface_radiance",
                        PtxPath = ScriptManager.GetScript("lt_engine.ptx")
                    },
                     new OptixScript()
                    {
                        Method = "shadow",
                        PtxPath = ScriptManager.GetScript("lt_engine.ptx")
                    },

                };
            };

            builder.OnLightMaterialScriptsResolve += delegate
            {
                return
                    new[]
                {
                    new OptixScript()
                    {
                        Method = "surface_radiance",
                        PtxPath = ScriptManager.GetScript("lt_engine.ptx")
                    },
                     new OptixScript()
                    {
                        Method = "shadow",
                        PtxPath = ScriptManager.GetScript("lt_engine.ptx")
                    }
                };
            };

            CameraScript = new OptixScript
            {
                PtxPath = ScriptManager.GetScript("pt_engine.ptx"),
                Method = "pinhole_camera"
            };

            IntersectionScript = new OptixScript
            {
                PtxPath = ScriptManager.GetScript("triangle_mesh.ptx"),
                Method = "mesh_intersect"
            };
            builder.IntersectionScript = this.IntersectionScript.PtxPath;
            MissMethod = "miss";
            ExceptionMethod = "exception";
            EntryPointCount = 1u;
            RayTypeCount = 2;

            base.Initialize();
        }