To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 3567
3566  |  3568
Subject: 
Re: Drawing triangles in a Z buffer
Newsgroups: 
lugnet.cad.dev, lugnet.off-topic.geek
Date: 
Wed, 13 Feb 2002 14:04:25 GMT
Viewed: 
10 times
  
In lugnet.cad.dev, Jeremy H. Sproat writes:
Hey all,

In trying to implement a LDraw renderer I've been scouring the web looking
for raster-painting algorithms.  While I've found plenty of line-drawing
algorithms (the Bresenham seems to be pretty nice) I haven't found squat for
drawing a filled triangle or quad.

I've pretty much figured out how to draw a triangle in 2d based on the
Bresenham line-drawing algorithm, but I'm frankly stumped when it comes to
the z-buffer.  What I *do* have is absolutely riddled with floating-point
divides, and doesn't quite work anyway (having incorrectly determined the
z-slope of the triangle in order to determine the z-depth at an arbitrary
point).

Does anyone have an algorithm they'd be willing to share?

If you don't mind C code, there's the zAddTriangle() function in stub.c
in the ldlite or ldglite source code.  The old 1.6 ldlite source is a
bit easier to follow since it doesn't have all the extra shaders.  Also,
it's a linear z-buffer, which is a bit easier to use in some cases, but
tends to allow more bleed through (z-fighting).

Have fun,

Don



Message is in Reply To:
  Drawing triangles in a Z buffer
 
Hey all, In trying to implement a LDraw renderer I've been scouring the web looking for raster-painting algorithms. While I've found plenty of line-drawing algorithms (the Bresenham seems to be pretty nice) I haven't found squat for drawing a filled (...) (23 years ago, 13-Feb-02, to lugnet.cad.dev, lugnet.off-topic.geek)

6 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR