-
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.
-
Advanced Member
Frequent Contributor
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.
-
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
-
Forum Rules