View Full Version : Bilinear Interpolation
I want to implement a function that will shade any triangle using bilinear interpolation. Can you point me to the right direction?
11-20-2003, 04:01 AM
"Bilinear interpolation" is not used to shade the triangles - it is used to increase the texture quality! ("trilinear interpolation" and "anisotropic filtering" are also used).
OpenGL has 2 shading modes: smooth (by default) or flat. You must use functions, whose names fail me now.....
11-20-2003, 12:29 PM
bilinear interpolation (BI) can be done on anything. It is not restricted to textures.
Gouraud shading (GL_SMOOTH) is a form of bilinear interpolation and it interpolates the vertex color of a polygon.
Search for scanline rendering or scanline conversion.
11-20-2003, 11:57 PM
Correct me if I'm wrong, but I believe that you do linear interpolation along the edges of the triangle, and then you do linear interpolation between the edges on a scanline-by-scanline basis.
Be aware that you have to make special solutions if you want to use clipping (e.g. against the border of the drawing area).
Of course, one nice soulution might be to draw the triangle using OpenGL with smooth shading enabled, and read back the pixels. (?)
11-21-2003, 01:51 AM
>>Correct me if I'm wrong, but I believe that you do linear interpolation along the edges of the triangle, and then you do linear interpolation between the edges on a scanline-by-scanline basis.<<
Yes, interpolating along the one edge which has no "knee" and then linearly to the opposite edge is one way.
The triangle edges build a basis and you vary the values along these two base vectors, it's as bilinear as it can get, and always works because a triangle is always planar.
Search for "Bresenham" and "DDA".
[This message has been edited by Relic (edited 11-21-2003).]
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.