• Advertisement
Sign in to follow this  

get all pixels of a triangle

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i want to implement a z-buffer. now i need to calculate the depth (z value), for every pixel in my triangle. how can i get it? all i have is the x, y, z values in 3d space and my u and v values in 2d space. i don't know how to get every pixel in 2d space and the z value of it? hope that some of you math gurus can help me out of this.

Share this post


Link to post
Share on other sites
Advertisement
You have the XYZ in the model space? in World space? in View space or in Projected space?

I guess you should read a computer graphics book. Foley books being the basic text, it has information about this.

Luck!
Guimo

Share this post


Link to post
Share on other sites
i have x y z in view space. and the additional u and v values in my projection view.

please help me out guys! :-)

Share this post


Link to post
Share on other sites
pikebu,

The algorithm you're looking for, to determine the pixels (including the Z, or depth, value), is called "polygon scan conversion". There are a number of websites that provide pseudocode and actual working code. You should be able to find some of these sites using any search engine.

Guimo suggested that you take a look at the book by Foley et al., titled "Computer Graphics: Principles and Practice". Its good advice that helps you to find the answer to your question. This book discusses the standard algorithm for polygon scan conversion and the entire model space to camera space to screen space pipeline that preceeds scan conversion.

Scan conversion has been discussed in the forum previously. Try doing a forum search for "polygon scan conversion." That may help you find some good websites quickly.

Hopefully these hints will get you started. If not, post again and perhaps sometime next week I can dig out a few web links for you. But, please understand I personally will not document the algorithms here. There's just too much good information on the web already, and I am only willing to point you to what is already out there.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement