예제 #1
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;
 }
예제 #2
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);
            }
예제 #3
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect"));
            finalCombineEffect    = ToLoadAndUnload(new ImageEffectShader("TripleRhombiCombineShader"));
        }
예제 #4
0
파일: Fog.cs 프로젝트: phr00t/FocusEngine
 /// <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);
 }
예제 #5
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            combiner          = ToLoadAndUnload(new ColorCombiner());
            blur              = ToLoadAndUnload(new GaussianBlur());
            lightStreakEffect = ToLoadAndUnload(new ImageEffectShader("LightStreakEffect", true));
        }
예제 #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
 /// <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);
 }
예제 #8
0
 /// <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);
 }
예제 #9
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            blur = ToLoadAndUnload(new GaussianBlur());
            flareArtifactEffect  = ToLoadAndUnload(new ImageEffectShader("FlareArtifactEffect", true));
            flareReplicateEffect = ToLoadAndUnload(new ImageEffectShader("FlareReplicate"));
        }
예제 #10
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            directionalBlurEffect = ToLoadAndUnload(new ImageEffectShader("DepthAwareDirectionalBlurEffect"));
            finalCombineEffect    = ToLoadAndUnload(new ImageEffectShader("McIntoshCombineShader"));
            optimizedEffect       = ToLoadAndUnload(new ImageEffectShader("McIntoshOptimizedEffect"));
        }
예제 #11
0
 /// <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);
 }
예제 #12
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"));
        }
예제 #13
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;
            }
        }
예제 #14
0
 /// <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();
 }
예제 #15
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(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);
        }
예제 #16
0
        /// <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);
        }
예제 #17
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);
        }
예제 #18
0
        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);
        }
예제 #19
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            cocBlurEffect = ToLoadAndUnload(new ImageEffectShader("CoCMapBlurEffect"));
        }