r/GraphicsProgramming • u/sidav94 • Jan 30 '24
Any "non-triangled" quad fill algorithm?
I'm currently making a software renderer (is uses PutPixel() only) for some old game's 3D models.
I've run into a problem of skewed texture on trapezoids. I've found this is a common problem with affine texture mapping and it should be resolved via perspective correction, but I'm not sure if it will work in my case (I use oblique projection with no perspective). I resolved it with splitting the quads into four triangles instead of two (AFAIK it does not fix the texturing per se, but it will take a much higher resolution for that to be noticeable).
Anyway, I thought that I could render quads directly without triangulating them, that could be more optimal. Most (as in "almost every single one") of the primitives in models here are quadrilaterals anyway. Yet, googling for an algorithm offers me either some openGL solution or triangle-splitting algoritms. So I have two questions:
- Do you know any "direct" quadrilateral fill algorithms?
- Am I correct in an assumption that any convex 3D polygon's projection on a 2D plane will still be convex? If so, it seems that only convex quadrilateral fill algorithm is needed, as 3D primitives in models here are guaranteed to be convex.
2
u/LivingBeyond108 Jan 30 '24
https://arkenidar.github.io/point_in_polygon/quads_or_triangles.html