-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polygons with concavities not converted properly #79
Comments
Thanks for the report @erich666. Right now faces with more than 4 sides aren't supported. #55
Yeah something like that should do it. Also the regex will need to be fixed. |
Cesium uses https://github.com/mapbox/earcut with some extra cleanup stages (and then subdivision stages to fit the WGS84 ellipsoid). Perhaps use |
This sounds like something @hpinkos was working on at our last code sprint. I think there's a branch of Cesium with an almost complete implementation. Maybe it can be applied directly here? |
I've added support for concavities and faces that span multiple lines in the obj. @erich666 , the model you linked looks pretty decent now, but only with backface culling turned off (there are still some issues with winding order). The artifacts in the fountain and lawn are present in the original obj. |
Download the OBJ version of this free model: https://www.turbosquid.com/FullPreview/Index.cfm/ID/691507
When converted by obj2gltf and displayed using three.js's gltf loader, I get the result https://s26.postimg.org/6maqtr28p/bad_gltf.jpg
Note the large triangle over the courtyard, and other defective triangles.
I suspect that it's that there are complex polygon loops that have concavities, and don't get converted into triangles properly. A simple ear-clipping algorithm should probably do the trick.
Here's an example complex outline. Note how there is a "line-continuation" thing going on, also, which may be the problem instead.
f 180072/63637 180073/63634 180074/63631 180075/63623 180076/63605 180077/63592
180078/63584 180079/63567 180080/63553 180081/63547 180082/63543 180083/63532 180084/63520
180085/63516 180086/63504 180087/63503 180088/63488 180089/63480 180090/63470 180091/63458
180092/63443 180093/63440 180094/63439 180095/63435 180096/63438 180097/63428 180098/63423
180099/63425 180100/63424 180101/63412 180102/63411 180103/63402 180104/63393 180105/63384
180106/63381 180107/63365 180108/63351 180109/63348 180110/63345 180111/63342 180112/63339
180113/63319 180114/63316 180115/63313 180116/63302 180117/63286 180118/63276 180119/63259
180120/63246 180121/63241 180122/63234 180123/63224 180124/63222 180125/63223 180071/63638
The text was updated successfully, but these errors were encountered: