Z-Buffer question...
hi
I am curently writing my own 3D-Software-Renderer.. it´s just for fun... I write it with TurboPascal.. it''s crazy, isn''t it?
until now I have just rendered Points to the screen, but now I have programmed an procedure which draws triangles. At this Point it´s time to use an Z-Buffer.
My triangle is defined as a list of three points.. I convert these points into my 2D Space. I still have the Z-Values saved, but how can I calculate the Z-Value of the points in the inner of my triangle.
please help me..
I''m actually doing the sam thing (but not in Turbo Pascal) and it''s just the question I wanted to ask ...
Pavel "Corpse" Zuna
Pavel "Corpse" Zuna
If you''re doing perspective correct texturing you''ll have a useful value there. But generally you just do a linear interpolation between the Z values of the vertices - this is just the same as you would also do with colours for Gouraud shading.
If you''re using homogeneous coordinates to do your perspective projection (w divide) - you can interpolate by multiplying with 1/w.
--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
If you''re using homogeneous coordinates to do your perspective projection (w divide) - you can interpolate by multiplying with 1/w.
--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
I''m assuming you break your triangle into spans. To do this for triangle ABC, you''re interpolating between A and B, and B and C, to get for each iteration two points, D (on segment AB) and E (on segment BC). Then, to draw each span, you''re essentially interpolating between D and E. Interpolate the Z value as well.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement