Triangulation help needed

Started by Aisaaax, June 17, 2020, 05:55:04

Previous topic - Next topic

Aisaaax

I'm not sure if it's the right forum for that, but here we go.

I get a random contour. I need to transform it into a polygon and display it in 3d space. (A)

Normally, I would do it through a standard ear-clipping algorhythm, and the result will be something like (B)

However due to a bug in the graphics drivers for the videocard I'm working on (VIVANTE), I can only triangulate small shapes like that. The reason is that when rendering, if a vertex of a mesh lies too far outside of frustum to the left or right - the position is calculated incorrectly. This results in wild flickering and deformation of large meshes on the screen.
It is a confirmed driver issue, and it doesn't happen on other platforms or even with the older version of drivers for the same videocard. Unfortunately, I can't use the old drivers, and the card manufacturer isn't likely to fix the bug, seeing it's been known for almost a decade.

So I have to use crutches. In other words - I have to split my mesh into several smaller triangles, something like (C)
So that at any point in time, the vertexes of the triangles rendered are not outside of frustum too far.

Unfortunately, there's really no way to do it otherwise that I see.

Can someone help me with an algorythm of splitting/triangulating mesh in such a way? Assume that all "squares" are N-by-N squares with N being specified by me.



abcdef

Post triangulation can you not take each triangle and subdivide to 3 smaller triangles by taking the mid point and connectiving each vertex of the triangle to the midpoint? You can then subdivide far enough to a point of minimium size

Aisaaax

Quote from: abcdef on June 24, 2020, 12:58:53
Post triangulation can you not take each triangle and subdivide to 3 smaller triangles by taking the mid point and connectiving each vertex of the triangle to the midpoint? You can then subdivide far enough to a point of minimium size
That's not optimal - results in much more triangles than the grid pattern would yeild.

Anyway, I came up with an algorithm, here it is: https://stackoverflow.com/questions/62527504/subdividing-and-triangulating-a-polygon