msaa + alpha to mask

Those ibxt guys really have got it together, haven't they :!:

Blimey :oops:

Ooh, hang on, that's you Clootie! Nice one!

Jawed
 
Clootie said:
But have you looked at this page?
Meh, now I did my own testing and I know how TMAA works... and why it doesn't work well.

alphatest.png
tmaa.png
alphablend.png

These three images show (left to right) alpha test, transparent AA with multisampling, and alpha blend.
The alpha reference value for the alpha test in the first two images was 120/255, compare function was "greater". As you can see, TMAA is not a simple [0, 1] -> [0, 1] mapping for alpha -> coverage. Instead it's something like [r-x, r+x] -> [0, 1], where r is the alpha reference value and x is some small value like 0.1.

This might be acceptable for magnification, and you can imagine if the image on the right (alpha blending) only had 16 intermediate steps between green and black, you'd see strong banding. But for minification, what NVidia is doing here is really stupid IMO. This just can't work to get smooth edges. The mapping has to be [0, 1] -> [0, 1].

To simulate this, I have made one image where alpha blending results in very smooth edges, and one where I changed the mapping (by using PSP color curve adjustment):
absmooth.png
abjagged.png
 
DemoCoder said:
I have been incredibly annoyed at aliasing in games like HL2 and BF2, and most outdoor games that make use of alpha textures for shrubbery, wires, fences, railings, etc.

Ohhhh! This fixes the crappy aliased shrubbery!? Okay, it just went from "pretty cool" to "I want it!". Damn it.

Edit: Tho it would be more interesting to bench a shrubbery-intensive situation, as you tend to get more of that (which is why it is even more annoying!) than fences and railings.
 
Yeah, it doesn't make much sense that they did it that way. The worst-case scenario for the alpha test is minification (that's where even supersampling won't save you).
 
So xmas what does it excatly mean. The current implementation of TMAA is improveable in quality or...what
 
Chalnoth said:
Yeah, it doesn't make much sense that they did it that way. The worst-case scenario for the alpha test is minification (that's where even supersampling won't save you).
Supersamping works quite well with minification.

tEd said:
So xmas what does it excatly mean. The current implementation of TMAA is improveable in quality or...what
It certainly is, and I'm pretty sure the hardware is capable of a 1:1 mapping. It has been there since NV20 and is a requirement of GL_ARB_multisample.


btw, NVidia has introduced a "backdoor" to DirectX for both application controlled transparency multisampling (alpha to coverage) and transparency supersampling (selective RGSS). I am not 100% sure this requires alpha test enabled as well, so if not, you can use it to enable RGSS for the whole scene.
 
Heard about backdoors for this thing from a other IHV too. Backdoors the key to happyness in directx :)

Thanks Xmas
 
Presumably M$ has implemented a similar "backdoor" for this kind of cunfionality in the Xenos API.

Question is, will M$ introduce something like this to WGF2?

Jawed
 
Xmas said:
Supersamping works quite well with minification.
It helps, but only a limited amount. The problem is that there are far too many scenes where the minification can get so extreme that you'll still get huge amounts of aliasing.
 
Chalnoth said:
Xmas said:
Supersamping works quite well with minification.
It helps, but only a limited amount. The problem is that there are far too many scenes where the minification can get so extreme that you'll still get huge amounts of aliasing.
I don't follow. With trilinear filtering, things tend to get blurry rather quickly due to minification.
 
OpenGL guy said:
Exactly: There's no minification there. That fence texture has no mipmaps that I know of.
Well, no mipmaps doesn't necessarily mean no minification. But mipmaps to that fence texture couldn't look right anyway, except if they used alpha blending. ;)
 
Xmas said:
OpenGL guy said:
Exactly: There's no minification there. That fence texture has no mipmaps that I know of.
Well, no mipmaps doesn't necessarily mean no minification.
Perhaps, but the issue here isn't minification, it's undersampling.
But mipmaps to that fence texture couldn't look right anyway, except if they used alpha blending. ;)
Don't think that would help much... your fence would become transparent and that could look weird too (as well as requiring sorting). Also, the links on the fence may change in size due to filtering.
 
