# 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 on other sites

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.

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

##### 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.

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

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

## Create an account

Register a new account

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×