Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Interpolation in Texture Mapping

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Derry, NH
    Posts
    126

    Interpolation in Texture Mapping

    When we do texture mapping, can we ask OpenGL to do some of the interpolation work for us or we have to do the interpolation work by ourselves before we map the data?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jun 2003
    Posts
    177

    Re: Interpolation in Texture Mapping

    What do you want to interpolate again?

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Derry, NH
    Posts
    126

    Re: Interpolation in Texture Mapping

    Our data are sparse, if no interpolation, it won't make a smooth bitmap.

    Originally posted by al_bob:
    What do you want to interpolate again?

  4. #4
    Senior Member Regular Contributor
    Join Date
    Sep 2003
    Posts
    135

    Re: Interpolation in Texture Mapping

    If you have a bitmap/texture and want it to be bi-linear interpolated, then the answer is yes, OpenGL can do that for you.

    If you want more advanced filtering methods like a bi-cubic interpolation you have to do it on your own.

    Hope thats helps.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jun 2003
    Posts
    177

    Re: Interpolation in Texture Mapping

    Are you planning to interpolate:
    - texels?
    - texture coordinates?
    - other vertex attributes?

    Is it bilinear or trilinear interpolation, or something else?

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Derry, NH
    Posts
    126

    Re: Interpolation in Texture Mapping

    Thank you all!

    We want to interpolate the bitmap data(color). Bi-linear or even linear is fine with us. How can we ask OpenGL to do the interpolation work? I did not find any parameter in glTexImage2D or gluBuild2DMipmaps that is related to this operation.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Interpolation in Texture Mapping

    Unless there is some extension I haven't heard of, I don't think OpenGL will interpolate texture data for you.

    Just to make sure I understand what you're asking for...

    Say you have texture data for a 256x256 texture. But you only have values for for a set number of points on the texture, like say (100, 100), (32, 69), etc.. And you want OpenGL to interpolate the rest of the texture data for you from these few points?

    I don't think there is anything built into OpenGL to do this. The only way you could probably get OpenGL to do any part of this would be to use those set points, use them as vertices with distinct colors, determine how to use those vertices in some form of polygon, then do a glReadPixels and store that data into a texture. (Or do something similar as a "render to texture" type operation.)

    Or... just do the interpolation yourself. It might end up being easier, and most likely would perform better.

    [This message has been edited by Deiussum (edited 08-26-2003).]
    Deiussum
    Software Engineer and OpenGL enthusiast

  8. #8
    Senior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Derry, NH
    Posts
    126

    Re: Interpolation in Texture Mapping

    You are right, Deiussum. We have data at points and we need some data between points to make the bitmap looks smooth.

  9. #9
    Senior Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: Interpolation in Texture Mapping

    Hello Rong,

    If your points are more or less randomly placed, there is no easy way for OpenGL to help you (you may be able to come up with an algorithm that can be cleverly approximated by some multi-pass OpenGL rendering, but that is probably not what you want).

    If your points are ecenly distributed, say at all multiples of (4,4) or so, then you may be able to put your points in a smaller texture and scale it up to your desired area using bi-linear interpolation (using glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR)). By the way, bi-linear means linear in two directions (U and V), so it's 1st order interpolation (not second order, as one may think).

    Oterwise, interpolating between sparsely & randomly placed points is not a simple task. My first (intuitive?) solution would be to form a polynomial "3D surface" function, z=f(x,y), which satisfies the condition that it includes all known points (e.g. z1=f(x1,y1), z2=f(x2,y2) etc), where z is the "color" you ar trying to produce. Basically an N:th order polynomial for N+1 known points (at least if it was a 1D problem, not sure about the 2D case).

    If you can solve coefficients for the polynomial, you can easily generate your inbetween samples (color=f(x,y), where f is your polynomial). I'm not sure if this is easy/possible/correct/good looking though...

  10. #10
    Member Newbie
    Join Date
    Apr 2000
    Posts
    44

    Re: Interpolation in Texture Mapping

    If you are able to get vertex data (x,y,color) and recreate the trianges/polygons for the mesh represented by the data _THEN_ OpenGL will interpolate the color information for you (if you enable smooth vertex coloring.)

    The tough part here will be getting the data from the image and reconstructing the faces.

    I'm sure there must be some algorithm out there which creates triangle fans or other geometry types out of irregularly spaced data points.


    If your data is already verticies in faces, then - you're in luck!

    -Michael

Page 1 of 2 12 LastLast

Similar Threads

  1. Texture interpolation with vertex buffers
    By misaaak in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 06-25-2008, 02:15 AM
  2. Is there a way to disable texture coordinate interpolation?
    By Aaron in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 02-22-2007, 09:00 AM
  3. interpolation overflow box around 32 bit texture
    By AE in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-04-2005, 06:03 AM
  4. Texture Coordinate Interpolation Scheme
    By cjt in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 12-18-2000, 07:38 AM
  5. 3D Texture Interpolation
    By FBailly in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 09-07-2000, 08:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean