Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: How to access the neighbor texel of a texel in the fragment program?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Hangzhou, Zhejiang, China
    Posts
    11

    How to access the neighbor texel of a texel in the fragment program?

    We can use TexCoord to access the texture and get a value stored in the texture. In fragment program shader, wo can use TEX/TXB/TXP instruction to access a texture. But how to get a texel's neighbor texel? Please advise me.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    Re: How to access the neighbor texel of a texel in the fragment program?

    That's pretty easy: sample the same texture but with texture coordinates offseted by one pixel in the direction you want to access to.

    For example, if you render a quad on TMU0 with a 256x256 texture T and tex coords [0,0]->[1,1], if you want to access the right neighboor pixel on TMU1, bind T with tex coords [du,0]->[1+du,1] with du=1/256.

    Y.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Hangzhou, Zhejiang, China
    Posts
    11

    Re: How to access the neighbor texel of a texel in the fragment program?

    Thanks!
    I want to use CubeMapping for generate the point light shadow. The problem is when I do not sample a pixel's neightbor poxel, the shadow border is artificial. So I want to sample the neightbor pixel of the cube_map texture, such as the up, down, left, right pixel of the pixel.
    How to resolve it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •