Sprite Candy Corrupt gfx img uses texture to edge

Blitz3D Forums/Blitz3D Userlibs/Sprite Candy Corrupt gfx img uses texture to edge

Ian Martin(Posted 2011) [#1]
Corrupted graphics on images that use entire texture to the
edge.


Has anyone else experienced this problem? I am using
1024x1024 textures for the backgrounds on my game. I am
using two of them on a 1920x1080 screen. Each background
piece uses the entire texture, on a separate layer, a
1024x1024 image. In game, a line, usually dark or bright,
sometimes different colors, not one solid color, one pixel
wide appears between the two images. I have adjusted the
pieces + or - pixels so I know this is not the problem.
When I pull the images up in a paint program and cut and
paste them side by side there is no 'seem'. The
seem looks like graphical corruption. I am using .png
images, 24 Bit Depth. They are not masked images, straight
blocks of picture.

I have also noticed this happening with my sprites. I am
using one texture per sprite, one layer, one image. I have
not optimized them yet, so they are each on one texture. I
notice dark spots, lines, pixels, which seem to be at the
edges of the sprite. I have noticed this seems to happen
on sprites where the content of the sprite goes to the edge
of the texture. In other words, when there is not the
masking color at the edge of the texture. When this
happens, I have made the texture larger so I could float
the content in the middle of the gross pink masking color
(255,0,255). This seems to make the problem go away. This
is not an option for the background pieces, as adding a
masking color makes them take WAY more time to load.

I have also noticed this happening with a font that came
with Sprite Candy...there is a small dark mark above the
'g' or 'n'.

I am using Blitz3D 1.106, Sprite Candy 1.0.15, Windows 7/32
Home Premium, 3.40 GHz AMD Phenom II X4 965 Black
processor, 4GB RAM, nVidia GeForce GTS 250 2414 MB, DirectX
11.

Has anyone else experienced this problem? IF anyone has a
fix, please respond to this and let me know :)


Ian Martin(Posted 2011) [#2]
*If


Ian Martin(Posted 2011) [#3]
I sent Mike an email and got a response a couple of hours later(!):
Hi Ian,
those seems are caused by UV texture coords interpolation, this is a common problem with 3D graphics and engines. You’ll need to leave a gap between the images or at the texture’s edges, approximately 2 pixels wide.

Kind Regards,
Mike


So it looks like the solution is to use 1024x1024 textures and use 1000x1000 pixels from about 12 pixels inside. This will be nice anyway, as that will give 1000x1000 chunks, easier math :)


Yasha(Posted 2011) [#4]
Hang on...

Sprite Candy is a B3D source code library, right? So you can look through it as well as your own code. Are you making sure that images intended to be used as images are loaded with flags 16 and 32? This is supposed to prevent interpolation across the edge of textures.


Kryzon(Posted 2011) [#5]
Yeah, clamping is a great idea.

It also fixes seams in skyboxes, if anyone ever faces this issue.


Ian Martin(Posted 2011) [#6]
Thanks Yasha and Kryzon! I just tried it with a couple of pieces of the background and the seems are gone :)
Like this:
TextureBackground03=HUD_LoadImageResource("gfx/LAb001.png",16+32)

TextureBackground04=HUD_LoadImageResource("gfx/LAb002.png",16+32)


Ian Martin(Posted 2011) [#7]
This doesn't seem to work on the sprites. I have to add a couple of masking pixels on each side. The backgrounds are seamless now though.