Jump to content
  • Advertisement
iGrfx

3D What's the real tech behind the GPU triangles Clipping

Recommended Posts

 

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?

Edited by iGrfx

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!