Advertisement

What's the real tech behind the GPU triangles Clipping

Started by September 17, 2018 07:42 AM
2 comments, last by iGrfx 6 years, 4 months ago

 

I've learned that the triangle clipping in the rasterization process usually using Sutherland–Hodgman algorithm. I also found an algorithm called "Guard-band". I'm writing a software raster so I want to know what technical the GPU use, I want to implement it for study. Thanks!

updated: what's the more proper triangulate algorithm?

I can point you to one working example in my code - https://github.com/Zgragselus/SoftwareRenderer - this one uses Sutherland-Hodgman algorithm, yet it isn't done the same way GPU does it. I actually did correct it at one point - yet in the source which I can't share right, it was for high-performance software rendering in browser. I could dig it out and explain a bit, but it won't be earlier than in 2 weeks (as I'm still on holiday).

What you want to do is to perform homogenous clipping in 4D space (to avoid nasty problems with perspective divisions, which I didn't get around in the code I'm linking here). Googling for 'homogenous clipping' will give you results you want to read.

 

Few links that could help:

http://medialab.di.unipi.it/web/IUM/Waterloo/node51.html - is explaining in brief detail

https://www.microsoft.com/en-us/research/publication/clipping-using-homogeneous-coordinates/?from=http%3A%2F%2Fresearch.microsoft.com%2Fpubs%2F73937%2Fp245-blinn.pdf - is explaining in depth

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

Advertisement
1 hour ago, Vilem Otte said:

I can point you to one working example in my code - https://github.com/Zgragselus/SoftwareRenderer - this one uses Sutherland-Hodgman algorithm, yet it isn't done the same way GPU does it. I actually did correct it at one point - yet in the source which I can't share right, it was for high-performance software rendering in browser. I could dig it out and explain a bit, but it won't be earlier than in 2 weeks (as I'm still on holiday).

What you want to do is to perform homogenous clipping in 4D space (to avoid nasty problems with perspective divisions, which I didn't get around in the code I'm linking here). Googling for 'homogenous clipping' will give you results you want to read.

 

Few links that could help:

http://medialab.di.unipi.it/web/IUM/Waterloo/node51.html - is explaining in brief detail

https://www.microsoft.com/en-us/research/publication/clipping-using-homogeneous-coordinates/?from=http%3A%2F%2Fresearch.microsoft.com%2Fpubs%2F73937%2Fp245-blinn.pdf - is explaining in depth

Thanks Vilem! So the GPU using Homogenous Clipping while some software raster using Sutherland-Hodgman?

This topic is closed to new replies.

Advertisement