Well, no, the fence being transparent would be correct. Think of a screen, for instance. You don't typically think of it as being made up of opaque threads: it just looks semi-transparent.

Now, not having MIP Maps may be due to it using an alpha test. I've seen fence-like textures that use an alpha test totally disappear when the wrong MIP map came up. Alpha blending can solve all of this (as can using a coverage mask, though not quite as well).

As a side comment, nVidia, in the past, has enabled forced generation of MIP maps (I believe they did this back in the TNT days). This might be something they could revisit with alpha tested textures (even though it would be likely to cause hitches in performance).
 
Chalnoth said:
Well, no, the fence being transparent would be correct. Think of a screen, for instance. You don't typically think of it as being made up of opaque threads: it just looks semi-transparent.
As I said, I suspect the size of the fence links would change and that could be problematic. And a screen is a poor comparison to a fence as a chain link fence has far thicker pieces.
Now, not having MIP Maps may be due to it using an alpha test. I've seen fence-like textures that use an alpha test totally disappear when the wrong MIP map came up. Alpha blending can solve all of this (as can using a coverage mask, though not quite as well).
Wrong mipmap? If the wrong mipmap were being selected, it'd be a problem everywhere. Probably the correct mipmap was chosen, but the visual result was not good.
As a side comment, nVidia, in the past, has enabled forced generation of MIP maps (I believe they did this back in the TNT days). This might be something they could revisit with alpha tested textures (even though it would be likely to cause hitches in performance).
Chances are the developer got it right.
 
OpenGL guy said:
As I said, I suspect the size of the fence links would change and that could be problematic. And a screen is a poor comparison to a fence as a chain link fence has far thicker pieces.
Not compared to the size of the gaps. You just have to be standing further away to get the same effect.

Wrong mipmap? If the wrong mipmap were being selected, it'd be a problem everywhere. Probably the correct mipmap was chosen, but the visual result was not good.
Well, that's sort of what I was saying. If the alpha cutoff is 50%, and there is more transparent than opaque pixels in the texture, then the texture will, at one point, become completely transparent (all opaque if more opaque pixels in texture).
 
Chalnoth said:
OpenGL guy said:
As I said, I suspect the size of the fence links would change and that could be problematic. And a screen is a poor comparison to a fence as a chain link fence has far thicker pieces.
Not compared to the size of the gaps. You just have to be standing further away to get the same effect.
And that happens how often? You have to me 100x as far away for your chain link fence to have about the same thickness as the screendoor.
Wrong mipmap? If the wrong mipmap were being selected, it'd be a problem everywhere. Probably the correct mipmap was chosen, but the visual result was not good.
Well, that's sort of what I was saying. If the alpha cutoff is 50%, and there is more transparent than opaque pixels in the texture, then the texture will, at one point, become completely transparent (all opaque if more opaque pixels in texture).
Then it's not the "wrong" mipmap is it? It's the correct mipmap, but the art is not so good.
 
OpenGL guy said:
And that happens how often? You have to me 100x as far away for your chain link fence to have about the same thickness as the screendoor.
Well, if I look out of the window right now, I can see a chain link fence. Indeed, at a distance of 40m or so I can still see the wires. However if I took a photo with my old 1.3 MPixel camera, there's no visible wires any more. It's just a uniform transparent "wall", and if you only knew the pic from the camera, there could indeed be a stained glass wall FWIW.

Mipmaps are an average of areas of the base map. If in this area half the texels are transparent and half are not, the mipmap should indeed be half-transparent.
 
OpenGL guy said:
Then it's not the "wrong" mipmap is it? It's the correct mipmap, but the art is not so good.
Er, it really has nothing to do with the artwork. Once you have only one texel to represent one link in a chain link fence, what would the correct result be? Obviously, if you were going to compare against the real world, you'd want it to be semi-transparent.
 
Back
Top