I am experiencing a strange situation when creating a 2D filter.
The problem is that when I deform the Texture Coordinate the “offscreen/empty space”, that shoud be Black, gets kind of glitchy.
So, I’m wondering if there is a way to get rid of that.
Here’s the filter code. I’m not gonna post the .blend, because I’ts my personal project…
It somulates a old CRT TV, but the problem is in the screen curvature ( vec2 crt(vec2 coord, float blend); ).
The “empty” areas are glitchy as you can see in the image.
This is what is expected (please note the black areas that BGE don’t leave black):
You could have still posted a simple example blend file, though. If the issue is in the example file, then the problem’s in the script. If the issue’s not there, then you’re missing something in your blend file.
As for the image, you might want to considerably simplify the filter, as it’s not just a CRT curvature filter - it’s something else entirely, like a night-vision filter. This is what coding and bug-fixing is about - if possible, simplify things, rather than adding level upon level to an apparent bug (i.e. is it the crt function? Is it the uv alteration line?).
Finally, I’m not getting that “bug” that you pointed out in my simple example blend file I put together, so there might be something specific to your card that you need to tailor the filter to (i.e. ATI doing something differently from NVidia). What card are you using? Lastly, did you write the entire filter yourself? If not, where did you get it from?
I don’t really write this script by myself. I just converted some glsl filters I found through Google searching.
PS: I’ve modified the filter, and the problem persists.
Oh, and there’s one last thing…
The Filter behaves very strange when I run the game standalone.
Only the left and bottom sides are glitchy…
for( int i=0; i<2; i++ ){
if (abs(0.5-texcoord[i]) >= 0.5){
col = vec4(0.0);
}
}
As far as I can tell this is simply a new “bug” in Blender. When Blender reads a coordinate that’s off-screen, it just clips it to the edge of the screen and takes color data from there; thus, it extends the boundaries, as you see there.
This little thing just checks if the coordinate (for X and Y) is off-screen, and, if so, sets the color to black.
amuddypizzaHere, add this after the “vec4 col = …”:
Code:
for( int i=0; i<2; i++ ){
if (abs(0.5-texcoord[i]) >= 0.5){
col = vec4(0.0);
}
}
As far as I can tell this is simply a new “bug” in Blender. When Blender reads a coordinate that’s off-screen, it just clips it to the edge of the screen and takes color data from there; thus, it extends the boundaries, as you see there.
This little thing just checks if the coordinate (for X and Y) is off-screen, and, if so, sets the color to black.
Thanks! Now everything is rendering without ugliness xD