Question

I am looking for a 3D implementation of triangle rasterization using Bresenham's line drawing algorithm. Namely, I have this source:

http://www.sunshine2k.de/coding/java/TriangleRasterization/TriangleRasterization.html,

however the algorithm is in 2D. Is there any way I can extend this to 3D?

Thank you

Was it helpful?

Solution

There is a posted 3D Bresenham here. The code is in matlab script, but I believe it would be straightforward to convert it to C++.

OTHER TIPS

As a first attempt, you can try to modify one of the 2D standard or Bresenham triangle algorithms so as to compute (X, Z) coordinates instead of X alone (computing intersections in the XZ plane or drawing with the 3D Bresenham line algorithm) and join the points using the 2D Bresenham line algorithm between these, instead of a simple row of pixels.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top