If I turn multi-sampling on then it generally looks nicer but the extra samples don’t seem to pick up shadow-mapping - the result being that edges against shadow don’t look so great at times as there are over-bright pixels along them. (see attached image)
I’ve not worked with shaders for a long time so I don’t know if this is a typical minor trade-off for speed or if it can be improved at a small cost…
thats normal and doing something about it is not trivial … thats why it too graphic cards so long until they got transparency AA …
So can someone give an idea how to solve this issue? Because I also faced this problem and want to do something to solve it on Unity 3.5
I’m afraid there’s just no good solution.
One workaround-like way would be to not use hardware anti-aliasing, but use image-based anti-aliasing approach, using Antialiasing image filter: http://unity3d.com/support/documentation/Components/script-AntialiasingAsPostEffect
Okay, thank you
Is it really normal? (I’ve run plenty of PC games with shadows+multisampling which don’t exhibit this sort of glitch)
I was just experimenting with shadows in a test scene, and with 4x multisampling enabled (forward rendering, default diffuse material, one directional light, Unity 4.2), it can look very rough:
I don’t see the connection with transparency AA here. Yes, multisampling only runs the shader once per multisampled pixel - which is fine. But why is the shader failing to correctly apply shadows to these edge pixels?
What are Unity’s shaders/renderer doing that isn’t compatible with multisampling? - there’s also been issues with specular shaders exhibiting some ugly artifacts when multisampling is enabled: http://forum.unity3d.com/threads/82887-Fireflies-Anti-Aliasing/page3
Are the shadows being applied in a second render pass? - Or in the ‘ForwardBase’ pass? If it was doing deferred shadowing, I could understand the glitch, as deferred techniques don’t go well with multisampling. But I really didn’t expect that it would do that in forward rendering mode?
Edit: After looking at the shader code from \CGIncludes, I suspect that Unity is building a shadow depth buffer in screen space (to combine the cascades?). This would explain why it doesn’t work with MSAA
Yeah, I noticed this too, and kinda cried at the performance waste as it happens even with a single cascade.
Also unitys cascades…
1 Casced is 1 4k map
2 Cascaeds is 1 4k x 2k map. (So less total resoultion…)
4 Cascades is 1 4k x 4k map. So now even the best of our cascades has only 2k resolution.
To start with I’d like an 8k shadowmap at 16bit’s per pixel. Sure it’s a whopping 128 mb, but really, that wouldn’t be so bad for todays desktops that have easy 2Gb of VRAM.
In addition to that it would have been nice with some other stuff for the shadows, but for now, that and removing the extra pass when only 1 cascade exists would be nice.