Quad rendering bug

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: Quad rendering bug

Postby Bart » Fri Sep 08, 2017 10:11 am

Super cool! I forget how Gouraud shading works but if I remember correctly, you interpolate between 2 adjacent vertices along the edge using linear interpolation, and then when each scanline is filled, it is interpolated from edge to edge linearly? This would work the same way for quads, though. So I must be misunderstanding how the interpolation is performed.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Quad rendering bug

Postby Ian » Wed Sep 13, 2017 4:18 am

Unfortunately the code I tested can't handle crazy shape quads :(
So maybe back to the drawing board or write myself something from scratch

I did find this which looked quite promising
https://stackoverflow.com/questions/149 ... -in-opengl
but doesn't handle perspective so would essentially be an affine transform
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Quad rendering bug

Postby Bart » Fri Sep 15, 2017 7:35 am

Ian wrote:Unfortunately the code I tested can't handle crazy shape quads :(
So maybe back to the drawing board or write myself something from scratch

I did find this which looked quite promising
https://stackoverflow.com/questions/149 ... -in-opengl
but doesn't handle perspective so would essentially be an affine transform


Ah I see now. I think I was correct about how Gouraud shading works but indeed, if it's not rasterized natively as a quad, it will be different because the interpolation from side to side will occur between one edge and the hypotenuse (assuming an ordinary quad), rather than across the entire span of the quad. This sounds really tricky but it will be fascinating to see if you can implement an elegant solution! If I recall correctly, it was the norm for software 3D engines in the 90's (e.g., Quake) to support either both triangles and quads, or convex polygons of an arbitrary number of sides. I remember writing a software rasterizer way back when (it's still on my web site here!) and this was the natural way to do it (not triangulating). Never really did anything fancy like shading so I never gave much thought to this.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Previous

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest