Esempio n. 1
0
        /// <summary>
        /// Create a new scene with the given SceneParameters and Device
        /// </summary>
        /// <param name="client">The client from C[CS]ycles API</param>
        /// <param name="sceneParams">The SceneParameters to create scene with</param>
        /// <param name="device">The Device to create scene for</param>
        public Scene(Client client, SceneParameters sceneParams, Device device)
        {
            Client = client;
            Id = CSycles.scene_create(Client.Id, sceneParams.Id, device.Id);
            Background = new Background(this);
            Camera = new Camera(this);
            Integrator = new Integrator(this);
            Film = new Film(this);
            Device = device;

            /* add simple wrappers for shadermanager created default shaders */
            var surface = Shader.WrapDefaultSurfaceShader(client);
            var light = Shader.WrapDefaultLightShader(client);
            var background = Shader.WrapDefaultBackgroundShader(client);
            var empty = Shader.WrapDefaultEmptyShader(client);

            /* register the wrapped shaders with scene */
            m_shader_in_scene_ids.Add(surface, surface.Id);
            m_shader_in_scene_ids.Add(background, background.Id);
            m_shader_in_scene_ids.Add(light, light.Id);
            m_shader_in_scene_ids.Add(empty, empty.Id);

            DefaultSurface = surface;

            // set ourself to client as reference
            client.Scene = this;
        }
Esempio n. 2
0
 /// <summary>
 /// Create session parameters using <c>Device</c>
 /// </summary>
 /// <param name="dev">The device to create session parameters for</param>
 public SessionParameters(Client client, Device dev)
 {
     Client = client;
     _device = dev;
     Id = CSycles.session_params_create(Client.Id, (uint)dev.Id);
 }
Esempio n. 3
0
        /// <summary>
        /// create a ccl.Scene
        /// </summary>
        /// <param name="client">Client to create scene for</param>
        /// <param name="render_device">Render device to use</param>
        /// <param name="cycles_engine">Engine instance to create for</param>
        /// <returns></returns>
        protected static Scene CreateScene(Client client, Device render_device,
			RenderEngine cycles_engine)
        {
            #region set up scene parameters
            var scene_params = new SceneParameters(client, ShadingSystem.SVM, BvhType.Dynamic, false, false, false);
            #endregion

            #region create scene
            var scene = new Scene(client, scene_params, render_device)
            {
                #region integrator settings
                Integrator =
                {
                    MaxBounce = cycles_engine.Settings.MaxBounce,
                    MinBounce = cycles_engine.Settings.MinBounce,
                    TransparentMinBounce = cycles_engine.Settings.TransparentMinBounce,
                    TransparentMaxBounce = cycles_engine.Settings.TransparentMaxBounce,
                    MaxDiffuseBounce = cycles_engine.Settings.MaxDiffuseBounce,
                    MaxGlossyBounce = cycles_engine.Settings.MaxGlossyBounce,
                    MaxTransmissionBounce = cycles_engine.Settings.MaxTransmissionBounce,
                    MaxVolumeBounce = cycles_engine.Settings.MaxVolumeBounce,
                    NoCaustics = cycles_engine.Settings.NoCaustics,
                    TransparentShadows = cycles_engine.Settings.TransparentShadows,
                    DiffuseSamples = cycles_engine.Settings.DiffuseSamples,
                    GlossySamples = cycles_engine.Settings.GlossySamples,
                    TransmissionSamples = cycles_engine.Settings.TransmissionSamples,
                    AoSamples = cycles_engine.Settings.AoSamples,
                    MeshLightSamples = cycles_engine.Settings.MeshLightSamples,
                    SubsurfaceSamples = cycles_engine.Settings.SubsurfaceSamples,
                    VolumeSamples = cycles_engine.Settings.VolumeSamples,
                    AaSamples = cycles_engine.Settings.AaSamples,
                    FilterGlossy = cycles_engine.Settings.FilterGlossy,
                    IntegratorMethod = cycles_engine.Settings.IntegratorMethod,
                    SampleAllLightsDirect = cycles_engine.Settings.SampleAllLights,
                    SampleAllLightsIndirect = cycles_engine.Settings.SampleAllLightsIndirect,
                    SampleClampDirect = cycles_engine.Settings.SampleClampDirect,
                    SampleClampIndirect = cycles_engine.Settings.SampleClampIndirect,
                    SamplingPattern = SamplingPattern.CMJ,
                    Seed = cycles_engine.Settings.Seed
                }
                #endregion
            };

            scene.Film.SetFilter(FilterType.Gaussian, 1.5f);
            scene.Film.Exposure = 1.0f;
            scene.Film.Update();

            #endregion

            #region background shader

            // we add here a simple background shader. This will be repopulated with
            // other nodes whenever background changes are detected.
            var background_shader = new Shader(client, Shader.ShaderType.World)
            {
                Name = "Rhino Background"
            };

            var bgnode = new BackgroundNode("orig bg");
            bgnode.ins.Color.Value = new float4(0.7f);
            bgnode.ins.Strength.Value = 1.0f;

            background_shader.AddNode(bgnode);
            bgnode.outs.Background.Connect(background_shader.Output.ins.Surface);
            background_shader.FinalizeGraph();

            scene.AddShader(background_shader);

            scene.Background.Shader = background_shader;
            scene.Background.AoDistance = 0.0f;
            scene.Background.AoFactor = 0.0f;
            scene.Background.Visibility = PathRay.AllVisibility;

            #endregion

            return scene;
        }