diff --git a/src/optionals/SM.Intergrations/ShaderTool/STPostProcessEffect.cs b/src/optionals/SM.Intergrations/ShaderTool/STPostProcessEffect.cs
index 461b046..6b70f88 100644
--- a/src/optionals/SM.Intergrations/ShaderTool/STPostProcessEffect.cs
+++ b/src/optionals/SM.Intergrations/ShaderTool/STPostProcessEffect.cs
@@ -16,6 +16,7 @@ namespace SM.Intergrations.ShaderTool
public class STPostProcessEffect : PostProcessEffect
{
private STPostProcessShader _shader;
+ private Framebuffer tempFramebuffer;
public ShaderArguments Arguments;
@@ -39,13 +40,29 @@ namespace SM.Intergrations.ShaderTool
}
}
+ protected override void InitProcess()
+ {
+ base.InitProcess();
+ tempFramebuffer = Pipeline.CreateWindowFramebuffer(0, PixelInformation.RGB_HDR, false);
+ tempFramebuffer.Compile();
+ }
+
+ public override void ScreenSizeChanged(IGenericWindow window)
+ {
+ tempFramebuffer.Recompile();
+ }
+
protected override void Drawing(ColorAttachment source, DrawContext context)
{
Arguments["_Scene"] = (TextureBase)source;
Arguments["_MVP"] = Mvp;
Arguments["_ViewportSize"] = context.Window.WindowSize;
+ source.ConnectedFramebuffer.CopyTo(tempFramebuffer);
+ tempFramebuffer.Activate();
+
_shader.Draw(Arguments);
+ tempFramebuffer.CopyTo(source.ConnectedFramebuffer);
}
}
}
\ No newline at end of file
diff --git a/src/renderer/SM.Base/PostEffects/BloomEffect.cs b/src/renderer/SM.Base/PostEffects/BloomEffect.cs
index 32b0e30..0a75569 100644
--- a/src/renderer/SM.Base/PostEffects/BloomEffect.cs
+++ b/src/renderer/SM.Base/PostEffects/BloomEffect.cs
@@ -188,8 +188,6 @@ namespace SM.Base.PostEffects
{
texSize /= 2;
-
-
f = new Framebuffer(texSize);
f.Append("0", new ColorAttachment(0, pixel));
_downsampler.Add(f);
diff --git a/src/renderer/SM.Base/Window/RenderPipeline.cs b/src/renderer/SM.Base/Window/RenderPipeline.cs
index 906a288..19afdb0 100644
--- a/src/renderer/SM.Base/Window/RenderPipeline.cs
+++ b/src/renderer/SM.Base/Window/RenderPipeline.cs
@@ -54,16 +54,25 @@ namespace SM.Base.Window
///
public virtual void Activate()
{ }
- ///
- public virtual void Initialization()
+ public void Initialization()
{
- if (MainFramebuffer != null) {
+ InitializationProcess();
+
+ InitizePostProcessing();
+ if (MainFramebuffer != null)
+ {
Framebuffers.Add(MainFramebuffer);
MainFramebuffer.Name = GetType().Name + ".MainFramebuffer";
}
DefaultShader ??= SMRenderer.DefaultMaterialShader;
}
+ ///
+ protected virtual void InitializationProcess()
+ {
+
+ }
+
internal void Render(ref DrawContext context)
{
RenderProcess(ref context);
@@ -132,9 +141,15 @@ namespace SM.Base.Window
///
/// This creates a finished setup for a framebuffer.
///
- public Framebuffer CreateWindowFramebuffer(int multisamples = 0, PixelInformation? pixelInformation = null, bool depth = true)
+ public Framebuffer CreateWindowFramebuffer(int multisamples = 0, PixelInformation? pixelInformation = null, bool depth = true) =>
+ CreateWindowFramebuffer(ConnectedWindow, multisamples, pixelInformation, depth);
+
+ ///
+ /// This creates a finished setup for a framebuffer.
+ ///
+ public static Framebuffer CreateWindowFramebuffer(IFramebufferWindow window, int multisamples = 0, PixelInformation? pixelInformation = null, bool depth = true)
{
- Framebuffer framebuffer = new(ConnectedWindow);
+ Framebuffer framebuffer = new Framebuffer(window);
framebuffer.Append("color", new ColorAttachment(0, pixelInformation.GetValueOrDefault(PixelInformation.RGBA_LDR), multisamples:multisamples));
if (depth)
diff --git a/src/renderer/SM.OGL/Texture/PixelInformation.cs b/src/renderer/SM.OGL/Texture/PixelInformation.cs
index e52e75c..109f513 100644
--- a/src/renderer/SM.OGL/Texture/PixelInformation.cs
+++ b/src/renderer/SM.OGL/Texture/PixelInformation.cs
@@ -14,7 +14,7 @@ namespace SM.OGL.Texture
///
/// RGB without Alpha channel, High Dynamic Range (0 - n)
///
- public static PixelInformation RGB_HDR = new PixelInformation(PixelInternalFormat.Rgb16f, PixelFormat.Rgb, PixelType.Float);
+ public static PixelInformation RGB_HDR = new PixelInformation(PixelInternalFormat.R11fG11fB10f, PixelFormat.Rgb, PixelType.Float);
///
/// RGB with Alpha channel, Low Dynamic Range (0 - 1)
///
diff --git a/tests/SM_TEST/Program.cs b/tests/SM_TEST/Program.cs
index d122521..f36bd80 100644
--- a/tests/SM_TEST/Program.cs
+++ b/tests/SM_TEST/Program.cs
@@ -63,7 +63,7 @@ namespace SM_TEST
{
ShowAxisHelper = true
});
- //scene.Background.Color = Color4.Red;
+ scene.Background.Color = Color4.DarkGray;
scene.Camera = new Camera()
{
diff --git a/tests/SM_TEST/TestRenderPipeline.cs b/tests/SM_TEST/TestRenderPipeline.cs
index 978c66a..dcd7b22 100644
--- a/tests/SM_TEST/TestRenderPipeline.cs
+++ b/tests/SM_TEST/TestRenderPipeline.cs
@@ -14,11 +14,13 @@ namespace SM_TEST
private BloomEffect _bloom;
private Framebuffer _postBuffer;
+ private STPostProcessEffect _vittage;
- public override void Initialization()
+ protected override void InitializationProcess()
{
MainFramebuffer = CreateWindowFramebuffer(8, PixelInformation.RGBA_HDR, true);
_postBuffer = CreateWindowFramebuffer(0, PixelInformation.RGB_HDR, false);
+ Framebuffers.Add(_postBuffer);
_bloom = new BloomEffect(true, true)
{
@@ -27,7 +29,7 @@ namespace SM_TEST
};
PostProcessEffects.Add(_bloom);
- /*_vittage = new STPostProcessEffect(Program.portal.DrawNodes.Find(a => a.Variables.ContainsKey("_ViewportSize")))
+ _vittage = new STPostProcessEffect(Program.portal.DrawNodes.Find(a => a.Variables.ContainsKey("_ViewportSize")))
{
Arguments =
{
@@ -37,10 +39,7 @@ namespace SM_TEST
{"Move", 3.33f}
}
};
- _vittage.Initilize(this);*/
- InitizePostProcessing();
-
- base.Initialization();
+ PostProcessEffects.Add(_vittage);
}
protected override void RenderProcess(ref DrawContext context)
@@ -56,6 +55,7 @@ namespace SM_TEST
PostProcessUtility.ResolveMultisampledBuffers(MainFramebuffer, _postBuffer);
_bloom.Draw(_postBuffer["color"], context);
+ _vittage.Draw(_postBuffer["color"], context);
Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
PostProcessUtility.FinalizeHDR(_postBuffer["color"], HDRColorCurve.OnlyExposure, .1f);