Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Add support for multi-sample textures #286

Open
lhofhansl opened this issue Feb 8, 2024 · 4 comments
Open

Add support for multi-sample textures #286

lhofhansl opened this issue Feb 8, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@lhofhansl
Copy link
Contributor

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

See luanti-org/luanti#14285 and luanti-org/luanti#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.

@lhofhansl lhofhansl added the enhancement New feature or request label Feb 8, 2024
@lhofhansl
Copy link
Contributor Author

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

@lhofhansl
Copy link
Contributor Author

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

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

@sfan5
Copy link
Member

sfan5 commented Feb 23, 2024

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.

@lhofhansl
Copy link
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants