I'm trying to make some post-process with Compositor Effect.

However, if my project enables MSAA in Project Settings, directly using RenderSceneBuffersRD.GetColorLayer(0) takes ERROR log with 'Image (binding: 0, index 0) needs the TEXTURE_USAGE_STORAGE_BIT usage flag set in order to be used as uniform.'

I tried to enable Compositor.AccessResolvedColor = true and use RenderSceneBuffersRD.GetTexture("render_buffers", "color"). This image is writable but it seems not output to the final rendering result.

So, is there any way to write color buffer when enabling MSAA?

( I'm going to try the texture slice view, but it is quite complex for separating msaa and no-msaa case. )

    12 days later

    Li_hippo Hello there, I've been having this same error, did you get a solution that doesn't include disabling MSAA?

      7 days later

      aenderlara and a workaround so far has been doing exactly the game on GDScript instead of C#

      If this problem is specific to C#, probably the CSharp tag should be added.

      aenderlara
      Actually, I'm using C# too. Maybe this problem only appears when using C#.

      But the issue's MRP is at PostTransparent stage, I'm not sure if gdscript works at PostOpaque stage which needs AccessResolvedColor.

      Anyhow, CompositorEffect is not friendly to C# users now. See my another issue https://github.com/godotengine/godot/issues/104263 in which C# CompositorEffect leads to memory leak when GC works on the RefCounted in CompositorEffect.

      aenderlara I do find a workaround for PostOpaque stage post process.

      1. Copy the color texture to a CUSTOM texture firstly.
      2. Then do what you want in the custom texture in _RenderCallback.
      3. When all changes are applied, give the CUSTOM texture to a post process Quad.

      However, I'm not sure if this way will break MSAA or not.

      compositor-effects.zip
      5kB

      Here's a simple pattern I'm working on. The PostOpaqueContainer.gd is what I mean above, where I maintain a custom color_buffer and apply it to a post process Quad. Implement _create_effect() in PostOpaqueNode and add the implemented node as a child of Camera should work.

      But after seeing the issue you posted, maybe gdscript won't have this problem...

      Ok... gdscript still fails on writing color back to the color layer during PostOpaque stage. I've just tested it.