specular artifacts caused by scale maps with directional lightmaps

Hello,
Using unity pro and 3dsmax 2010 with fbx 2012.2 plugins. I am trying to blockout lighting materials for a scene and there are significant artifacts being baked into the scale maps. The lighting setup is currently a skylight + a single directional light. Currently the model is force triangulated inside max and I have tried importing my normals and tangents and have also tested letting unity calculate that information. Also, this happens with imported lightmap UVs or unity’s automatic lightmap UVs. This image should sum things up easily:

I tested some new meshes to try and track down where the problem was coming from. First, a unity cube looks correct. Next I tested a cube out of max and it looked good. I added a small steeple shape and that also looked good. When I made some extrusions off of that mesh to make a more complicated model the shading errors started popping up. I think this is vertex order related.

To illustrate this more clearly I made two test objects. The left version is made by extruding a polygon off of a cube. On the right I moved those vertices out and then sliced in an edge loop. Same topology, different vertex order.

Are you using proper secondary UVs?

I am. The problem also happens when I let unity generate UVs. Additionally, the lighting information in the lightmaps looks correct.

I used one of these shaders to illustrate the second channel UVs:

I also desaturated the scale map as a test and it cleans up the errors.

I think I have tracked down the cause and a solution to this problem. It seems that directional lightmaps sometimes throw these errors out in areas where the model has a smoothing split but the lightmap UVs do not. What is strange about this problem is that it doesn’t do it on all polygons. Having UV splits to match smoothing splits is probably a good practice anyway since it cleans up the small interpolation errors at the edge of stitched faces.

If possible I think this should be fixed since it seems probable that unity’s automatic lightmap UVs will not split these faces correctly.

Interesting. I’ve been having similar issues (if only I’d found your post first). What I found was that the specular artifacts were showing as seams - which might be a similar effect you’re seeing there, just harder to spot as such because of the lower res of your model.

I’ll have to try this out myself - just to go over it again, you’re matching the split in the lightmap (UV2) with the split in the diffuse map (UV1) to overcome the error?

Not quite. I am matching splits in UV2 to smoothing splits on the model. This is a good practice anyway since the scale maps contain directional information which needs padding across smoothing splits to prevent those thin line interpolation errors (much like tangent space normal maps).

I have also seen sharp edge shading artifacts on models and they seem to related to splits in UV1. I haven’t done much testing on that yet though.

Ahh I gotcha.

It would be nice to see that fixed, as it does makes most forms of auto-unwrapping (not just in Unity) a non-option. And UV editing complex surfaces in Max 2013 isn’t exactly pleasant :slight_smile:

James O’Hare figured out that this is related to a tangents bug he has previously reported:
http://www.polycount.com/forum/showthread.php?p=1771314#post1771314

Basically, this can be fixed by switching import settings to calculate normals, adjusting the slider to 180 degrees, applying the changes, and then switching back to imported normals.

Brilliant. Thank you very much for the link, James is a star; I’d never have traced that down in a million years.

I don’t know whether to laugh or put a drill up against my head, this stuff’s been driving me nuts as I’m sure it has you too. Fingers crossed it’ll get fixed one day.