private void CreateGuiControls() { var panel = SampleFramework.AddOptions("Terrain"); SampleHelper.AddCheckBox( panel, "Enable per-pixel holes", false, isChecked => UpdateTerrainMaterial(isChecked)); SampleHelper.AddSlider( panel, "Hole size", "F0", 0, 8, _holeSize, value => { _holeSize = (int)value; UpdateHoleTexture(); }); SampleHelper.AddSlider( panel, "Hole threshold", null, 0, 1, _terrainObject.TerrainNode.HoleThreshold, value => _terrainObject.TerrainNode.HoleThreshold = value); SampleFramework.ShowOptionsWindow("Terrain"); }
// Add GUI controls to the Options window. private void CreateGuiControls() { var sampleFramework = _services.GetInstance <SampleFramework>(); var optionsPanel = sampleFramework.AddOptions("Game Objects"); var panel = SampleHelper.AddGroupBox(optionsPanel, "ProceduralTerrainObject"); SampleHelper.AddSlider( panel, "Noise width", null, 0.1f, 10f, _noiseWidth, value => { _noiseWidth = value; _updateGeometryTexture = true; }); SampleHelper.AddSlider( panel, "Noise height", null, 0, 1000, _noiseHeight, value => { _noiseHeight = value; _updateGeometryTexture = true; }); SampleHelper.AddSlider( panel, "Noise mu", null, 1, 1.16f, _noiseMu, value => { _noiseMu = value; _updateGeometryTexture = true; }); }
private void CreateGuiControls() { var panel = SampleFramework.AddOptions("Facial Animation"); SampleHelper.AddCheckBox(panel, "Play animation", false, PlayAnimation); // Add UI controls for morph targets. var morphTargetsPanel = SampleHelper.AddGroupBox(panel, "Morph Targets"); foreach (var morph in _sintel.MorphWeights) { string name = morph.Key; SampleHelper.AddSlider(morphTargetsPanel, name, null, 0, 1, 0, value => _sintel.MorphWeights[name] = value); } // Add controls for skeleton. var skeletonPanel = SampleHelper.AddGroupBox(panel, "Skeleton"); SampleHelper.AddSlider(skeletonPanel, "Mouth-open", null, 0, 1, 0, value => InterpolatePose(_sintel, _mouthClosedPose, _mouthOpenPose, value)); SampleHelper.AddCheckBox(skeletonPanel, "Draw skeleton", false, b => _drawSkeleton = b); _sliders = panel.GetDescendants().OfType <Slider>().ToArray(); SampleFramework.ShowOptionsWindow("Facial Animation"); }
private void CreateGuiControls() { var panel = SampleFramework.AddOptions("Intersections"); // ----- Light node controls SampleHelper.AddSlider( panel, "Max convexity", "F0", 1, 10, _maxConvexity, value => _maxConvexity = (int)value); SampleHelper.AddSlider( panel, "Downsample factor", "F2", 1, 4, _intersectionRenderer.DownsampleFactor, value => _intersectionRenderer.DownsampleFactor = value); SampleHelper.AddCheckBox( panel, "Use sissor test", _intersectionRenderer.EnableScissorTest, isChecked => _intersectionRenderer.EnableScissorTest = isChecked); SampleFramework.ShowOptionsWindow("Intersections"); }
protected override void OnLoad() { // ----- Register info for "Wind" effect parameter. var graphicsService = _services.GetInstance <IGraphicsService>(); // Tell the graphics service some information about effect parameters with // the name or semantic "Wind". The hint "Global" tells the engine that this // parameter is the same for all scene nodes. var defaultEffectInterpreter = graphicsService.EffectInterpreters.OfType <DefaultEffectInterpreter>().First(); defaultEffectInterpreter.ParameterDescriptions.Add( "Wind", (parameter, i) => new EffectParameterDescription(parameter, "Wind", i, EffectParameterHint.Global)); // Tell the engine how to create an effect parameter binding for "Wind" which // automatically sets the effect parameter value. var defaultEffectBinder = graphicsService.EffectBinders.OfType <DefaultEffectBinder>().First(); defaultEffectBinder.Vector3Bindings.Add( "Wind", (effect, parameter, data) => new DelegateParameterBinding <Vector3>(effect, parameter, (binding, context) => (Vector3)Wind)); // The delegate returns the Wind property. // ----- Add GUI controls to the Options window. var sampleFramework = _services.GetInstance <SampleFramework>(); var optionsPanel = sampleFramework.AddOptions("Game Objects"); var panel = SampleHelper.AddGroupBox(optionsPanel, "Wind"); SampleHelper.AddSlider( panel, "Max speed", "F2", 0, 30, MaxSpeed, value => MaxSpeed = value, "0 = no wind, 30 = violent storm"); SampleHelper.AddSlider( panel, "Speed variation", "F2", 0, 1, SpeedVariation, value => SpeedVariation = value, "0 wind blows only with max speed; > 0 wind vary the speed."); SampleHelper.AddSlider( panel, "Direction variation", "F2", 0, 1, DirectionVariation, value => DirectionVariation = value, "0 wind blows only in one direction; > 0 wind can change direction"); }
private void CreateGuiControls() { var panel = SampleFramework.AddOptions("Shadows"); // ----- Light node controls var lightNodePanel = SampleHelper.AddGroupBox(panel, "Light Nodes"); SampleHelper.AddDropDown( lightNodePanel, "Light type", new[] { "Spotlight", "PointLight" }, 0, selectedItem => { bool enableSpotlight = (selectedItem == "Spotlight"); _spotlightNode.IsEnabled = enableSpotlight; _pointLightNode.IsEnabled = !enableSpotlight; }); SampleHelper.AddSlider( lightNodePanel, "Range", "F2", 1, 30, 10, value => { _spotlight.Range = value; _pointLight.Range = value; }); SampleHelper.AddSlider( lightNodePanel, "Y position", "F2", 0, 10, 1, value => { foreach (var node in new[] { _spotlightNode, _pointLightNode }) { var pose = node.PoseWorld; pose.Position.Y = value; node.PoseWorld = pose; } }); SampleHelper.AddSlider( lightNodePanel, "X rotation", "F0", -90, 90, 1, value => { var pose = _spotlightNode.PoseWorld; pose.Orientation = Matrix.CreateRotationX(MathHelper.ToRadians(value)); _spotlightNode.PoseWorld = pose; }); SampleHelper.AddSlider( lightNodePanel, "Spotlight angle", "F2", 1, 89, MathHelper.ToDegrees(_spotlight.CutoffAngle), value => { float angle = MathHelper.ToRadians(value); _spotlight.FalloffAngle = 0.8f * angle; _spotlight.CutoffAngle = angle; }); // ----- Shadow controls var shadowPanel = SampleHelper.AddGroupBox(panel, "Shadow"); SampleHelper.AddSlider( shadowPanel, "Shadow map resolution", "F0", 16, 1024, _standardShadow.PreferredSize, value => { _standardShadow.PreferredSize = (int)value; _cubeMapShadow.PreferredSize = (int)value; }); SampleHelper.AddCheckBox( shadowPanel, "Prefer 16 bit", _standardShadow.Prefer16Bit, isChecked => { _standardShadow.Prefer16Bit = isChecked; _cubeMapShadow.Prefer16Bit = isChecked; }); SampleHelper.AddSlider( shadowPanel, "Depth bias", "F2", 0, 10, _standardShadow.DepthBias, value => { _standardShadow.DepthBias = value; _cubeMapShadow.DepthBias = value; }); SampleHelper.AddSlider( shadowPanel, "Normal offset", "F2", 0, 10, _standardShadow.NormalOffset, value => { _standardShadow.NormalOffset = value; _cubeMapShadow.NormalOffset = value; }); SampleHelper.AddSlider( shadowPanel, "Number of samples", "F0", -1, 32, _standardShadow.NumberOfSamples, value => { _standardShadow.NumberOfSamples = (int)value; _cubeMapShadow.NumberOfSamples = (int)value; }); SampleHelper.AddSlider( shadowPanel, "Filter radius", "F2", 0, 10, _standardShadow.FilterRadius, value => { _standardShadow.FilterRadius = value; _cubeMapShadow.FilterRadius = value; }); SampleHelper.AddSlider( shadowPanel, "Jitter resolution", "F0", 1, 10000, _standardShadow.JitterResolution, value => { _standardShadow.JitterResolution = value; _cubeMapShadow.JitterResolution = value; }); SampleFramework.ShowOptionsWindow("Shadows"); }
private void CreateGuiControls() { var panel = SampleFramework.AddOptions("Vegetation"); var swayPanel = SampleHelper.AddGroupBox(panel, "Swaying"); SampleHelper.AddSlider( swayPanel, "Wind wave frequency", "F2", 0, 0.5f, _windWaveFrequency, value => { _windWaveFrequency = value; UpdateMaterialEffectParameters(); }); SampleHelper.AddSlider( swayPanel, "Wind wave randomness", "F2", 0, 1, _windWaveRandomness, value => { _windWaveRandomness = value; UpdateMaterialEffectParameters(); }); SampleHelper.AddSlider( swayPanel, "Trunk frequency multiplier", "F2", 0, 10, _trunkFrequencyMultiplier, value => { _trunkFrequencyMultiplier = value; UpdateMaterialEffectParameters(); }); SampleHelper.AddSlider( swayPanel, "Branch frequency multiplier", "F2", 0, 10, _branchFrequencyMultiplier, value => { _branchFrequencyMultiplier = value; UpdateMaterialEffectParameters(); }); SampleHelper.AddSlider( swayPanel, "Trunk scale multiplier", "F2", 0, 10, _trunkScaleMultiplier, value => { _trunkScaleMultiplier = value; UpdateMaterialEffectParameters(); }); SampleHelper.AddSlider( swayPanel, "Branch scale multiplier", "F2", 0, 10, _branchScaleMultiplier, value => { _branchScaleMultiplier = value; UpdateMaterialEffectParameters(); }); SampleHelper.AddSlider( swayPanel, "Leaf scale multiplier", "F2", 0, 10, _leafScaleMultiplier, value => { _leafScaleMultiplier = value; UpdateMaterialEffectParameters(); }); SampleHelper.AddDropDown( swayPanel, "Render vertex color", EnumHelper.GetValues(typeof(VertexColorChannel)), 0, item => { _vertexColorChannel = (VertexColorChannel)item; UpdateMaterialEffectParameters(); }); SampleHelper.AddCheckBox( panel, "Enable translucency", true, isChecked => { _enableTranslucency = isChecked; UpdateMaterialEffectParameters(); }); SampleHelper.AddCheckBox( panel, "Draw debug info", _drawDebugInfo, isChecked => _drawDebugInfo = isChecked); SampleFramework.ShowOptionsWindow("Vegetation"); }
private void CreateGuiControls() { var panel = SampleFramework.AddOptions("IBL"); SampleHelper.AddButton( panel, "Update environment maps", () => _updateEnvironmentMaps = true, null); for (int i = 0; i < _lightNodes.Length; i++) { int index = i; SampleHelper.AddCheckBox( panel, "Enable image-based light " + i, true, isChecked => { _lightNodes[index].IsEnabled = isChecked; }); } SampleHelper.AddCheckBox( panel, "Colorize image-based lights to show influence zones", false, isChecked => { if (isChecked) { _imageBasedLights[0].Color = new Vector3F(1, 0, 0); _imageBasedLights[1].Color = new Vector3F(0, 1, 0); _imageBasedLights[2].Color = new Vector3F(0, 0, 1); } else { _imageBasedLights[0].Color = new Vector3F(1); _imageBasedLights[1].Color = new Vector3F(1); _imageBasedLights[2].Color = new Vector3F(1); } }); SampleHelper.AddCheckBox( panel, "Enable localized reflections", true, isChecked => { _imageBasedLights[1].EnableLocalizedReflection = isChecked; _imageBasedLights[2].EnableLocalizedReflection = isChecked; }); SampleHelper.AddSlider( panel, "Fade-out range", "F2", 0, 1, _imageBasedLights[1].FalloffRange, value => { _imageBasedLights[1].FalloffRange = value; _imageBasedLights[2].FalloffRange = value; }); SampleFramework.ShowOptionsWindow("IBL"); }
// Add GUI controls to the Options window. private void CreateGuiControls() { var sampleFramework = _services.GetInstance<SampleFramework>(); var optionsPanel = sampleFramework.AddOptions("Game Objects"); var panel = SampleHelper.AddGroupBox(optionsPanel, "TerrainObject"); SampleHelper.AddCheckBox( panel, "Draw wireframe", _graphicsScreen.TerrainRenderer.DrawWireFrame, isChecked => _graphicsScreen.TerrainRenderer.DrawWireFrame = isChecked); SampleHelper.AddCheckBox( panel, "Show clipmaps", _showClipmaps, isChecked => _showClipmaps = isChecked); SampleHelper.AddSlider( panel, "Min height", null, -500, 0, _minHeight, value => { _minHeight = value; _updateGeometryTexture = true; }); SampleHelper.AddSlider( panel, "Max height", null, 0, 2000, _maxHeight, value => { _maxHeight = value; _updateGeometryTexture = true; }); SampleHelper.AddCheckBox( panel, "Smooth height map", _smoothness > 0, isChecked => { _smoothness = isChecked ? 1e6f : 0; _updateGeometryTexture = true; }); SampleHelper.AddSlider( panel, "Height map cell size", null, 0.5f, 4f, TerrainNode.Terrain.Tiles[0].CellSize, value => { foreach (var tile in TerrainNode.Terrain.Tiles) tile.CellSize = value; _updateGeometryTexture = true; }); SampleHelper.AddCheckBox( panel, "Nearest neighbor mipmaps", _useNearestNeighborMipmaps, isChecked => { _useNearestNeighborMipmaps = isChecked; _updateGeometryTexture = true; }); var texelsPerLevelList = new List<int> { 64, 128, 256 }; SampleHelper.AddDropDown( panel, "Cells per level", texelsPerLevelList, texelsPerLevelList.IndexOf(TerrainNode.BaseClipmap.CellsPerLevel), value => TerrainNode.BaseClipmap.CellsPerLevel = value); SampleHelper.AddSlider( panel, "Number of levels", "F0", 1, 6, TerrainNode.BaseClipmap.NumberOfLevels, value => TerrainNode.BaseClipmap.NumberOfLevels = (int)value); var detailTexelsPerLevelList = new List<int> { 512, 1024, 1365 }; #else var detailTexelsPerLevelList = new List<int> { 512, 1024, 1365, 2048 }; SampleHelper.AddDropDown( panel, "Detail clipmap cells per level", detailTexelsPerLevelList, detailTexelsPerLevelList.IndexOf(TerrainNode.DetailClipmap.CellsPerLevel), value => { TerrainNode.DetailClipmap.CellsPerLevel = value; _updateDetailClipmapCellSizes = true; }); SampleHelper.AddSlider( panel, "Number of detail clipmap levels", "F0", 1, 9, TerrainNode.DetailClipmap.NumberOfLevels, value => { TerrainNode.DetailClipmap.NumberOfLevels = (int)value; _updateDetailClipmapCellSizes = true; }); SampleHelper.AddSlider( panel, "Mipmap bias", null, -10, 10, TerrainNode.DetailClipmap.LevelBias, value => TerrainNode.DetailClipmap.LevelBias = value); SampleHelper.AddCheckBox( panel, "Enable mipmap", TerrainNode.DetailClipmap.EnableMipMap, isChecked => TerrainNode.DetailClipmap.EnableMipMap = isChecked); SampleHelper.AddCheckBox( panel, "Enable anisotropic filtering", TerrainNode.DetailClipmap.EnableAnisotropicFiltering, isChecked => TerrainNode.DetailClipmap.EnableAnisotropicFiltering = isChecked); }
protected override void OnLoad() { _scene = _services.GetInstance <IScene>(); // Get a bounding shape for the cells. We use a box with the cell size and // make it bigger by some arbitrary values. The boxes must be bigger because // mesh instances can be placed on the cell boundary and when they are animated // tree branches can sway outside the cell bounds. var meshAabb = _mesh.BoundingShape.GetAabb(); float meshWidth = new Vector2F(meshAabb.Extent.X, meshAabb.Extent.Z).Length * 1.5f; float meshHeight = meshAabb.Extent.Y * 1.7f; var boxShape = new BoxShape(_cellSize + meshWidth, meshHeight, _cellSize + meshWidth); // Create one MeshInstancingNode per cell and add random instances. _nodes = new MeshInstancingNode <InstanceData> [_numberOfCellsX, _numberOfCellsZ]; float xOrigin = -(_numberOfCellsX * _cellSize) / 2; float zOrigin = -(_numberOfCellsZ * _cellSize) / 2; var random = new Random(_randomSeed); for (int x = 0; x < _numberOfCellsX; x++) { for (int z = 0; z < _numberOfCellsZ; z++) { var instances = new InstanceData[_numberOfInstancesPerCell]; for (int i = 0; i < instances.Length; i++) { Vector3F scale = new Vector3F(random.NextFloat(0.5f, 1.5f)); Pose pose = new Pose(new Vector3F(xOrigin + x * _cellSize + random.NextFloat(0, _cellSize), 0, zOrigin + z * _cellSize + random.NextFloat(0, _cellSize)), Matrix33F.CreateRotationY(random.NextFloat(0, 10))); Vector4F color = new Vector4F(1); instances[i] = new InstanceData(scale, pose, color); } _nodes[x, z] = new MeshInstancingNode <InstanceData>(_mesh, instances) { PoseLocal = new Pose(new Vector3F(xOrigin + (0.5f + x) * _cellSize, boxShape.WidthY / 2, zOrigin + (0.5f + z) * _cellSize)), Shape = boxShape, CastsShadows = _castsShadows, }; _scene.Children.Add(_nodes[x, z]); } } UpdateLodDistances(); // ----- Add GUI controls to the Options window. var sampleFramework = _services.GetInstance <SampleFramework>(); var optionsPanel = sampleFramework.AddOptions("Game Objects"); var panel = SampleHelper.AddGroupBox(optionsPanel, "VegetationObject " + Name); SampleHelper.AddSlider( panel, "Min distance", "F2", 0, 100, MinDistance, value => MinDistance = value); SampleHelper.AddSlider( panel, "Max distance", "F2", 0, 100, MaxDistance, value => MaxDistance = value); }
private void CreateGuiControls() { var panel = SampleFramework.AddOptions("Terrain"); // TerrainMaterialLayer.BlendRange controls how fast one layer fades out. SampleHelper.AddSlider( panel, "Blend range", null, 0, 1, _terrainTile.Layers.OfType <TerrainMaterialLayer>().First().BlendRange, value => { foreach (var materialLayer in _terrainTile.Layers.OfType <TerrainMaterialLayer>()) { materialLayer.BlendRange = value; } _terrainTile.Invalidate(); }); // TerrainMaterialLayer.BlendThreshold defines the threshold value for the blend texture. // Layers are drawn where their blend texture value is greater than the threshold. // Changing the threshold value can be used, for example, to decrease/increase the snow cover. SampleHelper.AddSlider( panel, "Snow blend threshold", null, -1, 1, ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendThreshold, value => { ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendThreshold = value; _terrainTile.Invalidate(); }); // The TerrainMaterialLayer with the rock texture contains a height map. The height values // can be used to modify the blending, e.g. to show more gravel in the creases of the rock. SampleHelper.AddSlider( panel, "Rock height influence", null, -1, 1, ((TerrainMaterialLayer)_terrainTile.Layers[1]).BlendHeightInfluence, value => { ((TerrainMaterialLayer)_terrainTile.Layers[1]).BlendHeightInfluence = value; _terrainTile.Invalidate(); }); // The layer blending can be modified by noise to make the transition borders irregular. SampleHelper.AddSlider( panel, "Snow noise influence", null, 0, 1, ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendNoiseInfluence, value => { ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendNoiseInfluence = value; _terrainTile.Invalidate(); }); SampleHelper.AddSlider( panel, "Snow noise tile size", null, 1, 100, ((TerrainMaterialLayer)_terrainTile.Layers[2]).NoiseTileSize, value => { ((TerrainMaterialLayer)_terrainTile.Layers[2]).NoiseTileSize = value; _terrainTile.Invalidate(); }); SampleFramework.ShowOptionsWindow("Terrain"); }
private void CreateGuiControls() { var optionsPanel = SampleFramework.AddOptions("Shadows"); // ----- Shadow controls var shadowPanel = SampleHelper.AddGroupBox(optionsPanel, "Shadow"); SampleHelper.AddSlider( shadowPanel, "Shadow map resolution", "F0", 16, 1024, _cascadedShadow.PreferredSize, value => { _cascadedShadow.PreferredSize = (int)value; _cascadedShadow.ShadowMap.SafeDispose(); _cascadedShadow.ShadowMap = null; }); SampleHelper.AddCheckBox( shadowPanel, "Prefer 16 bit", _cascadedShadow.Prefer16Bit, isChecked => { _cascadedShadow.Prefer16Bit = isChecked; _cascadedShadow.ShadowMap.SafeDispose(); _cascadedShadow.ShadowMap = null; }); SampleHelper.AddSlider( shadowPanel, "Number of cascades", "F0", 1, 4, _cascadedShadow.NumberOfCascades, value => { _cascadedShadow.NumberOfCascades = (int)value; switch ((int)value) { case 1: _cascadedShadow.Distances = new Vector4(80); break; case 2: _cascadedShadow.Distances = new Vector4(20, 80, 80, 80); break; case 3: _cascadedShadow.Distances = new Vector4(12, 20, 80, 80); break; case 4: _cascadedShadow.Distances = new Vector4(4, 12, 20, 80); break; } _cascadedShadow.ShadowMap.SafeDispose(); _cascadedShadow.ShadowMap = null; }); SampleHelper.AddSlider( shadowPanel, "Depth bias", "F2", 0, 10, _cascadedShadow.DepthBias.X, value => _cascadedShadow.DepthBias = new Vector4(value)); SampleHelper.AddSlider( shadowPanel, "Normal offset", "F2", 0, 10, _cascadedShadow.NormalOffset.X, value => _cascadedShadow.NormalOffset = new Vector4(value)); SampleHelper.AddSlider( shadowPanel, "Number of samples", "F0", -1, 32, _cascadedShadow.NumberOfSamples, value => _cascadedShadow.NumberOfSamples = (int)value); SampleHelper.AddSlider( shadowPanel, "Filter radius", "F2", 0, 10, _cascadedShadow.FilterRadius, value => _cascadedShadow.FilterRadius = value); SampleHelper.AddSlider( shadowPanel, "Jitter resolution", "F0", 1, 10000, _cascadedShadow.JitterResolution, value => _cascadedShadow.JitterResolution = value); SampleHelper.AddSlider( shadowPanel, "Fade-out range", "F2", 0, 1, _cascadedShadow.FadeOutRange, value => _cascadedShadow.FadeOutRange = value); SampleHelper.AddSlider( shadowPanel, "Shadow fog", "F2", 0, 1, _cascadedShadow.ShadowFog, value => _cascadedShadow.ShadowFog = value); SampleHelper.AddDropDown( shadowPanel, "Cascade split selection", new[] { ShadowCascadeSelection.Fast, ShadowCascadeSelection.Best, ShadowCascadeSelection.BestDithered, }, (int)_cascadedShadow.CascadeSelection, item => _cascadedShadow.CascadeSelection = item); SampleHelper.AddCheckBox( shadowPanel, "Visualize cascades", _cascadedShadow.VisualizeCascades, isChecked => _cascadedShadow.VisualizeCascades = isChecked); // ----- Shadow map caching var cachingPanel = SampleHelper.AddGroupBox(optionsPanel, "Shadow map caching"); cachingPanel.Children.Add(new TextBlock { Text = "Set a value > 0 to update shadow map less frequently.", Margin = new Vector4(0, 0, SampleHelper.Margin, 0), }); SampleHelper.AddSlider( cachingPanel, "Cascade 0", "F0", 0, 10, _targetSkippedFrames[0], value => _targetSkippedFrames[0] = (int)value); SampleHelper.AddSlider( cachingPanel, "Cascade 1", "F0", 0, 10, _targetSkippedFrames[1], value => _targetSkippedFrames[1] = (int)value); SampleHelper.AddSlider( cachingPanel, "Cascade 2", "F0", 0, 10, _targetSkippedFrames[2], value => _targetSkippedFrames[2] = (int)value); SampleHelper.AddSlider( cachingPanel, "Cascade 3", "F0", 0, 10, _targetSkippedFrames[3], value => _targetSkippedFrames[3] = (int)value); SampleFramework.ShowOptionsWindow("Shadows"); }
private void CreateGuiControls() { var optionsPanel = SampleFramework.AddOptions("Shadows"); SampleHelper.AddSlider( optionsPanel, "Shadow map resolution", "F0", 16, 4096, _varianceShadow.PreferredSize, value => { _varianceShadow.PreferredSize = (int)value; _varianceShadow.ShadowMap.SafeDispose(); _varianceShadow.ShadowMap = null; }); SampleHelper.AddCheckBox( optionsPanel, "Prefer 16 bit per channel", _varianceShadow.Prefer16Bit, isChecked => { _varianceShadow.Prefer16Bit = isChecked; _varianceShadow.ShadowMap.SafeDispose(); _varianceShadow.ShadowMap = null; }); SampleHelper.AddSlider( optionsPanel, "Min variance", "F4", 0, 0.001f, _varianceShadow.MinVariance, value => { _varianceShadow.MinVariance = value; _updateShadowMap = true; }); SampleHelper.AddSlider( optionsPanel, "Light bleeding reduction", "F2", 0, 0.999f, _varianceShadow.LightBleedingReduction, value => { _varianceShadow.LightBleedingReduction = value; _updateShadowMap = true; }); SampleHelper.AddCheckBox( optionsPanel, "Blur shadow map", _varianceShadow.Filter.Enabled, isChecked => { _varianceShadow.Filter.Enabled = isChecked; _updateShadowMap = true; }); SampleFramework.ShowOptionsWindow("Shadows"); }