Tuesday, December 13, 2005

Working hard under the decimal point : What to do if when you move your camera the border pixels of your textures disappear or get stretched

It seems as thought I've solved the graphics problem, which goes to prove that if you keep bashing your head against it the wall will eventually break (provided you don't die from a brain heamorrage that is). After asking on every message board I could think of and even a IRC chat room or two I managed to stumble on to what seems to be the possible solution by myself. Finding a solution is one thing ... a reason is quite another. I can make guesses why my fix works but I don't think I'll ever go digging for the truth, though it would be nice if some body would tell me :D I have ideas, hypothesis' - yes - but nothing verifiable.

Anyway enough ranting here's the solution I worked on, thus titled: "What to do if when you move your camera the border pixels of your textures disappear or get stretched."

1. Read the mapping pixels to texels thing.
2. Don't translate your camera by a very small number. (I was doing 0.003)

I fixed this by scaling everything up so my view port is currently 800.0f by 600.0f and my textures are some equally large number (I may try and half this, or at least get some nice balance). I move by a full 1f instead of some dodgy fraction. And that's it, the mystery of the missing borders solved. It must be something to do with rounding error, something that's happening far far away in the arch-under-sewer in the sixhundred and sixty sixth level of the direct x API.

Anyway thank you to the following places:

GameDev Help Me Post
The Game Wiki Help Me Post
Usenet Help Me Post
MSDN Help Me Post
Mr Gamemaker Post

Post a Comment