Anti Aliasing (AA) Artefacts Errors in Unity

Really not sure what this is, perhaps a bug in Unity, it sure is ugly though:

If I switch on AA I get the following errors the red arrows are pointing at:

This happens in every AA mode 2x, 4x, 6x, 16x…

This is a simple scene built using Unity sphere primitives in forward rendering mode.

It has a single point light inside the sun (big yellow sphere, I switched off my post effects and skybox so it doesn’t look much like a space scene anymore), no shadows, all spheres using default diffuse material. Happens with or without a main texture (it’s not a mip-mapping issue). There are no post or image effects. No custom shaders. My video card driver (4870x2) settings are all default (I reset them, AA is set to application preference).

The really weird thing is, this doesn’t happen with vertex lit materials, nor in vertex lit mode (set via camera or player settings). It also doesn’t happen when using “diffuse fast” or the (the really weird one) Shader Model 1 emulation. Setting SM1 emulation also stops the errors in the editor views (grey background on right) which is really confumsing me as there’s no visible difference between SM1 and SM2 or SM3 diffuse per-pixel lit materials, not that I could see anyway.

I searched for similar issues, and this sounds the same: http://forum.unity3d.com/threads/68120-Unity-3-Bug-with-anti-aliasing-on-specular-materials-causing-white-artefacts but he said it was only happening with specular materials, I’m getting it with all per-pixel materials (Diffuse, Specular ect) that use either binn-phong or lambert lighting models. I haven’t tried writing my own lighting model for surface shaders yet, still reading up on how it so will post back with results.

Anyone else been noticing this?

It’s most obvious when viewing a backlit model. Can also happen with directional lights but it’s much harder to see. It’s very noisy in motion.

At first I thought it might be an issue with my video card but I’ve tried other games and couldn’t see anything. Also, due to the way it only happens with per-pixel shaders and it’s direct relationship to the light and view angles in the scene (errors are static if scene/lights are static) I’m thinking this is not a video card error.

No, I haven’t noticed this but it wouldn’t hurt to submit a bug report with the project folder so the UT guys can take a look at it.

Ok, I’ve submitted a bug report. I’ve also created a little web player if someone would be kind enough to test it real quick (hope it works via dropbox)…

Webplayer AA Test: http://dl.dropbox.com/u/129457/Unity%203%20AA%20Issues/WebPlayer/U3AA.html

Has 4XAA enabled by default (I set all quality levels to 4XAA).

The middle row (red and magenta objects) are the per-pixel materials, these are the objects the errors happen on. Errors are most visible on curved objects (spheres, capsulares, cylinders ect).

Mostly seems to happen when viewing backlit objects hence the light in the middle, just move the mouse to rotate the camera around everything.

The top row (blue and cyan) are all vertex lit and work just dandy at any angle with AA. The bottom row (green yellow) are Diffuse fast and particle/addictive, again both fixed function (I assume diffuse fast is fixed function, some kind of slerped vertex light maybe) and neither are showing AA errors at any view angle so it defiantly only seems to happen with per-pixel lights. There’s a single per-pixel point light in the middle of the scene.

In case that webplayer doesn’t work here’s a tiny 500K package with everything included:

http://dl.dropbox.com/u/129457/Unity%203%20AA%20Issues/WebPlayer/AAIssues.unitypackage

Bump: anyone want to have a quick look at the webplayer linked above?

I looked at the webplayer but don’t see anything I might consider to be an AA artifact. Could be related to your graphics card / driver. Have you tried it on different machines? I’m using a Macbook Pro (ATI x1600 graphics).

It’s not just me, but it is PC only, sorry should have mentioned that before!

I have a macbook Pro (Nvidia 8600M GT) and it doesn’t happen on that.

I asked 5 friends to have a look (All PC users). 4 of the said they could see it, 1 said they couldn’t really tell but he’s a bit of a dope (didn’t understand what aliasing meant) so he most likely saw it but didn’t understand.

I also got a couple of them to take screen shots and recorded their video card specs:

