Lighting glitch on Instanced Static Meshes

When using instanced static meshes that use meshes imported from Blender and materials set in the Unreal Editor, there is a bad lighting glitch on one side of the instanced mesh. When the “Use MikkTSpace Tangent Space” box is unchecked in the static mesh editor, everything is back to normal. This glitch did not happen with individual static mesh actors.

The first image is with “Use MikkTSpace Tangent Space” checked.
The second image is with “Use MikkTSpace Tangent Space” unchecked.

Hi Bill,

More than likely this depends on how the mesh has been UV’d because the MikkTSpace option will alert you to these shading errors that can occur. Turning off MikkTSpace uses the older method that can produce shading issues due to improper tangents.

Also, there were some improvements with instanced static mesh lighting that went into 4.9 which you can try since this released today.

I did try to reproduce this on my end, but I suspect that I’m not setting something up as you have. If you’re still having the issue would you mind linking a simple project here that reproduces and I’ll have a look.

Thank you!

Tim

I upgraded to 4.9, but the error is still there. It still works when I uncheck “use MikkTSpace” however.

I created a simple project that produces the result:
https://drive.google.com/file/d/0B_cJLQy8HuSXblBOUXVHRVZJMEU/view?usp=sharing

Also, here is some more information about the workflow I used that might be helpful:

  • When I’m exporting from Blender I export as an fbx file, check “selected objects,” uncheck “add leaf bones” and “baked animation,” and select face smoothing.
  • When I’m importing into UE4 I uncheck “Auto Generate Collision” since my game doesn’t use any collision, and I uncheck “import materials” and “import textures” because I apply materials I create in UE4.
  • In the project settings, static lighting is disabled since the game I’m creating is completely procedurally generated so there isn’t anything that can have baked lighting.
  • The instanced static meshes in this example project are spawned in a c++ class called “TestInstancedStaticMeshActor.”

I also noticed that in 4.9 there is a new option in the import settings that lets you select if you want to use the MikkTSpace or the old space.

And by the way, is there an advantage to use the MikkTSpace? Does it perform better than the old method? I wonder if I should be concerned about this if using the old space is just as good. I plan on possibly making the game run on mobile devices, so I want the best performance I can get.

Looking at simply the mesh, the shading problem is coming from that. The UV is not setup so that each face is flattened out properly.

This is what will throw the flag for MikkTSpace and Degenerate Tangents. If you look at this post there is a couple of images to demonstrate why this is.

UE4 moved over to using MikkTSpace normals by default. This is to provide more accurate lighting and normal information. In the image in the link where the UVs are stretched you can see that the Normals are all skewed which can create lighting issues to crop up.

The option is there so that you have a choice, so long as you’re aware of the choice, otherwise it’s the default to MikkTSpace.

If you’re seeing results that work for you without MikkTSpace then it’s OK to use this. If you see shading or lighting issues you would want to UV these so that all the faces are setup properly.

I’ve corrected the UV on your mesh in 3Ds Max and reimporting and the degenerate tangents issue is resolved.

I hope this helps, and if I’ve been a little unclear let me know.

Tim

Oh okay, I get it now. I’m new to 3D modeling, and I didn’t realize that I needed to create a UV map even when there aren’t any textures being used. I got it working with the MikkTSpace now. Thanks for your help!