Open apptaro opened 6 years ago
Associated data is here: data-transp.zip
See the comment at: https://github.com/KhronosGroup/COLLADA2GLTF/blob/master/src/COLLADA2GLTFWriter.cpp#L633
This approach is very efficient in terms of runtime, but there are more correct solutions that may be worth considering.
Using a 3D variant of Fortune's Algorithm or something similar to compute a mesh with no overlapping triangles would be ideal.
This is the expected behavior currently; the triangulation performed is very simple. The overlapping nature of the triangle data that is generated is only visible with transparency.
Looking at it again, I think I would use earcut to do this. Compute the plane that the polygon lies on -> project to 2D -> earcut -> map back to 3D
I have a box and a half transparent glass board in my scene in Blender:
Now, I export the scene to .dae without triangulation, then I convert it to .gltf with COLLADA2GLTF-v2.1.2-windows-Release-x64. Alpha transparency conversion is not supported yet (see #168) so I manually edit .gltf file to make my glass board transparent. The result is weird like this:
Now, I export the scene to .dae with triangulation, then I convert it to .gltf, edit .gltf for alpha transparency, then the result is correct like this:
Note that changes in .gltf file is marked by a red line in the editor. I suspect something is wrong with triangulation of polygons by COLLADA2GLTF. It looks as if triangle are doubled for a part of polygon. The same issue happens for polylist, as I confirmed.