Пример #1
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect"));
            finalCombineEffect    = ToLoadAndUnload(new ImageEffectShader("TripleRhombiCombineShader"));
        }
Пример #2
0
 /// <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;
 }
Пример #3
0
            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);
            }
 /// <summary>
 /// Create a new instance of the class.
 /// </summary>
 /// <param name="context">the context</param>
 public RadiancePrefilteringGGXNoCompute(RenderContext context)
     : base(context, "RadiancePrefilteringGGX")
 {
     shader = new ImageEffectShader("RadiancePrefilteringGGXNoComputeEffect");
     DoNotFilterHighestLevel = true;
     samplingsCount = 1024;
 }
Пример #5
0
 /// <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;
 }
Пример #6
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            effectFirstPass = ToLoadAndUnload(new ImageEffectShader("DepthMinMaxEffect"));
            effectNotFirstPass = ToLoadAndUnload(new ImageEffectShader("DepthMinMaxEffect"));
            readback = ToLoadAndUnload(new ImageReadback<Vector2>());
        }
Пример #7
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect"));
            finalCombineEffect    = ToLoadAndUnload(new ImageEffectShader("McIntoshCombineShader"));
            optimizedEffect       = ToLoadAndUnload(new ImageEffectShader("McIntoshOptimizedEffect"));
        }
Пример #8
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            blur = ToLoadAndUnload(new GaussianBlur());
            flareArtifactEffect  = ToLoadAndUnload(new ImageEffectShader("FlareArtifactEffect"));
            flareReplicateEffect = ToLoadAndUnload(new ImageEffectShader("FlareReplicate"));
        }
Пример #9
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            combiner          = ToLoadAndUnload(new ColorCombiner());
            blur              = ToLoadAndUnload(new GaussianBlur());
            lightStreakEffect = ToLoadAndUnload(new ImageEffectShader("LightStreakEffect", true));
        }
Пример #10
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            effectFirstPass    = ToLoadAndUnload(new ImageEffectShader("DepthMinMaxEffect"));
            effectNotFirstPass = ToLoadAndUnload(new ImageEffectShader("DepthMinMaxEffect"));
            readback           = ToLoadAndUnload(new ImageReadback <Vector2>());
        }
Пример #11
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            blur = ToLoadAndUnload(new GaussianBlur());
            flareArtifactEffect = ToLoadAndUnload(new ImageEffectShader("FlareArtifactEffect"));
            flareReplicateEffect = ToLoadAndUnload(new ImageEffectShader("FlareReplicate"));
        }
Пример #12
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect"));
            finalCombineEffect = ToLoadAndUnload(new ImageEffectShader("McIntoshCombineShader"));
            optimizedEffect = ToLoadAndUnload(new ImageEffectShader("McIntoshOptimizedEffect"));
        }
Пример #13
0
 /// <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);
 }
Пример #14
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            combiner = ToLoadAndUnload(new ColorCombiner());
            blur = ToLoadAndUnload(new GaussianBlur());
            lightStreakEffect = ToLoadAndUnload(new ImageEffectShader("LightStreakEffect"));
        }
        public LambertianPrefilteringSHNoCompute(RenderContext context)
            : base(context, "LambertianPrefilteringSHNoCompute")
        {
            firstPassEffect = new ImageEffectShader("LambertianPrefilteringSHNoComputeEffectPass1");
            secondPassEffect = new ImageEffectShader("LambertianPrefilteringSHNoComputePass2");

            HarmonicOrder = 3;
        }
Пример #16
0
        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"));
        }
Пример #17
0
        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;
            }
        }
Пример #18
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            blurH = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurV = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurH.Initialize(Context);
            blurV.Initialize(Context);

            // Setup Horizontal parameters
            blurH.Parameters.Set(GaussianBlurKeys.VerticalBlur, false);
            blurV.Parameters.Set(GaussianBlurKeys.VerticalBlur, true);
        }
Пример #19
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            transformGroupEffect = new ImageEffectShader(colorTransformGroupEffectName);
            transformGroupEffect.SharedParameterCollections.Add(Parameters);
            transformGroupEffect.Initialize(Context);

            // we are adding parameter collections after as transform parameters should override previous parameters
            transformGroupEffect.ParameterCollections.Add(transformsParameters);

            this.transformContext = new ColorTransformContext(this, Context);
        }
Пример #20
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            blurH = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurV = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurH.Initialize(Context);
            blurV.Initialize(Context);

            // Setup Horizontal parameters
            blurH.Parameters.Set(GaussianBlurKeys.VerticalBlur, false);
            blurV.Parameters.Set(GaussianBlurKeys.VerticalBlur, true);
        }
Пример #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostProcessingEffects"/> class.
 /// </summary>
 public PostProcessingEffects()
 {
     AmbientOcclusion     = new AmbientOcclusion();
     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();
 }
Пример #22
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            coclinearDepthMapEffect  = ToLoadAndUnload(new ImageEffectShader("CoCLinearDepthShader"));
            combineLevelsEffect      = ToLoadAndUnload(new ImageEffectShader("CombineLevelsFromCoCEffect"));
            combineLevelsFrontEffect = ToLoadAndUnload(new ImageEffectShader("CombineFrontCoCEffect"));
            textureScaler            = ToLoadAndUnload(new ImageScaler());
            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);
        }
Пример #23
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            // Use shared SharedParameters for blurH and blurV
            blurH = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurH.SharedParameterCollections.Add(Parameters);
            blurH.Initialize(Context);

            // Setup specific Horizontal parameter for blurH
            blurH.Parameters.Set(GaussianBlurKeys.VerticalBlur, false);

            blurV = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurV.SharedParameterCollections.Add(Parameters);
            blurV.Initialize(Context);
            // Setup specific Vertical parameter for blurV
            blurV.Parameters.Set(GaussianBlurKeys.VerticalBlur, true);
        }
Пример #24
0
        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);
        }
Пример #25
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            // Use shared SharedParameters for blurH and blurV
            blurH = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurH.SharedParameterCollections.Add(Parameters);
            blurH.Initialize(Context);

            // Setup specific Horizontal parameter for blurH
            blurH.Parameters.Set(GaussianBlurKeys.VerticalBlur, false);

            blurV = ToLoadAndUnload(new ImageEffectShader("GaussianBlurEffect"));
            blurV.SharedParameterCollections.Add(Parameters);
            blurV.Initialize(Context);
            // Setup specific Vertical parameter for blurV
            blurV.Parameters.Set(GaussianBlurKeys.VerticalBlur, true);
        }
Пример #26
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            AmbientOcclusion = ToLoadAndUnload(AmbientOcclusion);
            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);
        }
Пример #27
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            cocBlurEffect = ToLoadAndUnload(new ImageEffectShader("CoCMapBlurEffect"));
        }
Пример #28
0
        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());
            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);
        }
Пример #29
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect"));
        }
Пример #30
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            skyboxEffect = ToLoadAndUnload(new ImageEffectShader("SkyboxEffect"));
        }
Пример #31
0
        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"));
            blurH.Initialize(Context);
            blurV.Initialize(Context);

            // Setup Horizontal parameters
            blurH.Parameters.Set(AmbientOcclusionBlurKeys.VerticalBlur, false);
            blurV.Parameters.Set(AmbientOcclusionBlurKeys.VerticalBlur, true);
        }
Пример #32
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            cocBlurEffect = ToLoadAndUnload(new ImageEffectShader("CoCMapBlurEffect"));
        }
Пример #33
0
 /// <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);
 }