public void UpdateLightingEffect_DistantDiffuse(float AmbientAmount = 0, float DiffuseAmount = .5f, float SpecularAmount = 0, string NormalMapSource = "NormalMap", bool forceUpdate = false, BrushType brushType = BrushType.Flat) { //_currentBrushType = brushType; var sceneLightingEffect = new SceneLightingEffect() { AmbientAmount = AmbientAmount, DiffuseAmount = DiffuseAmount, SpecularAmount = SpecularAmount, NormalMapSource = new CompositionEffectSourceParameter(NormalMapSource), }; IGraphicsEffect graphicsEffect = new CompositeEffect() { Mode = CanvasComposite.Add, Sources = { new CompositionEffectSourceParameter("ImageSource"), sceneLightingEffect } }; _effectFactory = _compositor.CreateEffectFactory(graphicsEffect); if (forceUpdate) { UpdateEffectBrush(_currentBrushType); } }
private void Initialize(StreamingContext context) { _type = LayerType.Lighting; _borderEffect = (BorderEffect)_inputEffect; _inputEffect = new SceneLightingEffect() { AmbientAmount = .3f, DiffuseAmount = 1, SpecularAmount = .2f, SpecularShine = 16, }; _properties.Add(new LayerProperty("AmbientAmount", _inputEffect)); _properties.Add(new LayerProperty("DiffuseAmount", _inputEffect)); _properties.Add(new LayerProperty("SpecularAmount", _inputEffect)); _properties.Add(new LayerProperty("SpecularShine", _inputEffect)); _properties.Add(new LayerProperty("BrdfType", _inputEffect)); }
private void UpdateLightingProperties(LightingLayer layer) { PropertyInfo info; LightingPropertyPanel.Children.Clear(); SceneLightingEffect lighting = layer.LightingEffect; info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "AmbientAmount"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "DiffuseAmount"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "SpecularAmount"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "SpecularShine"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "ReflectanceModel"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); }