Sign in to follow this  
stonerose2

Linear Interpolation in 3-Dimensions

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this