Jump to content
  • Advertisement
Sign in to follow this  
stonerose2

Linear Interpolation in 3-Dimensions

This topic is 5026 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

Im implementing a software Z-Buffer in my rather simple Rasterizer. The problem is that when all projection and rotations are performed it is, of course, only on individual vertices and then lines are drawn from vertex to vertex using Bresenham's Algorithm. I need to build up the Z-Buffer before doing any actual drawing, so I need to Interpolate from vertex to vertex finding Z-values of individual pixels on the line. Im searching and searching and I can only seem to find information on what Linear Interpolation is and nothing on how to actually do it. How exactly do you calculate Z values for each pixel on the line?

Share this post


Link to post
Share on other sites
Advertisement
Usually z-buffer is filled as you fill/shade polygons. When shading you will have to calculate the z-value for every individual pixel (directly or indirectly). How to calculate z? If you now z in both ends of your line, then its just simply z = z1*t+z2(1-t), where t is point in your line going from 0 (start) to 1 (end). Assuming you're not using perspective correction.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!