TheDuckCow / godot-road-generator

A godot plugin for creating 3D highways and streets.
MIT License
313 stars 16 forks source link

Generated faces are not connected #124

Open TheDuckCow opened 9 months ago

TheDuckCow commented 9 months ago

After inspecting a GLTF export of the generated roads, it became very obvious that the generated meshes aren't using shared vertices and aren't being smoothed. In the gltf file, I'm seeing the re-exported cars have connected verts (per the video below), but the road meshes don't

https://github.com/TheDuckCow/godot-road-generator/assets/2958461/6d276d01-e87f-4234-a0eb-fcfcb50e548f

We will need to update the generator tool to attempt to set connected verts and create smoother shading.

Depending on what is actually happening under the hood, it's very possible that performance is degraded much more than it needs to be due to extra verts (and possibly UV breaks too, since the UV coordinates would also not be shared).

TheDuckCow commented 3 months ago

For what it's worth: when looking at Godot 4, porting the same code as-is, we have something like half of the vertices end up correctly being merged together. Seems to me that the mode for joining verts automatically is too strict or not that reliable, so either way we'd need a more deterministic way to ensure verts get reused.