Damn this is all coming back to me now from ps1 programming days…
You have to subdivide your quads/tris to get the correct affine mapping. (I understand some of those words.)
I hacked up a subdivision routine… I only tested it on a 1 quad geometry but it might work with multiple quads…
Its “subdivideQuads” … apologies its messy…
Change subd to 1 for no subdivs… i think 8 was kindof a standard back then…
Can you load up a fiddle with more data/quads? Or see if that routine works in your scenario…
theres a different kind of subdiv/triangulation you might could do instead… like a triforce instead of subd’ing the quads… but… this sorta seems to work…
Thanks for your help manthrax, indeed it fix the distorsion, but i’d prefer not the geometry to be modified as i want a true fidelity of the base mesh.
I’ll add the full object on another fiddle to have a complete case!
Here it is: https://jsfiddle.net/L68ort53 (it’s a real implementation of what is used on my project: non indexed geometry with multiple materials for each face).
This has all been done and covered to the exact same result in the thread which @Ryudo linked in his 1st answer of this thread. A link, which btw. I apparently was the only one to actually read (and recognize).
Yeah I didn’t read the whole thread.
But I’ve written fake perspective correction code on old consoles, and this is similar, as evidenced by being able to approximate it with subdivisions.
There was a similar problem on the ps1 to get perspective slightly-more-correct texturemapping. It also didn’t have a near clipping plane… so you basically had to subdivide triangle primitives to some arbitrary amounts to avoid triangles dropping out entirely when they got too close to the near plane… but the same principles apply…
you trade some vertex bandwidth for enough samples to “nail down” the texture.
btw OP, the scheme with making a vertex group per quad with a different material per quad will likely break down pretty quickly.
imo your best bet is to unroll all that geometry into quads, and all referencing a single texture atlas of all the textures.
r.e. the paper on quadrangles… it does not spark much joy for me. I’d be mighty impressed if you got somewhere with doing it in a shader.
Another approach might be to do a bilinear interpolation like they describe in the paper, but I think that would require each triangle having access to the original quad its a part of. You could write the quad vertices to a texture to achieve that. It sounds gnarly tho.
subdivided quads on the other hand increase your (relatively small) geometry size by 64x for a similar effect, and possibly lower complexity, and doesn’t require complex shader/data setup. GPUs now render millions(s) of triangles. Sega saturn topped out at ~3k…
What’s the approx triangle or quad count on the fattest scenes you have access to?
Previously, i had separate geometries for each faces but i had issues to smooth objects (as discussed here).
I would say that the fattest map is around 10k triangles (the scene is displayed fully on my project vs. the part seen by the camera on the Sega Saturn).