ATI HD 5870

Nvidia GTX 275

ATI HD 4870

Keep in mind these are static images, in motion the errors really jump out.

My friend with the Nvidia GTX 275 said he could definatly see pixels popping in/out where they shouldn’t be, but it wasn’t as bad or noticeable as the screenshots of the others with ATI cards.

Also note that It’s super obvious in the above web player but I wanted to show that it does indeed happen using default materials and shaders so that people wouldn’t claim the problem is just my shader, here’s an example of the same issue with my custom atmosphere shader:

My ATI HD 4870x2

You can also see pixels popping out around the edge of the moon using a default diffuse shader (there’s a blue directional light behind it)

In motion it’s really noisy and ugly, like a 1 pixel ring of “TV Static” around the planet as from frame to frame the pixels appear and disappear at random. :frowning:

You did post these in your bug report, right? That way, hopefully, this issue might get resolved soon.

Yeah, I sent them the test project and included a link to this thread.

Still, I’m surprised as seems to be happening to everyone I’ve asked using Windows but no one was posting about it.

I’m testing your webplayer on my PC (GeForce GTS360M with Windows 7) and I’m not seeing the artifacts here either. Must be related to your graphics card?

I noticed something similar on my pc with my project no matter what I sat the Unity AA to. I finally got it smoothed out on the control panel of my graphics card when I had to control the AA and not Unity… not sure if yours is a similar situation or not though

Well, I’ve asked a heap of people to test it and they all show more or less the same thing on the PC thus far (more from ATI than Nvidia) as indicated by the screen shots they gave me so I don’t see how it can be just my card.

Honestly I don’t know what’s going on I just want it to go away. I was hoping this was a known issue and there was some super simple fix but that doesn’t seem to be so.

:frowning:

I’m not disputing that you’re seeing an issue. I’m just saying that it doesn’t happen on my machines. There have been lots of times where I’m the only one seeing an issue. Makes it harder for Unity to fix the bug, but hopefully they’ll track it down and fix it for you.

I can’t reproduce the issues either.

It’s not particularly noticeable but I can definitely see the issue

I’m on PC and have an ATI Radeon HD 3850

I can see the issues on an Nvidia card - it may just be down to the way anti-aliasing is done.
Do you have real-time shadows?

There are issues if you anti-alias against real-time shadows, because the extra rays sample from non-shadowed objects resulting in a slight halo effect at times.
http://forum.unity3d.com/threads/64385-Anti-aliasing-not-so-good-against-real-time-shadows

I can confirm that this BUG is still there. I previously used an ATI HD4870 and just upgraded to a nVidia Quadro 2000 because of this, and guess what, anti-aliasing still causes this problem! Even in a basic scene with a stock standard sphere, with and without shadows.

I have noticed this already in Unity 2. This is extremely annoying!

One interesting thing I notice is that the artefacts are dependent on the light direction. It actually seems as if the back faces are drawn (brighter, as a result of their direction to the light) then the front faces are drawn over this, yet the z clipping is giving priority to the back face that’s already there. Therefore you see the occasional backfacing pixel coming through.

If this is true, it means one of 2 things. Either the z-depth testing mode on the shaders are giving priority to back faces (Maybe someone can test that). And or, the front/back facing calculation is in accurate which causes the occasional back face to be drawn when in fact it should be invisible (those faces on the edge that are hard to tell if they should be front or back facing).

For me this only happens in Forward rendering (the default mode). With deferred lighting there’s no anti-aliasing so it couldn’t happen. With vertexLit mode there’s no problem, yet who uses that!

Hope my observations help.

550532--19418--$antierror.png

giving this a bump, I get the same on my AT HD 5770. It’s noticeable in pictures like the one above, and when in motion, it’s like white noise around the edges. Turning off AA works, but then my game looks ugly. This needs to be sorted.#
EDIT:
Note, this doesn’t affect vertexlit shaders, oddly. Only other ones.

I am getting this problem too, sent a bug report :frowning:

Also seeing this problem.