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 / 3564
3563  |  3565
Subject: 
Drawing triangles in a Z buffer
Newsgroups: 
lugnet.cad.dev, lugnet.off-topic.geek
Date: 
Wed, 13 Feb 2002 04:42:56 GMT
Viewed: 
15 times
  
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?

Alternatively, is there a specific keyword I should search for that would
help me find what I need in Google or AltaVista?

Cheers,
- jsproat



Message has 4 Replies:
  Re: Drawing triangles in a Z buffer
 
Here is one starting point: (URL) of free information, there is at least one quick-and-dirty FAQ under there written by an excited child. You're looking for something about triangle or scan line rasterization with z-buffer. I assume you've done (...) (23 years ago, 13-Feb-02, to lugnet.cad.dev, lugnet.off-topic.geek)
  Re: Drawing triangles in a Z buffer
 
(...) I may be missing your point/problem but... Think you may need to go bi-linear in your Z calcs. Yes this makes a Suppos'dly one pixel lookup method a two+ per pixel but if you are already using a scan line method you have the precalculated (...) (23 years ago, 13-Feb-02, to lugnet.cad.dev, lugnet.off-topic.geek)
  Re: Drawing triangles in a Z buffer
 
(...) 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 (...) (23 years ago, 13-Feb-02, to lugnet.cad.dev, lugnet.off-topic.geek)
  Re: Drawing triangles in a Z buffer
 
"Sproaticus" <jsproat@io.com> skrev i meddelandet news:GrGFrK.9nJ@lugnet.com... (...) There must surely be one (or more) in Graphical Gems (URL) (if that URL still is valid, otherwise search for Graphical Gems) a bit dated, c code, but useful. -- (...) (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