//EffectParameter PcolorMap; //EffectParameter PlightMap; #endregion #region IDeferredFinalCombination Members public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, bool useFloatBuffer, bool saveToTexture) { this.useFloatBuffer = useFloatBuffer; this.ginfo = ginfo; this.saveToTexture = saveToTexture; finalCombineEffect = manager.GetAsset <Effect>("CombineFinal", true); PhalfPixel = finalCombineEffect.Parameters["halfPixel"]; PambientColor = finalCombineEffect.Parameters["ambientColor"]; //PEXTRA1 = finalCombineEffect.Parameters["EXTRA1"]; //PcolorMap = finalCombineEffect.Parameters["colorMap"]; //PlightMap = finalCombineEffect.Parameters["lightMap"]; PhalfPixel.SetValue(ginfo.HalfPixel); if (saveToTexture) { if (useFloatBuffer) { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } else { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } } }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, Color BackGroundColor, bool useFloatBuffer) { this.useFloatBuffer = useFloatBuffer; normalRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, false, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); depthRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, false, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); //lightOclusionRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); clearBufferEffect = manager.GetAsset <Effect>("PrePass2/ClearGBuffer"); }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, bool cullPointLight, bool useFloatingBufferForLightning) { _lightAddBlendState = new BlendState() { AlphaSourceBlend = Blend.One, ColorSourceBlend = Blend.One, AlphaDestinationBlend = Blend.One, ColorDestinationBlend = Blend.One, }; this.ginfo = ginfo; this.cullPointLight = cullPointLight; if (useFloatingBufferForLightning) { lightRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); samplerState = SamplerState.PointClamp; } else { lightRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); samplerState = ginfo.SamplerState; } directionalLightEffect = manager.GetAsset <Effect>("DirectionalLight", true); pointLightEffect = manager.GetAsset <Effect>("PointLight", true); sphereModel = new SimpleModel(factory, "Dsphere", true); spotLightEffect = manager.GetAsset <Effect>("SpotLight", true); spotLightEffect.Parameters["halfPixel"].SetValue(ginfo.HalfPixel); pointLightEffect.Parameters["halfPixel"].SetValue(ginfo.HalfPixel); //DirectionalcolorMap = directionalLightEffect.Parameters["colorMap"]; //DirectionalnormalMap = directionalLightEffect.Parameters["normalMap"]; //DirectionaldepthMap = directionalLightEffect.Parameters["depthMap"]; DirectionalInvertViewProjection = directionalLightEffect.Parameters["InvertViewProjection"]; DirectionalhalfPixel = directionalLightEffect.Parameters["halfPixel"]; DirectionalcameraPosition = directionalLightEffect.Parameters["cameraPosition"]; DirectionallightDirection = directionalLightEffect.Parameters["lightDirection"]; DirectionalColor = directionalLightEffect.Parameters["Color"]; DirectionallightIntensity = directionalLightEffect.Parameters["lightIntensity"]; //PointcolorMap = pointLightEffect.Parameters["colorMap"]; //PointnormalMap = pointLightEffect.Parameters["normalMap"]; //PointdepthMap = pointLightEffect.Parameters["depthMap"]; PointProjection = pointLightEffect.Parameters["Projection"]; PointView = pointLightEffect.Parameters["View"]; PointInvertViewProjection = pointLightEffect.Parameters["InvertViewProjection"]; PointWorld = pointLightEffect.Parameters["World"]; PointlightPosition = pointLightEffect.Parameters["lightPosition"]; PointColor = pointLightEffect.Parameters["Color"]; PointlightRadius = pointLightEffect.Parameters["lightRadius"]; PointlightIntensity = pointLightEffect.Parameters["lightIntensity"]; Pointquadratic = pointLightEffect.Parameters["quadratic"]; PointcameraPosition = pointLightEffect.Parameters["cameraPosition"]; }
public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); target2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); effect = factory.GetEffect("glowPost", false, true); gbp = new GaussianBlurPostEffect(); gbp.Init(ginfo, factory); }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, bool cullPointLight, bool useFloatingBufferForLightning) { _lightAddBlendState = new BlendState() { AlphaSourceBlend = Blend.One, ColorSourceBlend = Blend.One, AlphaDestinationBlend = Blend.One, ColorDestinationBlend = Blend.One, }; this.ginfo = ginfo; shadow = new DirectionalShadowRenderer(); shadow.ShadowFilteringType = filteringType; shadow.ShadowMapSize = shadowMapSize; shadow.SplitConstant = splitConstant; shadownBufferSize = ginfo.BackBufferWidth; shadowRT = factory.CreateRenderTarget(shadownBufferSize, shadownBufferSize, SurfaceFormat.Single, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample); if (useFloatingBufferForLightning) { lightRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.PreserveContents); } else { lightRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.PreserveContents); } pointLightEffect = factory.GetEffect("PointLight", false, true); directionalLightEffect = factory.GetEffect("ShadowDirectionalCascade", false, true); spotLightEffect = factory.GetEffect("ShadowSpot", false, true); sphereModel = new SimpleModel(factory, "Dsphere", true); blank = factory.CreateTexture2DColor(1, 1, Color.White); rt = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample); deferredRT = factory.CreateRenderTarget(shadownBufferSize, shadownBufferSize, SurfaceFormat.Single, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample); shadow.Load(factory, ginfo); switch (shadowFilterSpot) { case ShadowFilter.NONE: spotLightEffect.CurrentTechnique = spotLightEffect.Techniques["Technique1"]; break; case ShadowFilter.PCF3x3: spotLightEffect.CurrentTechnique = spotLightEffect.Techniques["Technique2"]; break; case ShadowFilter.PCF7x7SOFT: spotLightEffect.CurrentTechnique = spotLightEffect.Techniques["Technique3"]; break; default: break; } }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, Color BackGroundColor, bool useFloatBuffer) { this.backGroundColor = BackGroundColor; colorRT2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, 8, RenderTargetUsage.DiscardContents); colorRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents); normalRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, 0, RenderTargetUsage.DiscardContents); depthRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, ginfo.UseMipMap, DepthFormat.None, 0, RenderTargetUsage.DiscardContents); lightOclusionRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, 0, RenderTargetUsage.DiscardContents); clearBufferEffect = manager.GetAsset <Effect>("ClearGBuffer", true); effect = factory.GetEffect("Effects//hibe"); }
public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { Saturate = factory.GetEffect("Saturate", false, true); Saturate.Parameters["BloomThreshold"].SetValue(bloomThreshold); Combine = factory.GetEffect("Combine", false, true); renderTarget0 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); renderTarget1 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); gaussian = new GaussianBlurPostEffect(); gaussian.Init(ginfo, factory); }
protected override void AfterLoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { this.ginfo = ginfo; if (desc.UseFloatingBufferForLightMap) { if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.HdrBlendable, DepthFormat.Depth24Stencil8, ginfo.UseMipMap, ginfo.MultiSample) == false) { throw new NotSupportedException("The plataform does not support the specified Render target Combination for Deferred Rendering, check the logs for more info"); } } if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.Color, DepthFormat.Depth24Stencil8, ginfo.UseMipMap, ginfo.MultiSample) == false) { throw new NotSupportedException("The plataform does not support the specified Render target Combination for Deferred Rendering, check the logs for more info"); } if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.Single, DepthFormat.Depth24Stencil8, false, 0) == false) { throw new NotSupportedException("The plataform does not support the specified Render target Combination for Deferred Rendering, check the logs for more info"); } if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.Single, DepthFormat.Depth24Stencil8, ginfo.UseMipMap, ginfo.MultiSample) == false) { ActiveLogger.LogMessage("Shadow can behave strange, you dont have the minimum requirements", LogLevel.Warning); } deferredGBuffer.LoadContent(manager, ginfo, factory, desc.BackGroundColor, desc.UseFloatingBufferForLightMap); deferredLightMap.LoadContent(manager, ginfo, factory, desc.CullPointLight, desc.UseFloatingBufferForLightMap); deferredFinalCombination.LoadContent(manager, ginfo, factory, desc.UseFloatingBufferForLightMap, desc.ExtraForwardPass); if (desc.UseFloatingBufferForLightMap) { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample); target2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample); } else { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample); target2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample); } PostEffectTarget = target; halfWidth = ginfo.Viewport.Width / 2; halfHeight = ginfo.Viewport.Height / 2; restoreDepth = new RestoreDepth(desc.UseFloatingBufferForLightMap, manager, factory, ginfo); }
public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); target2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); target3 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); effect = factory.GetEffect("SSAOPOST", false, true); ssaofinal = factory.GetEffect("ssaofinal", false, true); RandomTexture = factory.GetTexture2D("random", true); gbp = new GaussianBlurPostEffect(); gbp.Init(ginfo, factory); }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, Color BackGroundColor, bool useFloatBuffer) { this.useFloatBuffer = useFloatBuffer; this.backGroundColor = BackGroundColor; const int multisample = 0; colorRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, multisample, RenderTargetUsage.DiscardContents); normalRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); depthRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); lightOclusionRT = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, multisample, RenderTargetUsage.DiscardContents); clearBufferEffect = manager.GetAsset <Effect>("ClearGBuffer", true); clearBufferEffect.Parameters["BackColor"].SetValue(backGroundColor.ToVector3()); }
public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { effect = factory.GetEffect("Scatter", false, true); to = new ToBlackPostEffect(); to.Init(ginfo, factory); tr2d = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); }
public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { this.toon = factory.GetEffect("toon1", false, true); this.line = factory.GetEffect("LineDetection", false, true); this.cell = factory.GetTexture2D("Toon", true); target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); }
public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { depht = factory.GetEffect("depth", false, true); target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); be = new GaussianBlurPostEffect(); be.Init(ginfo, factory); }
public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory) { gblur = factory.GetEffect("gblur", true, true); if (useHalfSingleRenderTarget) { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); } else { target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample); } Vector2 texelSize = new Vector2(1f / ginfo.BackBufferWidth, 1f / ginfo.BackBufferHeight); SetBlurParameters(texelSize.X, 0, ref sampleOffsetsH, ref sampleWeightsH); SetBlurParameters(0, texelSize.Y, ref sampleOffsetsV, ref sampleWeightsV); }
public void LoadContent(IContentManager manager, Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, bool useFloatBuffer, bool saveToTexture) { this.useFloatBuffer = useFloatBuffer; this.ginfo = ginfo; this.saveToTexture = saveToTexture; effect = factory.GetEffect("Effects//hibe"); finalCombineEffect = manager.GetAsset <Effect>("CombineFinal", true); if (saveToTexture) { //if (useFloatBuffer) // target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); //else target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.None, ginfo.MultiSample, RenderTargetUsage.DiscardContents); } half = ginfo.HalfPixel; }