So after Unity 5.3 release I have tried to do it once again - bake a mesh with one smoothing group and import it into the engine with synched normals. The normal map was converted in Xnormal from object space map baked in modo.
It worked totally fine on test cubes but as soon as I import a more complex mesh it breaks:
It looks fine in Painter:
Horrible in Unity
Better but still horrible in Unreal
And then I thought - why should I even bother when I can harden edges of uv islands with one click and get better smoothing with the same number of verts:
yeah, I know there may be some solution to make it look good in Unity/Unreal with one smoothing group but why should I jump through hoops while I can make it look good just like that? Is there any other benefit of everything being smoothed into one group I don't know about?
Replies
@huffer: yes, I've triangulated that. As for baking in Xnormal I've tried it with other meshes with the same result. I'll do some baking once again, but I doubt I've missed anything.
Just for the record ... are you aware that you can bake synched to UNity and UE4 directly from Modo 901 upwards with Farfarer's VNorm toolkit?
I am using it at work to bake normal maps synched to Unity on a regular basis (mostly technical models) and so far did not encounter these shading errors any more. Though I also AM using smoothing groups and edge breaks. If you don't need to paint on the UVs it just looks cleaner, I think. The baker from Substance Designer/Baker also has synched normal algorithms to Unity and UE.
Conversion somehow never worked for me that easily so I gave up on it very quickly. Why convert when you can bake natively?
-> Farfarer's VNorm Toolkit for Modo
Synced is better hands down. It is a more correct representation of the high poly normals, allows the artist to have cleaner uvs and more optimized models, etc. If it is available then it is the only way you should work because it's the correct way.
https://unity3d.com/unity/beta/unity5.3.0b5
If this is incorrect then it can easily be added to your own project by finding the tangent to world transform in your CGIncludes shaders.
Alternatively you could construct your own vertex shader which would look something like my code below (Using Unity 4). Unfortunately I haven't used Unity 5 much but it should be essentially the same. You could translate this directly to the appropriate CGInclude folder shaders to get the MikkT synced normals.
I'm not ready to drop 400$ or so to upgrade from 801 so I'll continue converting in SD.
Also yes, it looks like shit in Unity. I've checked settings, Mikkt tangent space is used. I've tried switching to legacy and it looks even worse (as expected). I wonder what happens in Unity.
here is my settings in Unity:
Also here's a map from Xnormal but with compute binormal checked in options. That was the issue:
looks identical to SD and modo so I can use that too. I've unchecked it for Unity btw.
Ok, so I've finally figured out the workflow in details after following it blindly for about a year but now I know it works 100% right even with such shitty topology and smoothing which can be even better if I harden a couple of edges on UV borders with zero extra vertices produced.
Still there's an issue with Unity which is negated by harding edges but still it's an issue that needs to be looked into.
I've attached the mesh and the world space map I've used for anyone who wants to play with it in Unity.
results are similar, it's just a bit easier to spot the shading artifacts in unity because the shader is glossier, I was too lazy to try and match them lol.
still getting artifacts though...
I had to soften all edges, then use your world space to convert to tangent space using xnormal, compute binormal in pixel shader was on - it needs to be on for both UE and unity.
https://www.dropbox.com/s/rh59h6iq24t7v2q/xnormal_compute_binormal.tga?dl=0
@motionblur: ahhhh... this must be it. I've heard about it too but completely forgot about it. I use Unity at work, so I've unchecked it here, but at home I use Unreal and it requires smoothing groups.
if you figure this out conclusively, do let us know please :P
edit: ok I've tested once again with and without binormal shader and the one without does have better shading, it's a minor difference but it's there.
i've also testes with and without smoothing groups on export, can't see any difference.
This should help reducing gradients/dithering.
edit: one more:
A - More efficient, less vertices.
B - Less UV seams to deal with.
C - Higher quality. It can be difficult to mask hard edges with rounded normals.
This is actually incorrect. When you harden an edge, what actually happens is the verts get doubled, with vert normals facing different angles. It won't behave like 2 separate verts when you are modeling, but that is how the model gets drawn by the renderer.
I'm sure there is a good chance your normal's aren't actually synced 100 percent. Even so, few things to consider:
You are having difficulty in an area where you have several 90 degree corners right next to each other, so its a particularly challenging example with lots of normal map gradation. Personally, if I get trouble spots around more sharp angles, I just throw edge loops in to have more vert normal info for a cleaner, more localized normal transition.
Another thing that may not be a factor here, but still worth thinking about. If your texture is a little lower res or your mesh is LODing, things wont line up perfectly. The lower res texture is even more of a problem with sharp gradations in the normal map. If there are only so many pixels to handle a gradient you can sometimes get some artifacting.
In your position, I'd just roll with the hard edge, or container loops and move on. Your adding a small number of verts, and it will technically read a little better with texture mips/mesh lods anyways.
Personally I split up my UVs from how I split my normals, because it gives me 80% of the unwrapping done at the click of a button.
But having one smoothing group is actually worse, because after compression hits your texture, you'll get more artifacts where there was harsher gradients. This really only matters with in worst case scenario situations like glossy materials, specular highlights, reflections, and metals.
Roughness of .125 and .0.
Goes from 1 smoothing group to split on uv seams to split on uv seams with custom normals. This using the worst case scenario mesh that has been posted many times on polycount. Baked as a TIFF in xNormal, compressed in Photoshop to a TGA, and put into UE4 using the synced workflow. Screen space reflections were disabled and this is in the default advanced lighting map. These angles were picked to showcase artifacts around where the cylinder connects to the body on the front face. Artifacts are pretty much gone above 0.4 roughness.
I'd only use one smoothing group if it was required by the studio you are working for, or your workflow needs it.
@ZACD: yeah, I'll harden edges on UVs splits from now on anyway (as I have always been doing), it's just nice to know that my maps are 100% synced now.