CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Feb 2010
    Posts
    5

    Help on Calculating Depth buffer

    Hi Guys,

    First post here so please be gentle. I am trying to calulcate z-buffer (or depth buffer) of a polygon/surface. But I am trying to do that a very specific way. I have attached some images that go through the theory of how to do this. It would be nice if you can take some time to through the text. Sorry for the bad image quality, I had to compress the hell out of them. If its too bad I can send better resolution images.

    I have gone over this multiple times and cannot understand how to go about it.

    The equation seems simple z = (-Ax - YB - D)/C for the first pixel (x,y) and the just use z' = z - A/C for each successessive x. I can follow the theory upto here but then I loose it. There's something about going down the left edge of the polygon, intersection of the scan line with the left edge etc...I can't figure out how to actually program this.

    So far I have calculated the (A,B,C,D) the plane coefficents and have the code that detects the left edge of the triangle and calculates the slope. After that I am stumped.

    I guess my question is if anyone can help me put this theory into actual code.

    Any help will be appreciated.
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured