texture filtering in orthographic projection

  • Gianmaria

    Gianmaria - 2009-03-12

    i'd like to render a textured quad covering the entire viewport without any shading and perspective projection.
    In my first try i've created a very simple shader that takes the texture and gets the colors from it based on the UV coordinates i pass to the polygon. With a 512x512 image i'd like to render it to a 512x512 window. All works but the image is not as clear as the original texture. I've tried to change the PixelFilter, tried to convert the image with texmake but nothing changes.

    Here's the .RIB (very simple)

    Format 512 512 1
    ShadingRate 1
    ShadingInterpolation "constant"
    ScreenWindow 0 1 0 1

    Projection "orthographic"

    Option "limits" "eyesplits" 3
    Sides 1
    PixelSamples 1 1
    PixelFilter "catmull-rom" 1 1

    Translate 0 0 20

            Surface "flat_texture" "string texturename" ["grid.tif"]
            Declare "st" "facevarying float[2]"       
            Polygon "P" [ 0 1 0
                          1 1 0
                          1 0 0
                          0 0 0]  "st" [ 0 0
                                         1 0
                                         1 1
                                         0 1 ]


    The shaders is this (flat_texture.sl):

    surface flat_texture (string texturename = "";)

          Oi = Os;
          Ci = color texture (texturename, s, t);


    The image is the grid.tif in the RenderMan examples

    http://www.renderman.org/RMR/pics/grid2.tiff.gz  (just extract and rename to grid.tif

    Is there any parameters to change or is this a bug?


    • Eric Hochhalter

      Eric Hochhalter - 2009-03-12

      I remember reading something that may be of help to you.

      From SIGGRAPH 2006 Renderman Course. Download it at:

      On pages 151 - 154 is a discussion of a similar problem faced by Disney Feature Animation in the production of Meet the Robinsons (of course, they were using PRMan, but it should still apply.)

      The were trying to render camera-maps for occlusion in a preliminary pass which would be used in a second render pass to make the final image in PRMan. This meant they had to exactly match textures samples to image pixels. Seems to be a similar problem...

      They had to do two things:
      1 - use a very explicit texture call to lock down the pixel-accuracy of the texture lookup:
      texture("mymap.tex", s, t, s, t, s, t, s, t, "width", 0);
      I think that Pixie supports this syntax, but I have not confirmed.
      But explicitly setting the filter width to 0 in your texture call will be key to getting pixel-for-pixel accuracy. Otherwise, Pixie will default to the normal filtering behavior, which softens the texture to prevent aliasing out there in 3D space.

      2- generate textures without any remapping
      texmake -resize none
      Since you are working with 512 x 512 images, this should not be an issue, however. But a good tip if you ever do use texture sizes that are not square powers of 2.

      Good Luck.


Log in to post a comment.