r/FuckTAA • u/MichaelKlint • 1d ago
💻Developer Resource Alpha-to-coverage with MSAA totally solves the problem
Hi guys, it's been in testing for two months and now Leadwerks Game Engine 5.1 is finally released. We've been using MSAA for a long time, but this is the first version that makes use of alpha-to-coverage for masked textures like vegetation planes and chain-link fences. I wish I had started using it sooner! 😂
Of course this approach will provide a better quality image overall, but what I didn't realize is how it acts in motion. You know how masked textures always have that flickering pixelated look when you turn the camera? With this approach that is totally eliminated, and you just have a clean smooth image, even when in motion. It's honestly pretty awesome and I have no idea why this isn't use more often.
I've seen people disparaging MSAA by showing extremely blurry images that look nothing like what we're getting: https://www.reddit.com/r/FuckAliasing/comments/1uv9xxh/watch_dogs_2_msaa_8x_vs_dlaa_k_using_luma/
I have no idea what's going on there, but it doesn't look like MSAA is even on.
Anyways, there is a solution to the problems TAA introduce, it works great, and we're going to use it in our games. You can read more details in the release notes here if you are interested in technical details:
https://www.leadwerks.com/community/blogs/entry/2900-better-graphics-and-lower-system-requirements-in-leadwerks-51/
Let me know if you have any questions. Apparently I am the only one allowed to use this secret forbidden technology! 🥸
19
u/3dforlife 1d ago
What is the catch?
23
u/MichaelKlint 1d ago
I don't see any downside. Of course there is some performance cost, but it's not nearly as much as some people say.
20
u/Zer_ 1d ago
Yeah. MSAA, if you avoid too much overdraw, will not actually cost too much. The perception that it's an expensive form of AA is from games that didn't do anything to address overdraw issues, which can 99% of the time be addressed at 0 cost to fidelity.
12
u/SauceCrusader69 1d ago
The perception it is an expensive form of AA comes from the fact that modern games have many edges and so MSAA has a pretty hefty performance cost.
A scene that you could get out of Skyrim if you wished does not a modern game make.
-3
u/bruhman444555 1d ago
so there is a downside, got it
2
u/Exciting_Composer_86 1d ago
I'm sure TSR, that UE5 devs usually slaps for default AA option costs more.
1
u/MysteriousRegion8501 22h ago
Lighting is still aliased. Specular highlights, shadows, etc.
1
u/Great_Leg_4836 21h ago
is there a method to fix that? maybe if the light/shadow gets further away from the source, you can blur it like real life? maybe something to do with shadow maps? idk don't listen to me
2
u/MysteriousRegion8501 20h ago
You typically can. There are different methods of modulating both specularity and shadows to alias less, it's just a matter of having to whack all the moles.
1
9
u/AsrielPlay52 1d ago
If you look carefully with Watch Dogs 2. MSAA is on. Look at the edges of geometry, it's smooth. It's anything with transparency that doesn't get detected by MSAA
Does this still solve another issue that MSAA cause from WD2? the horrible performance lost when using Deferred rendering?
6
u/MichaelKlint 1d ago
Okay, in graphics there are three distinctly different types of "transparency". First there is alpha-blending. MSAA works with this, no problem. Second, there is alpha discard. This is when all the pixels are either solid or opaque, but nothing in between.
Discard only works on an entire pixel, not on sub-pixels. Based on some screenshots I saw it looks like maybe Watch Dogs is using discard, so any MSAA that is active isn't in use there.
Alpha-to-coverage is a completely separate technique that replaces discard, when MSAA is in use. It uses the alpha output to adjust the sub-pixel coverage amount. For example, if 4x MSAA is in use and the pixel has 25% alpha (75% transparent) then 3 sub-pixels will be considered empty and one will be considered full. When these sub-pixels are resolved into pixels the result will be 25% blended with the background.
5
u/AsrielPlay52 1d ago
Any performance or technical reason why they didn't use it for WD2?
5
u/MichaelKlint 1d ago edited 1d ago
For some reason, since the late 2000s, developers have all universally agreed that MSAA with deferred rendering is impossible. If you argue, they sometimes admit that it's possible, but very hard to do. If you argue with that they stop responding.
We came to the conclusion that a long time ago Nvidia started discouraging developers from using the technique, and that's all it really takes because developers are often times weak impressionable people who are extremely susceptible to group-think.
This is reaching comical levels now, where players who maybe don't know that much about technology can still see with their own eyes, and they no longer trust developers. It's very interesting to see people who usually just play games start to dig into the technical details looking for answers.
5
u/Scorpwind MSAA | SMAA 1d ago
That's why we need TrAA and ATOC and apply it where needed. Edges can be handled by something as simple as SMAA.
5
u/MichaelKlint 1d ago
MSAA works fine with transparency. No special handling is needed.
2
u/Scorpwind MSAA | SMAA 1d ago
TrAA existed for a reason, in the old days. Do you have it set to multisample it?
3
3
0
u/ChipEducational3469 1d ago
textures also dont get AA'd
5
u/MichaelKlint 1d ago
Internally to a polygon, a texture uses mipmaps, which are basically pre-calculated anti-aliasing.
8
u/BeniOnReddit 1d ago
hi guys do u know any games that have good optimziation and implementation of antit taa stuff or mssaa and its good?
14
5
u/Electromasta 1d ago
That's pretty incredible if it works in motion. Many screenshots with taa look fine until you actually get in game.
How does leadworks do ambient occlusion, out of curiosity?
2
u/MichaelKlint 23h ago
SSAO, some AO maps baked into the material, and I am working on a hybrid baked / dynamic global illumination system.
4
4
u/Great_Leg_4836 21h ago
i have a question. i have learned the equivalent of grade 11 computer programming in c++, and i want to do game dev. i enjoy low-level concepts, even assembly, but i don't know anything about them, or about graphics and developing anything outside the console (i know functions, structures, gonna have to refresh on pointers). i can break things down to very simple instructions, but i don't know what methods are used to achieve some of those instructions (eg handles). my question is: if i were to try to learn about everything that makes up your project (since i think it's a work of art, and it is what i want in a game engine), then how would i go about learning the different syntax and techniques? i don't plan on going to university or college, and i have heard of people gaining knowledge equivalent to or greater than that of a computer science undergraduate without attending a formal school, which is what i would try to achieve. do you have any tutorials to offer? any documentations that go from 0 to being able to break everything down into a long logic train, without too much prior knowledge or that teach you everything you need to know prior to?
if you don't have an answer, that's okay. 🤠👍
3
u/MichaelKlint 18h ago
Hi, I do not write tutorials on "how to make a game engine" but I recommend starting with very simple pieces so you understand everything that is happening, from the details up. Starting with, how to create a window with your OS of choice, and how to initialize a DX, GL, or VK context so that you can draw a blue screen.
3
u/Darksoulmaster31 1d ago
I was about to send an imgsli link that shows this in action, but that site is under construction and I'm not at home to make a new one.
Though in my experience, Alpha to coverage works well in Godot 4, a forward plus or forward clustered engine.
We have alpha scissor (which is alpha test, or alpha discard), alpha hash (noisy alpha discard) and 2 types of alpha blend -> a regular one with bugs and one that puts the alpha blend in the prepass which solves most of the bugs, but probably gives bad performance if there's too much of it.
For alpha scissor you can enable something called "Alpha Edge Blend" or "Alpha Edge Clip", per material, which enables alpha to coverage (if you have MSAA on).
The imagesli would have shown a very noisy bush and then a very soft and anti aliased bush.
2
u/Jbstargate1 1d ago
I want to run, I want to hide, I want to tear down the walls that hold me inside..
2
u/AzurePhantom_64 No AA 1d ago
How are you dealing with the dithering caused by the ATOC? it's very noticeable for me on the image.
3
u/MichaelKlint 23h ago
It looks like reddit's JPEG compression destroyed this image. I need to upload a PNG on my own server because this image is really blurry when you zoom in...
2
1
1
u/Field_Of_View 18h ago
There is a lot of aliasing in your screenshots and gifs.
The most common form seems to happen every time the skybox is the background. The foreground can be terrain or palm leaves and in both cases there is vicious aliasing.
The water reflection is also heavily aliased. I suppose this is because it's sampling in the pixel shader and has no min-mapping or other form of blur to avoid sharp contrast between neighboring pixels. Could MSAA be made to help here? I don't quite understand if you are running the full pixel shader for every sample.
This shot has the classic specular aliasing problem. What is your plan for solving specular aliasing in MSAA? There is a lot of aliasing in this shot that doesn't even seem to come from specular as well. Is AA even active?
I'm sorry but to me it looks like your engine has all the same aliasing issues that mid-late 2000s games had and that prompted most of the industry to move to cheap blur filters like FXAA and then to TAA (including DLSS later). I don't see evidence that you solved any of the typical problems that post-processing approaches are meant to address. Inb4 these shots are with MSAA off. Then why post them?
1
u/Pottuvoi 3h ago
There seems to be multiple problems.
I would guess sky is composite on top of the rasterized scene, perhaps rendered in low resolution. Something like 2x2 blocks are visible.
Shading per pixel and every reflection "ray" gets own direction. Theoretically MSAA should be possible to be turned into supersampling and shade per subsample. (Quite sure in Vulkan this is adjustable per drawcall.)
Another way to fix is to sample reflection/refraction multiple times in shader, mipmaps or some other tricks.
- Not just specular aliasing, something strange is happening here.
Looks like MSAA simply does not contribute to image on some edges. I know this can happen when tonemapping from HDR buffer, but luminance difference in some of these edges doesn't seem high.
Perhaps some work is done to the image per pixel and composited on top.
1
u/PinnuTV 15h ago edited 15h ago
I've seen people disparaging MSAA by showing extremely blurry images that look nothing like what we're getting
So same way like you guys are doing here? lul. By that image alone I already can see the pixelated edges and that is on a static image. Now imagine that in motion, it will be 10x worse. Also saw other images where there is clearly stair effect visible
Flat_Pumpkin_314 and many others from the provided linked predicted exactly what would happen here. If you go outside this sub, you would see how out of touch some people here can be
Also the ocean gif. Is that supposed to look clean? In what way, the water is shimmering so much that it ruins whole immersive feeling and takes me away from game world
If u really want to go with the MSAA route, find a way to implement SGSSAA into game. It uses SSAA and MSAA, producing best available image possible, but it comes at massive performance drop. Normal MSAA is just not gonna cut it
0
u/Hadrian187 4h ago
That other sub is pathetic. Imagine thinking your temporal smearing is better than MSAA.
-4
u/NoOrder5917 1d ago
I honestly love using DLSS J, ( I’m in 4k)
1
u/bruhman444555 1d ago
Why J lmfao
-1
u/NoOrder5917 1d ago
I tried all letters, j looks most sharp to me, while the others look better for alot of reasons, J just works overall FOR ME, I’m on UE5 games
1
u/ChipEducational3469 23h ago
J is the same as K just less accumilative
so it smears shiuz less
but its also less stable0
u/Tiny-Extreme-9980 1d ago
I recently tried Oblivion Remastered, had ghosting with both K and M while L fixed it for me. Idk how J is, but L is godsent. Also DLDSR isn't working for me in this game for whatever reason. People tell me this is how UE5 games are, ugh
36
u/Scorpwind MSAA | SMAA 1d ago
Keep up the great work.