• Advertisement
Sign in to follow this  

Linear Interpolation in 3-Dimensions

This topic is 4817 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
I'm not sure, but I think if you linearly interpolate the depth values b/w the vertices, problems may arise if you're using a perspective projection.

Share this post


Link to post
Share on other sites
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