GoomiiV2 / Rampancy

A new level editor for the Halo games based on a CSG/Brush workflow, similar to Source/Quake level editing.
MIT License
36 stars 1 forks source link

T-Junction Removal #4

Closed GoomiiV2 closed 2 years ago

GoomiiV2 commented 2 years ago

Realtime CSG can produce invalid sealed world meshes some times, this is mostly from it creating T-Junctions in the output mesh. So i need a way to decent and fix those.

A T-Junction is when a vert sits on an edge but isn't connected (there can be a gap, but the output from RCSG doesn't really have those). image

So a rough way for me to fix this would be.

To make this fast I'd want to convert the Unity mesh into a half edge structure and then do the processing on that before converting and exporting.

Notes: Simplgon has the ability to do this it seems: https://documentation.simplygon.com/SimplygonSDK_9.1.225.0/api/tools/tjunctionremover.html They have a free tier, but seems its remote processing with limits so not a good fit for this :<

An example of the problem and needed fix: T-Junction Example

GoomiiV2 commented 2 years ago

Partial fix in 543ae37aca32d37f74a3c7581b4df80cde6a6e7e

The T-Junction fixer still needs to set the right uvs and look more in to stopping it creating degenerate tris.

GoomiiV2 commented 2 years ago

Fixed with a second attempt but with a winged mesh data structure and more thought for the t-junction algo.

This one handles many more edge cases, its still can be improved and I'd like to try later but for now this seems to be working quite damm well :D (quote me with this when it breaks :<)

image

image

image

a9f946d3ba5682d76b5e7c266553f187467a48d5