Texel Challenge (pixel perfect texture alignment)

Blitz3D Forums/Blitz3D Programming/Texel Challenge (pixel perfect texture alignment)

Shifty Geezer(Posted 2005) [#1]
Talking with swift about GUIs, here's a thing I don't think is possible, but swift thinks otherwise :p Can someone show me I'm wrong with an example?

The idea is to align a texture on a plane so it matches 1:1 texel:pixel, producing an image in 3D of the same clarity as the 2D source.

I've a test image here, 128 pixels square:here

Can anyone map this to a 128x128 pixel square mesh so the result when rendered in 3D with only black and white pixels of a uniform checker pattern?


GfK(Posted 2005) [#2]
Tom Speed wrote a userlib to disable filtering, which will pretty much do this.


Shifty Geezer(Posted 2005) [#3]
Is there a link? swift said I'd find a solution in the code archives but I haven't managed that.


GfK(Posted 2005) [#4]
http://www.tomspeed.com/texture_filters/

[edit] just tested it with your texture. works perfectly.


Shifty Geezer(Posted 2005) [#5]
Many thanks for that link! So it does work, if you deactivate texture filtering (which needs the DX7 jiggery-pokery). And orthographic camera at zoom 0.16 gives perfect pixel:texel relations.

Presumably though, deactivating texture filtering is going to affect all rendering. So if you were to create a UI window for text, say, and render it over the top of a 3D scene, you'd need 2 passes. One for the scene, and then another for the UI, switching filtering on/off between them.

Is there any way to do this with viewports, rendering first one camera to a localised area, and then the other?


sswift(Posted 2005) [#6]
I'm pretty sure you don't need to disable texture filtering to do this.

There are many GUI systems designed to work in Blitz 3D which have pixel perfect GUI's.

This one for example:

http://www.blitzbasic.com/toolbox/toolbox.php?tool=27

Did you even LOOK for one? :-) Sheesh! I'm prety sure there's code in the code archives to do this too.


skidracer(Posted 2005) [#7]
This is a method to achieve texel -> pixel alignment:

http://www.blitzbasic.com/codearcs/codearcs.php?code=773


Shifty Geezer(Posted 2005) [#8]
sswift : Yes there's lots of 2D GUIs. I've had a look at most of them. But they don't combine 3D, or at least not speedily, and they're Windows based, not just simple buttons. Or they're in French and I don't understand them. That said, I didn't look at the one you linked to for some reason...

And I couldn't find anything in code the archives mostly because they're not well organised (that's my excuse anyway!). I mean, the example Skidracer linked to was good, but being called 'Pixies' a scan of the list had it overlooked.

Um...I'll just leave now and let you people get on with your work (docks cap ;)