armory3d / armory

3D Engine with Blender Integration
https://armory3d.org
zlib License
3.05k stars 317 forks source link

Error: Tangent space can only be computed for tris/quads #1411

Open TriVoxel opened 4 years ago

TriVoxel commented 4 years ago

Description Armory3D crashes when I try to build and play a scene with normal maps.

To Reproduce Create an object with a Principled BSDF material and plug a normal map into it.

Expected behavior Export with materials with normal maps

System Blender: 2.80 (Release) Armory: 0.6 (Stable) and 2019.8.0 OS: Windows 10 Graphics card: Intel i3 7020U (2.30 GHz) With OpenGL 4.6, Vulkan 1.1.114, and DirectX 12 support.

Test File Armory 3D Won't Build This.zip

N8n5h commented 4 years ago

Make sure to get rid of n-gons on meshes when using normal maps in materials. The console can be helpful to debug issues with the compilation, you can open it via "Window -> Toggle System Console" in Windows.

TriVoxel commented 4 years ago

Good catch @N8n5h! I thought I got them all but I was wrong. I tried triangulating all objects at once but found a Blender bug actually which prevents it. https://developer.blender.org/T69834 Something to do with multiuser objects breaking with multi-object edit. This was a pretty old, amateur scene so makes sense I'd leave something like that in there. This could be fixed if Armory could triangulate all meshes before building objects/shaders?

EDIT: Works after triangulation of that object!

arigbs commented 4 years ago

An elegant solution would be to weed out all ngons before the Armory build, or triangulate them programatically like @TriVoxel suggests. In large projects, it would be manic trying to track down offending objects manually. Issue still persists.

arigbs commented 4 years ago

Okay, maybe not so manic.......Edit Mode>Select>Select all by Trait>Faces by sides

TriVoxel commented 4 years ago

I think it is not a good solution because if you have hundreds of objects across several collections it can be super cumbersome. And this would confuse newcomers because they may import a crappy model from online and now their build doesn't work right. I think Armory should triangulate all meshes before starting a build or at least have an option to do so so people can preserve their original meshes.