OmarShehata / webgl-outlines

Implementation of a post process outline shader in ThreeJS & PlayCanvas.
MIT License
376 stars 41 forks source link

Automatic merging of vertices based on angle #8

Closed OmarShehata closed 1 year ago

OmarShehata commented 1 year ago

In Better outline rendering with surface IDs we can see that using a surface ID buffer gives you more stable outlines vs just a normal buffer.

One problem with this is you might need to go through your geometry and merge a lot of vertices manually for faces that should all be considered one surface.

I think it should be possible to do this almost completely automatically. It would work like this:

The only manual part about this is setting the threshold, but I think that's something that would be far easier to tweak than the normal buffer parameters.

If we can have a utility like that, then you'll be able to have very clean outlines by default, while still allowing you to edit individual edges in the model. It'd be the best of both worlds.

OmarShehata commented 1 year ago

This is now resolved by: https://github.com/OmarShehata/webgl-outlines/tree/main/vertex-welder#vertex-welder

However, there's a number of caveats which I have listed at the end of that README. The biggest one is that texture coordinates get messed up when you delete vertices.