# 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.

## 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 on other sites
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 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.

1. 1
2. 2
3. 3
4. 4
frob
11
5. 5

• 16
• 13
• 20
• 12
• 19
• ### Forum Statistics

• Total Topics
632172
• Total Posts
3004569

×