I’ve done my best to research this with no luck. I’m using Unity 2017.1.0p4
For some reason, there appears to be jagged white edges on some of our objects depending on the angle you look at it. In VR, it’s way more obvious and the edges look like they’re moving the entire time, so it’s really bad. I attached an image of a sink and circled the area where there are white edges.
Our materials use the Standard Opaque Shader with an Albedo, Metallic, Normal, and Occlusion.
Two changes have “fixed” the edges:
Remove the metallic texture. Set smoothness and metallic to 0
On the Mesh Import settings. Under “Normals & Tangents”, change it from Import to None.
Neither of these are really great solutions, because the aesthetic of the objects change completely. I’ve tried turning off all the lights. Different levels of AA (including off). Messed with a bunch of texture import settings. And I can’t remember what else.
If anybody has suggestions, that’d be greatly appreciated. I’m not sure if this is something on the Unity side or something on the artist’s side.
Thanks
Thise kind of aliasing effects are common for realtime rendering.
This is most likely caused by your normal map, it seems to have beveled edges in it.
Are you using Deferred or Forward rendering? But the isssue could dissapear when the object is on the ground. It is all about hard contrasts.
A solution to those problems is to render in higher resolutions, e.g. Using VRSettings.renderScale. But this is of course more expensive to render.
There are like 3 different causes of this issue. The above link is one of them, but not the issue here. The second one has to do with MSAA over sampling, which again isn’t the issue here (though MSAA can make it worse!).
This one is caused by the thinly rounded edges and Fresnel reflectance. It’s shader aliasing, which MSAA doesn’t handle. As an edge becomes parallel with the view direction it becomes more and more reflective. At parallel it becomes a perfect mirror. In the real world this can never really happen since something parallel to your view can’t be seen. In computer graphics this happens all of the time since the surface normal is coming from normal maps and interpolated vertex normals and not necessarily the geometry facing.
So what you’re seeing is a thin rounded edge where the surface normal that’s being “seen” at the center of each pixel is going back and forth between facing towards the camera and facing away from the camera. The result is that aliasing.
There are a few fixes.
A) Don’t use thin rounded edges. This means make them fatter (though that’s just delaying the problem), get rid of them entirely, or use mesh LODs with out the rounded edges that you switch to once those edges are getting close to being only a pixel or two across.
B) Use geometry normal derivatives to adjust the roughness. There’s a valve paper on VR stuff that talks about this. See page 43 of this paper: http://media.steampowered.com/apps/valve/2015/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf Using this requires using your own custom shaders as it’s not built into Unity’s Standard shader. It can be implemented a Standard surface shader.
C) Liberal use of roughing the smoothness texture to make the corners rough. Modifying the smoothness in the texture on the edges is really what option B is going to do, so you could approximate it in the art.
Forward rendering, MSAA 8x. The problem stays if I turn MSAA off (and the edges look even worse). I did try the render scale solution before posting this and it did work, but there is the performance hit. So I’d like to avoid it. I had to go all the way up to 2x render scale in order to remove the problem completely.
I did read this one already, and I wasn’t exactly sure how to apply it. Also, I tried turning off all lights and all shadows (I guess except for the Skybox) and the problem persisted. So I felt like it wasn’t a shadow problem. I can look into this one again though. Thanks
Wow this was a great response. Thanks!
A) so this solution involve changing the mesh and/or creating LODs?
B) I have never see this before. I’ll give that a read through. My shader skills are not very good at moment (slowly working on it). I’ll see if I can modify the standard shader to use this trick. But if you have any links to the shader code already applied, that would save me a lot of time.
C) And this solution just involves changing the metallic texture? What do you mean by roughing it? Instead of the texture being solid for smoothness, would I add sort of a grainy effect to make it look rough? (I’m not an artist, so I’m trying to find a way to convey this to the artist if we need to)
Yes. The problem is caused by thin, rounded edges that are less than a pixel wide. When you’re close to the geometry it looks great, but when you get far away it’s just causing you problems. In general you don’t want thin triangles less than a pixel wide anyway, so you may want to use mesh LODs anyway. They’re especially bad for MSAA performance too. This won’t solve every case, but it can remove most of them. It’s can be a time consuming solution though as the transition between LODs will be much more noticeable in VR so the LODs have to be really good. Something like Simplygon could help here.
Modifying the standard shader is harder than it sounds. It’s a complex beast. I don’t know of any assets released with that implemented in the Standard shader. Even Valve’s own The Lab Renderer asset for Unity doesn’t implement a lot of the features in their paper, though I seem to remember this one was. That’ll be of less help than you think though since thats a complete replacement of Unity’s lighting pipeline and does not use the Standard shader at all.
I mean just that, increase the roughness of the smoothness map on the geometry edges. In other words make the Metallic texture’s alpha channel darker on geometry edges.
How about instead of the Standard Shader, that is very dynamic, a shader that uses only Base Texture, Normal Map, Metallic Texture, and Occlusion map? Since that is the only case in this game where I’m using metallic and seeing the issue.