/// <summary> /// Initializes a new instance of the <see cref="Afterimage"/> class. /// </summary> public Afterimage() { bloomAfterimageShader = new ImageEffectShader("BloomAfterimageShader"); bloomAfterimageCombineShader = new ImageEffectShader("BloomAfterimageCombineShader"); FadeOutSpeed = 0.9f; Sensitivity = 0.1f; }
public GaussianBlurShader(GaussianBlur gaussianBlur, int radius) { Radius = radius; this.gaussianBlur = gaussianBlur; // Craete ImageEffectShader blurH = gaussianBlur.ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect", true)); blurV = gaussianBlur.ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect", true)); blurH.Initialize(gaussianBlur.Context); blurV.Initialize(gaussianBlur.Context); // Setup Horizontal parameters blurH.Parameters.Set(GaussianBlurKeys.VerticalBlur, false); blurV.Parameters.Set(GaussianBlurKeys.VerticalBlur, true); var size = radius * 2 + 1; nameGaussianBlurH = string.Format("GaussianBlurH{0}x{0}", size); nameGaussianBlurV = string.Format("GaussianBlurV{0}x{0}", size); // TODO: cache if necessary offsetsWeights = GaussianUtil.Calculate1D(this.Radius, gaussianBlur.SigmaRatio); // Update permutation parameters blurH.Parameters.Set(GaussianBlurKeys.Count, offsetsWeights.Length); blurV.Parameters.Set(GaussianBlurKeys.Count, offsetsWeights.Length); blurH.EffectInstance.UpdateEffect(gaussianBlur.Context.GraphicsDevice); blurV.EffectInstance.UpdateEffect(gaussianBlur.Context.GraphicsDevice); // Update parameters blurH.Parameters.Set(GaussianBlurShaderKeys.OffsetsWeights, offsetsWeights); blurV.Parameters.Set(GaussianBlurShaderKeys.OffsetsWeights, offsetsWeights); }
protected override void InitializeCore() { base.InitializeCore(); directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect")); finalCombineEffect = ToLoadAndUnload(new ImageEffectShader("TripleRhombiCombineShader")); }
/// <summary> /// Initializes a new instance of the <see cref="Fog"/> class. /// </summary> /// <param name="brightPassShaderName">Name of the bright pass shader.</param> public Fog(string ShaderName) : base(ShaderName) { if (ShaderName == null) { throw new ArgumentNullException("fogFilterName"); } fogFilter = new ImageEffectShader(ShaderName); }
protected override void InitializeCore() { base.InitializeCore(); combiner = ToLoadAndUnload(new ColorCombiner()); blur = ToLoadAndUnload(new GaussianBlur()); lightStreakEffect = ToLoadAndUnload(new ImageEffectShader("LightStreakEffect", true)); }
protected override void InitializeCore() { base.InitializeCore(); effectFirstPass = ToLoadAndUnload(new ImageEffectShader("DepthMinMaxEffect")); effectNotFirstPass = ToLoadAndUnload(new ImageEffectShader("DepthMinMaxEffect")); readback = ToLoadAndUnload(new ImageReadback <Vector2>()); }
/// <summary> /// Initializes a new instance of the <see cref="BrightFilter"/> class. /// </summary> /// <param name="brightPassShaderName">Name of the bright pass shader.</param> public BrightFilter(string brightPassShaderName) : base(brightPassShaderName) { if (brightPassShaderName == null) { throw new ArgumentNullException("brightPassShaderName"); } brightPassFilter = new ImageEffectShader(brightPassShaderName); }
/// <summary> /// Initializes a new instance of the <see cref="VRFOV"/> class. /// </summary> /// <param name="brightPassShaderName">Name of the bright pass shader.</param> public VRFOV(string ShaderName) : base(ShaderName) { if (ShaderName == null) { throw new ArgumentNullException("vrfovFilterName"); } vrfovFilter = new ImageEffectShader(ShaderName); }
protected override void InitializeCore() { base.InitializeCore(); blur = ToLoadAndUnload(new GaussianBlur()); flareArtifactEffect = ToLoadAndUnload(new ImageEffectShader("FlareArtifactEffect", true)); flareReplicateEffect = ToLoadAndUnload(new ImageEffectShader("FlareReplicate")); }
protected override void InitializeCore() { base.InitializeCore(); directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect")); finalCombineEffect = ToLoadAndUnload(new ImageEffectShader("McIntoshCombineShader")); optimizedEffect = ToLoadAndUnload(new ImageEffectShader("McIntoshOptimizedEffect")); }
/// <summary> /// Initializes a new instance of the <see cref="CartoonFilter"/> class. /// </summary> /// <param name="brightPassShaderName">Name of the bright pass shader.</param> public Outline(string ShaderName) : base(ShaderName) { if (ShaderName == null) { throw new ArgumentNullException("outlineFilterName"); } outlineFilter = new ImageEffectShader(ShaderName); }
protected override void InitializeCore() { base.InitializeCore(); depthPassShader = ToLoadAndUnload(new ImageEffectShader("SSLRDepthPass")); blurPassShaderH = ToLoadAndUnload(new ImageEffectShader("SSLRBlurPassEffectH")); blurPassShaderV = ToLoadAndUnload(new ImageEffectShader("SSLRBlurPassEffectV")); rayTracePassShader = ToLoadAndUnload(new ImageEffectShader("SSLRRayTracePass")); resolvePassShader = ToLoadAndUnload(new ImageEffectShader("SSLRResolvePassEffect")); temporalPassShader = ToLoadAndUnload(new ImageEffectShader("SSLRTemporalPass")); combinePassShader = ToLoadAndUnload(new ImageEffectShader("SSLRCombinePass")); }
protected override void InitializeCore() { base.InitializeCore(); // Light accumulation shader lightShaftsEffectShader = ToLoadAndUnload(new ImageEffectShader("LightShaftsEffect")); // Additive blending shader applyLightEffectShader = ToLoadAndUnload(new ImageEffectShader("AdditiveLightEffect")); applyLightEffectShader.BlendState = new BlendStateDescription(Blend.One, Blend.One); minmaxVolumeEffectShader = new DynamicEffectInstance("VolumeMinMaxShader"); minmaxVolumeEffectShader.Initialize(Context.Services); blur = ToLoadAndUnload(new GaussianBlur()); // Need the shadow map renderer in order to render light shafts var meshRenderFeature = Context.RenderSystem.RenderFeatures.OfType <MeshRenderFeature>().FirstOrDefault(); if (meshRenderFeature == null) { throw new InvalidOperationException("Missing mesh render feature"); } var forwardLightingFeature = meshRenderFeature.RenderFeatures.OfType <ForwardLightingRenderFeature>().FirstOrDefault(); if (forwardLightingFeature == null) { throw new InvalidOperationException("Missing forward lighting render feature"); } shadowMapRenderer = forwardLightingFeature.ShadowMapRenderer; for (int i = 0; i < 2; ++i) { var minmaxPipelineState = new MutablePipelineState(Context.GraphicsDevice); minmaxPipelineState.State.SetDefaults(); minmaxPipelineState.State.BlendState.RenderTarget0.BlendEnable = true; minmaxPipelineState.State.BlendState.RenderTarget0.ColorSourceBlend = Blend.One; minmaxPipelineState.State.BlendState.RenderTarget0.ColorDestinationBlend = Blend.One; minmaxPipelineState.State.BlendState.RenderTarget0.ColorBlendFunction = i == 0 ? BlendFunction.Min : BlendFunction.Max; minmaxPipelineState.State.BlendState.RenderTarget0.ColorWriteChannels = i == 0 ? ColorWriteChannels.Red : ColorWriteChannels.Green; minmaxPipelineState.State.DepthStencilState.DepthBufferEnable = false; minmaxPipelineState.State.DepthStencilState.DepthBufferWriteEnable = false; minmaxPipelineState.State.RasterizerState.DepthClipEnable = true; minmaxPipelineState.State.RasterizerState.CullMode = i == 0 ? CullMode.Back : CullMode.Front; minmaxPipelineStates[i] = minmaxPipelineState; } }
/// <summary> /// Initializes a new instance of the <see cref="PostProcessingEffects"/> class. /// </summary> public PostProcessingEffects() { AmbientOcclusion = new AmbientOcclusion(); LocalReflections = new LocalReflections(); DepthOfField = new DepthOfField(); luminanceEffect = new LuminanceEffect(); BrightFilter = new BrightFilter(); Bloom = new Bloom(); LightStreak = new LightStreak(); LensFlare = new LensFlare(); Antialiasing = new FXAAEffect(); rangeCompress = new ImageEffectShader("RangeCompressorShader"); rangeDecompress = new ImageEffectShader("RangeDecompressorShader"); colorTransformsGroup = new ColorTransformGroup(); }
protected override void InitializeCore() { base.InitializeCore(); coclinearDepthMapEffect = ToLoadAndUnload(new ImageEffectShader("CoCLinearDepthShader")); combineLevelsEffect = ToLoadAndUnload(new ImageEffectShader("CombineLevelsFromCoCEffect")); combineLevelsFrontEffect = ToLoadAndUnload(new ImageEffectShader("CombineFrontCoCEffect")); combineLevelsFrontEffect.BlendState = BlendStates.AlphaBlend; textureScaler = ToLoadAndUnload(new ImageScaler(SamplingPattern.Expanded)); cocMapBlur = ToLoadAndUnload(new CoCMapBlur()); thresholdAlphaCoC = ToLoadAndUnload(new ImageEffectShader("ThresholdAlphaCoC")); thresholdAlphaCoCFront = ToLoadAndUnload(new ImageEffectShader("ThresholdAlphaCoCFront")); pointDepthShader = ToLoadAndUnload(new ImageEffectShader("PointDepth")); depthReadBack = ToLoadAndUnload(new ImageReadback <Half>()); depthCenter1x1 = Texture.New2D(GraphicsDevice, 1, 1, 1, PixelFormat.R16_Float, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this); }
/// <inheritdoc/> protected override void InitializeCore() { base.InitializeCore(); transformGroupEffect = new ImageEffectShader(colorTransformGroupEffectName); // TODO GRAPHICS REFACTOR //transformGroupEffect.SharedParameterCollections.Add(Parameters); transformGroupEffect.Initialize(Context); Parameters = transformGroupEffect.Parameters; // we are adding parameter collections after as transform parameters should override previous parameters // TODO GRAPHICS REFACTOR //transformGroupEffect.ParameterCollections.Add(transformsParameters); this.transformContext = new ColorTransformContext(this, Context); }
protected override void InitializeCore() { base.InitializeCore(); aoApplyImageEffect = ToLoadAndUnload(new ImageEffectShader("ApplyAmbientOcclusionShader")); aoRawImageEffect = ToLoadAndUnload(new ImageEffectShader("AmbientOcclusionRawAOEffect")); aoRawImageEffect.Initialize(Context); blurH = ToLoadAndUnload(new ImageEffectShader("AmbientOcclusionBlurEffect")); blurV = ToLoadAndUnload(new ImageEffectShader("AmbientOcclusionBlurEffect", true)); blurH.Initialize(Context); blurV.Initialize(Context); // Setup Horizontal parameters blurH.Parameters.Set(AmbientOcclusionBlurKeys.VerticalBlur, false); blurV.Parameters.Set(AmbientOcclusionBlurKeys.VerticalBlur, true); }
protected override void InitializeCore() { base.InitializeCore(); AmbientOcclusion = ToLoadAndUnload(AmbientOcclusion); LocalReflections = ToLoadAndUnload(LocalReflections); DepthOfField = ToLoadAndUnload(DepthOfField); luminanceEffect = ToLoadAndUnload(luminanceEffect); BrightFilter = ToLoadAndUnload(BrightFilter); Bloom = ToLoadAndUnload(Bloom); LightStreak = ToLoadAndUnload(LightStreak); LensFlare = ToLoadAndUnload(LensFlare); //this can be null if no SSAA is selected in the editor if (Antialiasing != null) { Antialiasing = ToLoadAndUnload(Antialiasing); } rangeCompress = ToLoadAndUnload(rangeCompress); rangeDecompress = ToLoadAndUnload(rangeDecompress); colorTransformsGroup = ToLoadAndUnload(colorTransformsGroup); }
protected override void InitializeCore() { base.InitializeCore(); cocBlurEffect = ToLoadAndUnload(new ImageEffectShader("CoCMapBlurEffect")); }