Texture crispness

Blitz3D Forums/Blitz3D Programming/Texture crispness

Warren(Posted 2003) [#1]
I searched the forums for a while and read through several topics on this subject. I've learned that, no, I can't turn off bilinear filtering which is really annoying.

However, it's not a problem without solutions ... I can pad my GUI graphics and such to minimize the nasty border effects that show up, etc.

What I'm wondering is what are peoples recommendations to get the crispest textures possible, despite bilinear filtering working against us? File formats? LoadTexture flags?

Any suggestions welcome. :)


GNS(Posted 2003) [#2]
The only alternative I know of is to completely disable mip mapping (ClearTextureFilters()) which isn't exactly an efficient solution. Possibly up the texture resolution as well.


sswift(Posted 2003) [#3]
"I can pad my GUI graphics and such to minimize the nasty border effects that show up, etc."

Pad the GUI graphics? Why not just use UV clamping? That clamps the color at the edge so that the texture will not repeat. Which means that the edges will not bleed color over from the other side. Which I assume is the problem you're having.

You can activate UV clamping with a textureflag on (I think) loadtexture and createtexture.



Another way to achieve that blocky pixel look is to use larger textures. Scale the texxture up in photoshop to 2x or 4x it's size using "nearest neighbor" filtering, and the pixels will be doubled or qudrupled in size. This shouldn't affect the compressability of the file too much even if you use uncompressed BMP's. Blitz cannot read RLE compressed BMP's for some reason.


And another way to enhance crispness is to be careful in designing your textures. In my game for example, I use cartoon textures which are generally two colors. The rivets on my tiles are a 2x2 block of pixels.

The trick here is to make sure that 2x2 block is aligned so that the number of pixels before and after it is divisible by 2 evenly. Ie, I should not have one pixel, then a 2x2 block, then another pixel if I have a texture that is 4x4. The reason for this is because at the first mipmap level, where the detail is halved, if the 2x2 block feature is "hanging over" the edge of a boundary, it will get blended with other image colors when it gets blended down to a 1x1 block. However, if it is aligned properly to a 2 pixel boundary, then it will blend only with it's own colors, and remain sharp for at least one more mipmap level than it might otherwise.

Might make sense to work with two copies of your image open, one window at 50% magnification, when creating a texture in photoshop. Might help to create sharper textures. I've never tried this though.


Warren(Posted 2003) [#4]
GNS
The only alternative I know of is to completely disable mip mapping (ClearTextureFilters()) which isn't exactly an efficient solution. Possibly up the texture resolution as well.

I'm doing that at the moment and it looks OK, but I was hoping for more. I don't really need mipmaps since the game is 2D and the card will never get to use them anyway.

Upping the res is a possibility I guess ...

sswift
Pad the GUI graphics? Why not just use UV clamping? That clamps the color at the edge so that the texture will not repeat. Which means that the edges will not bleed color over from the other side. Which I assume is the problem you're having.

Right, but I was trying to have all the GUI components stored on one texture and I just move the texture coordinates around to display different parts when needed. Clamping won't help me there.

Another way to achieve that blocky pixel look is to use larger textures. Scale the texxture up in photoshop to 2x or 4x it's size using "nearest neighbor" filtering, and the pixels will be doubled or qudrupled in size. This shouldn't affect the compressability of the file too much even if you use uncompressed BMP's. Blitz cannot read RLE compressed BMP's for some reason.

Interesting, I'll look into that.


sswift(Posted 2003) [#5]
You will of course, be using more video ram. It's a tradeoff. My game doesn't use many textures. It could probably run on 2mb of texture ram. :-) So I can waste some.