Hi everyone,
I'm currently working with a graphics API that only support REPEAT and CLAMP modes for texturing. I get those ugly seams that are caused by filtering. Any idea how to fix the seams without using a CLAMP_TO_EDGE extension?
Thanks in advance.
Fixing texture seams without GL_CLAMP_TO_EDGE extension
Create a border on the texture with the edge pixels repeated. If you also use mip-mapping it's a bit of a waste if you need many mip-levels.. perhaps you can do it in a shader, if you're using them?
By ugly seams, do you mean a tear effect or the edges looking dirty?
EDIT:-
For now I'll assume dirty edges, if you want to do this without the extension you'll need to pinch your UVs in by half a normalized texel width/height, because the texel centre is 0.5, and of course 1.0 is 0.0, if that makes any sense.
Using 0-1 for uv's and if you have a primitive moving slowing sub pixel level you'll find the top and left will appear to have a cropping artefact and bottom and right will appear to have a pulsating halo artefact.
Hope this makes sense and I hope I've not misinformed.
EDIT:-
For now I'll assume dirty edges, if you want to do this without the extension you'll need to pinch your UVs in by half a normalized texel width/height, because the texel centre is 0.5, and of course 1.0 is 0.0, if that makes any sense.
Using 0-1 for uv's and if you have a primitive moving slowing sub pixel level you'll find the top and left will appear to have a cropping artefact and bottom and right will appear to have a pulsating halo artefact.
Hope this makes sense and I hope I've not misinformed.
By ugly seams, do you mean a tear effect or the edges looking dirty?
EDIT:-
For now I'll assume dirty edges, if you want to do this without the extension you'll need to pinch your UVs in by half a normalized texel width/height, because the texel centre is 0.5, and of course 1.0 is 0.0, if that makes any sense.
Using 0-1 for uv's and if you have a primitive moving slowing sub pixel level you'll find the top and left will appear to have a cropping artefact and bottom and right will appear to have a pulsating halo artefact.
Hope this makes sense and I hope I've not misinformed.
I'm having that weird effect when moving a camera around.
How do I move it half a normalized texel? I have something like
float p1 = sprite_origin.X/texture_width;
float p2 = sprite_origin.Y/texture_height;
float p3 = sprite_origin.Right()/texture_width;
float p4 = sprite_origin.Bottom()/texture_height;
I'm assuming it's not just adding 0.5f right?
I had the same trouble once, I have a 3D plaza on my blog and you can see the edges on the sky box, i used to use texture coordinates to not display the edges for example use 0.03 instead of 0 and to use 0.92 instead of 1, but i remember you coul still see where joined the both textures. When i used gl_clamp_to_edge the problem was solved but i had another issue that i can remember right now,
I will be watching this post to see the correct answer
by the way this is the project
http://vasilydev.blogspot.com/2011/08/3d-square-with-opengl-and-c.html
I will be watching this post to see the correct answer
by the way this is the project
http://vasilydev.blogspot.com/2011/08/3d-square-with-opengl-and-c.html
sorry not been around for a while so missed this post.
given your uv's are 0 -> 1 and your texture is 64x32 then uadj = 0.5 / 64 vadj = 0.5 / 32
then assuming a clockwise order.
u(0) += uadj v(0) += vadj // top left
u(1) -= uadj v(1) += vadj // top right
u(2) -= uadj v(2) -= vadj // bottom right
u(3) += uadj v(3) -= vadj // bottom left
given your uv's are 0 -> 1 and your texture is 64x32 then uadj = 0.5 / 64 vadj = 0.5 / 32
then assuming a clockwise order.
u(0) += uadj v(0) += vadj // top left
u(1) -= uadj v(1) += vadj // top right
u(2) -= uadj v(2) -= vadj // bottom right
u(3) += uadj v(3) -= vadj // bottom left
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement