예제 #1
0
        public bool build(Options options)
        {
            // read options
            maxDiffuseDepth    = options.getInt("depths.diffuse", maxDiffuseDepth);
            maxReflectionDepth = options.getInt("depths.reflection", maxReflectionDepth);
            maxRefractionDepth = options.getInt("depths.refraction", maxRefractionDepth);
            string giEngineType = options.getstring("gi.engine", null);

            giEngine = PluginRegistry.giEnginePlugins.createObject(giEngineType);
            string caustics = options.getstring("caustics", null);

            causticPhotonMap = PluginRegistry.causticPhotonMapPlugins.createObject(caustics);

            // validate options
            maxDiffuseDepth    = Math.Max(0, maxDiffuseDepth);
            maxReflectionDepth = Math.Max(0, maxReflectionDepth);
            maxRefractionDepth = Math.Max(0, maxRefractionDepth);

            SunflowSharp.Systems.Timer t = new SunflowSharp.Systems.Timer();
            t.start();
            // count total number of light samples
            int numLightSamples = 0;

            for (int i = 0; i < lights.Length; i++)
            {
                numLightSamples += lights[i].getNumSamples();
            }
            // initialize gi engine
            if (giEngine != null)
            {
                if (!giEngine.init(options, scene))
                {
                    return(false);
                }
            }

            if (!calculatePhotons(causticPhotonMap, "caustic", 0, options))
            {
                return(false);
            }
            t.end();

            UI.printInfo(UI.Module.LIGHT, "Light Server stats:");
            UI.printInfo(UI.Module.LIGHT, "  * Light sources found: {0}", lights.Length);
            UI.printInfo(UI.Module.LIGHT, "  * Light samples:       {0}", numLightSamples);
            UI.printInfo(UI.Module.LIGHT, "  * Max raytrace depth:");
            UI.printInfo(UI.Module.LIGHT, "      - Diffuse          {0}", maxDiffuseDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Reflection       {0}", maxReflectionDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Refraction       {0}", maxRefractionDepth);
            UI.printInfo(UI.Module.LIGHT, "  * GI engine            {0}", giEngineType == null ? "none" : giEngineType);
            UI.printInfo(UI.Module.LIGHT, "  * Caustics:            {0}", caustics == null ? "none" : caustics);
            UI.printInfo(UI.Module.LIGHT, "  * Shader override:     {0}", shaderOverride);
            UI.printInfo(UI.Module.LIGHT, "  * Photon override:     {0}", shaderOverridePhotons);
            UI.printInfo(UI.Module.LIGHT, "  * Build time:          {0}", t.ToString());
            return(true);
        }
예제 #2
0
        public LightServer(Scene scene)
        {
            this.scene = scene;
            lights = new LightSource[0];
            causticPhotonMap = null;

            shaderOverride = null;
            shaderOverridePhotons = false;

            maxDiffuseDepth = 1;
            maxReflectionDepth = 4;
            maxRefractionDepth = 4;

            causticPhotonMap = null;
            giEngine = null;
        }
예제 #3
0
        public LightServer(Scene scene)
        {
            this.scene       = scene;
            lights           = new LightSource[0];
            causticPhotonMap = null;

            shaderOverride        = null;
            shaderOverridePhotons = false;

            maxDiffuseDepth    = 1;
            maxReflectionDepth = 4;
            maxRefractionDepth = 4;

            causticPhotonMap = null;
            giEngine         = null;
        }
