minetest/irrlicht

Add support for multi-sample textures

lhofhansl opened this issue · 4 comments

This is important to make use multi-sample anti-aliasing (MSAA) - also full-screen anti-aliasing (FSAA).

See minetest/minetest#14285 and minetest/minetest#14338 for (lengthy) discussion and motivation.

Basically something like this:

  • Support a muti-sample as render target
  • Allow "resolving" a multiple sample texture to a normal render target or another normal texture

In the case of MT it means allowing first stage of the render pipeline to be multi-sampled and then continuing with normal texture in subsequent steps in the pipeline.

@HybridDog @grorp FYI.

There are actually multiple problems:

  • The one mentioned in the description: No support for multi-sampling textures, so a multi-step pipeline cannot use FSAA.
  • The SDL "backend" does not support enabling FSAA
  • The "Windows backend" likewise does not support enabling FSAA

TODO: Check MacOS and Android

I dug around in the code, and it is holy mess. :(

Nobody here who know a bit more about FSAA and GL + Irrlicht?

sfan5 commented

Well going by this:

  • you add a new E_TEXTURE_TYPE
  • the TexImage2DMultisample call goes in source/Irrlicht/COpenGLCoreTexture.h
  • the FramebufferTexture2D call in source/Irrlicht/COpenGLCoreRenderTarget.h needs to be adjusted
  • maybe check the version somewhere and add glEnable(GL_MULTISAMPLE) somewhere

The rest of it is shader and intergration work inside MT.
Finally I'm not sure if multisample textures will still only work with the OpenGL3 driver due to Core vs. Legacy profile.

You can see the difference here:

fxaa.mp4
fsaa.mp4

FXAA is useless in this case. The moire effect is very noticeable when you move around.