White pixels from AA and specular shader

Hi,

we’re getting these nasty artifacts on our models, whenever a specular shader is used and anti-aliasing is enabled (Unity 3.5). The pixels jump around like crazy on the edges of the model when the camera or light moves.

  • It is definitely not a mipmapping or other texture problem (it happens without textures too).
  • The near or far plane of the camera does not affect the issue.
  • It rarely happens (but it does) on the default unity sphere, if I put a specular material on it.
  • I see it most often where there are lots of polygons (they don’t overlap or anything, see sphere). So I assume it has to do with the polygon density.

Does anyone know how to fix this? We’d really like to have specularity AND anti-aliasing, if that’s not asking too much :confused:

Try using different rendering method that fixed it for me.

You mean deferred lighting? Yeah that’s no surprise, since it doesn’t support anti aliasing in the first place, which causes the problem.

But using AA is not negotiable for us.

Does it occur with light probes instead of ‘real’ lights?

Unfortunately, it happens with light probes as well - with the added problem that normal maps don’t seem to work anymore, when only lightprobes light the model.

I think it is the same problem we had when we switched to 3.2. You can see the post here: http://forum.unity3d.com/threads/82887-Fireflies-Anti-Aliasing?highlight=fireflies

I think we made a custom shader that did the trick. I’ll try to find it and post it here.

FYI it happens on ipad too, mostly near the corners of geometry. And we were using a specular shader. I think it’s due to unclamped values at angles or something.

I’d be great if you could post that fixed shader! I’m terrible with writing shaders.

Fortunately performance isn’t really an issue for us, since we only have 2 or 3 models to render, per scene. So having a shader that does the clamping would be great.

Try the solution from the link I posted:

Switch to Bumped Specular. Put a flat normal map (that effectively does nothing, you can generate one if you go to an image, tick Generate Normal map in the settings of the image and turn down Bumpiness to 0). I think then the effect is greatly reduced or gone. I guess it’s because then the shader re-writes the normal calculation, which is where the problem is probably.

If that doesn’t help let me know and I’ll find the shader.

I had dismissed this solution, since we also get the artifact on meshes that already use a normal map (so that alone doesn’t fix it) - and we wouldn’t be able to use the normal map the mesh needs.

The solution to add o.Normal = fixed3(0,0,1); seems to give the best results so far and is easy to apply to the shaders that don’t use a normal map already. Not sure what to do with those -with- a normal map though.

Hi all,

The solution for me was to apply the (Pro-Only) Image Effects Anti-Aliasing Script on my camera. Works great and there are several options there…not sure of performance impact yet…

Thanks! That is a good idea! I’ll try it later.

I bumped into this issue for the first time, trying to use a custom normal mapped specular shader.

None of the workarounds presented earlier work for me because I’m using Unity Pro and all my models use a normal map (so I can’t flatten it).

This is a quite serious issue, it’s weird that it haven’t been fixed yet.

I would like to echo some significant frustration with this.

I use normal maps, so the workarounds are useless. I can’t use AA as a post-effect, as it messes up some of my shader use. I can use Catalyst Control Center to set Supersampling AA on the application to make it look nice, but that’s hardly a solution I can present to my customers. = (

Seeing the problem here too–this is with the standard Unity specular shader and no texture. Certain objects have a very distracting “glittering” as they move. (Even a standard Capsule object will sometimes do it a little.)

Any new solutions?

Bumping this thread as I too have this problem and it’s 2014. You’d think Unity devs would fix it by now lol

With Unity 5 on the way, I hope this will be fixed by then. But w/e.

I, too, am hoping for a fix.