예제 #4
0
        public bool build(Options options)
        {
            // read options
            maxDiffuseDepth = options.getInt("depths.diffuse", maxDiffuseDepth);
            maxReflectionDepth = options.getInt("depths.reflection", maxReflectionDepth);
            maxRefractionDepth = options.getInt("depths.refraction", maxRefractionDepth);
            string giEngineType = options.getstring("gi.engine", null);
            giEngine = PluginRegistry.giEnginePlugins.createObject(giEngineType);
            string caustics = options.getstring("caustics", null);
            causticPhotonMap = PluginRegistry.causticPhotonMapPlugins.createObject(caustics);

            // validate options
            maxDiffuseDepth = Math.Max(0, maxDiffuseDepth);
            maxReflectionDepth = Math.Max(0, maxReflectionDepth);
            maxRefractionDepth = Math.Max(0, maxRefractionDepth);

            SunflowSharp.Systems.Timer t = new SunflowSharp.Systems.Timer();
            t.start();
            // count total number of light samples
            int numLightSamples = 0;
            for (int i = 0; i < lights.Length; i++)
                numLightSamples += lights[i].getNumSamples();
            // initialize gi engine
            if (giEngine != null)
            {
                if (!giEngine.init(options, scene))
                    return false;
            }

            if (!calculatePhotons(causticPhotonMap, "caustic", 0, options))
                return false;
            t.end();

            UI.printInfo(UI.Module.LIGHT, "Light Server stats:");
            UI.printInfo(UI.Module.LIGHT, "  * Light sources found: {0}", lights.Length);
            UI.printInfo(UI.Module.LIGHT, "  * Light samples:       {0}", numLightSamples);
            UI.printInfo(UI.Module.LIGHT, "  * Max raytrace depth:");
            UI.printInfo(UI.Module.LIGHT, "      - Diffuse          {0}", maxDiffuseDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Reflection       {0}", maxReflectionDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Refraction       {0}", maxRefractionDepth);
            UI.printInfo(UI.Module.LIGHT, "  * GI engine            {0}", giEngineType == null ? "none" : giEngineType);
            UI.printInfo(UI.Module.LIGHT, "  * Caustics:            {0}", caustics == null ? "none" : caustics);
            UI.printInfo(UI.Module.LIGHT, "  * Shader override:     {0}", shaderOverride);
            UI.printInfo(UI.Module.LIGHT, "  * Photon override:     {0}", shaderOverridePhotons);
            UI.printInfo(UI.Module.LIGHT, "  * Build time:          {0}", t.ToString());
            return true;
        }
예제 #5
0
        public bool build(Options options)
        {
            // read options
            maxDiffuseDepth    = options.getInt("depths.diffuse", maxDiffuseDepth);
            maxReflectionDepth = options.getInt("depths.reflection", maxReflectionDepth);
            maxRefractionDepth = options.getInt("depths.refraction", maxRefractionDepth);
            giEngine           = GIEngineFactory.create(options);
            string caustics = options.getstring("caustics", null);

            if (caustics == null || caustics == "none")
            {
                causticPhotonMap = null;
            }
            else if (caustics != null && caustics == "kd")
            {
                causticPhotonMap = new CausticPhotonMap(options);
            }
            else
            {
                UI.printWarning(UI.Module.LIGHT, "Unrecognized caustics photon map engine \"{0}\" - ignoring", caustics);
                causticPhotonMap = null;
            }

            // validate options
            maxDiffuseDepth    = Math.Max(0, maxDiffuseDepth);
            maxReflectionDepth = Math.Max(0, maxReflectionDepth);
            maxRefractionDepth = Math.Max(0, maxRefractionDepth);

            SunflowSharp.Systems.Timer t = new SunflowSharp.Systems.Timer();
            t.start();
            // count total number of light samples
            int numLightSamples = 0;

            for (int i = 0; i < lights.Length; i++)
            {
                numLightSamples += lights[i].getNumSamples();
            }
            // initialize gi engine
            if (giEngine != null)
            {
                if (!giEngine.init(scene))
                {
                    return(false);
                }
            }

            if (!calculatePhotons(causticPhotonMap, "caustic", 0))
            {
                return(false);
            }
            t.end();
            cacheLookups          = 0;
            cacheHits             = 0;
            cacheEmptyEntryMisses = 0;
            cacheWrongEntryMisses = 0;
            cacheEntryAdditions   = 0;
            if (_shadingCache != null)
            {
                // clear shading cache
                for (int i = 0; i < _shadingCache.Length; i++)
                {
                    _shadingCache[i] = null;
                }
            }
            UI.printInfo(UI.Module.LIGHT, "Light Server stats:");
            UI.printInfo(UI.Module.LIGHT, "  * Light sources found: {0}", lights.Length);
            UI.printInfo(UI.Module.LIGHT, "  * Light samples:       {0}", numLightSamples);
            UI.printInfo(UI.Module.LIGHT, "  * Max raytrace depth:");
            UI.printInfo(UI.Module.LIGHT, "      - Diffuse          {0}", maxDiffuseDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Reflection       {0}", maxReflectionDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Refraction       {0}", maxRefractionDepth);
            UI.printInfo(UI.Module.LIGHT, "  * GI engine            {0}", options.getstring("gi.engine", "none"));
            UI.printInfo(UI.Module.LIGHT, "  * Caustics:            {0}", caustics == null ? "none" : caustics);
            UI.printInfo(UI.Module.LIGHT, "  * Shader override:     {0}", shaderOverride);
            UI.printInfo(UI.Module.LIGHT, "  * Photon override:     {0}", shaderOverridePhotons);
            UI.printInfo(UI.Module.LIGHT, "  * Shading cache:       {0}", _shadingCache == null ? "off" : "on");
            UI.printInfo(UI.Module.LIGHT, "  * Build time:          {0}", t.ToString());
            return(true);
        }
