-
-
Notifications
You must be signed in to change notification settings - Fork 56
Description
I encountered a problem in the process of implementing MSAA. Let me try to explain it clearly.
To enable MSAA, we need to enable the MultisampleState in the RenderPipeline, use MultiSampledTexture in the ColorAttachments, and resolve the MultiSampled texture into a common texture when rendering to the final texture buffer.
However, in current pygfx, the "color texture" and "pick_info texture" are generated simultaneously in the same RenderPipeline.
Using multisampling for the "pick_info texture" is meaningless, and more importantly, the "pick_info texture" is in the "rguint16" format, which does not support automatic texture resolve (resolving from a MultiSampled texture to a common texture).
I thought two solutions:
-
Keep the current logic, and use a multisampled texture for Blender's “pick_tex” when MSAA is enabled. Then, create additional RenderPipeline (and related resources) to implement texture resolve in the shader.
-
Separate the generation logic of the "pick_info_map" from the main rendering shader and use an additional independent RenderPipeline to process it, (similar to the process of generating shadow maps).
Both solutions are relatively complicated, but the second solution may require more changes to the code structure.
BTW, I strongly recommend adopting the second solution. This approach can provide higher flexibility for potential advanced rendering pipelines in the future.