예제 #6
0
        public bool build(Options options)
        {
            // read options
            maxDiffuseDepth = options.getInt("depths.diffuse", maxDiffuseDepth);
            maxReflectionDepth = options.getInt("depths.reflection", maxReflectionDepth);
            maxRefractionDepth = options.getInt("depths.refraction", maxRefractionDepth);
            giEngine = GIEngineFactory.create(options);
            string caustics = options.getstring("caustics", null);
            if (caustics == null || caustics == "none")
                causticPhotonMap = null;
            else if (caustics != null && caustics == "kd")
                causticPhotonMap = new CausticPhotonMap(options);
            else
            {
                UI.printWarning(UI.Module.LIGHT, "Unrecognized caustics photon map engine \"{0}\" - ignoring", caustics);
                causticPhotonMap = null;
            }

            // validate options
            maxDiffuseDepth = Math.Max(0, maxDiffuseDepth);
            maxReflectionDepth = Math.Max(0, maxReflectionDepth);
            maxRefractionDepth = Math.Max(0, maxRefractionDepth);

            SunflowSharp.Systems.Timer t = new SunflowSharp.Systems.Timer();
            t.start();
            // count total number of light samples
            int numLightSamples = 0;
            for (int i = 0; i < lights.Length; i++)
                numLightSamples += lights[i].getNumSamples();
            // initialize gi engine
            if (giEngine != null)
            {
                if (!giEngine.init(scene))
                    return false;
            }

            if (!calculatePhotons(causticPhotonMap, "caustic", 0))
                return false;
            t.end();
            cacheLookups = 0;
            cacheHits = 0;
            cacheEmptyEntryMisses = 0;
            cacheWrongEntryMisses = 0;
            cacheEntryAdditions = 0;
            if (_shadingCache != null)
            {
                // clear shading cache
                for (int i = 0; i < _shadingCache.Length; i++)
                    _shadingCache[i] = null;
            }
            UI.printInfo(UI.Module.LIGHT, "Light Server stats:");
            UI.printInfo(UI.Module.LIGHT, "  * Light sources found: {0}", lights.Length);
            UI.printInfo(UI.Module.LIGHT, "  * Light samples:       {0}", numLightSamples);
            UI.printInfo(UI.Module.LIGHT, "  * Max raytrace depth:");
            UI.printInfo(UI.Module.LIGHT, "      - Diffuse          {0}", maxDiffuseDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Reflection       {0}", maxReflectionDepth);
            UI.printInfo(UI.Module.LIGHT, "      - Refraction       {0}", maxRefractionDepth);
            UI.printInfo(UI.Module.LIGHT, "  * GI engine            {0}", options.getstring("gi.engine", "none"));
            UI.printInfo(UI.Module.LIGHT, "  * Caustics:            {0}", caustics == null ? "none" : caustics);
            UI.printInfo(UI.Module.LIGHT, "  * Shader override:     {0}", shaderOverride);
            UI.printInfo(UI.Module.LIGHT, "  * Photon override:     {0}", shaderOverridePhotons);
            UI.printInfo(UI.Module.LIGHT, "  * Shading cache:       {0}", _shadingCache == null ? "off" : "on");
            UI.printInfo(UI.Module.LIGHT, "  * Build time:          {0}", t.ToString());
            return true;
        }