Archive: Wraped DM won't align


1st August 2007 22:20 UTC

Wraped DM won't align
So, I have an AVS preset I'm working on with a wrap-enabled DM, and the camera is supposed to slide to another grid square of the wrapped image. The avs window is 2 units wide and high (x/y: -1..1), right? So how come when I add exactly 2 to the x or y value, it is slightly offset? I have to multiply it by some random coefficient beginning with 0.99... just to keep it aligned (only for about 50 times, though), but the number is different depending on the dimentions of the window, and I can't trace the pattern.

Is there any explanation/workaround/tips for this?


1st August 2007 22:31 UTC

the same happens to me to, I guess it's a rounding error.

perhaps you could do the wrapping codewise?


1st August 2007 22:59 UTC

I figured it was a rounding error, too.

Codewise wrapping... I have no idea how it can be done.


1st August 2007 23:19 UTC

depends on your exact code and what you want to do.

start with messing with the % operator somehow


2nd August 2007 00:11 UTC

I always seem to have to adjust things by 0.01 or so on everything. It seems to be most obvious on the right side of the window, the 1.01 line of pixels is visible.


2nd August 2007 01:28 UTC

Raz: Yeah, it's also on the bottom.

What's even worse is that I get it to work okay if I add 120 os so to x (by multiplying 120 by 0.996521 or something along the lines of random), then if I just add 2 more, the whole thing is out of wack. Then when I adjust that random number to work with 122, it screws up again when I put it back to 120. Since when do the rules of multiplication only apply for numbers under 120? It's completely fucking random!

All my attempts at wrapping using code have failed, and I ran out of ideas. Everytime I add some number to the final x or y, the image stretches.

Edit: I also tried reseting the x/y offset to 0 once it gets close enough to the next image, but it moves 5-10 pixels past it before it returns to 0. It just skips 5-10 pixels backwards and acts like nothing happened.


6th August 2007 20:17 UTC

It sounds pretty much like the classic rounding issue

Post the preset here so we can see exactly what happens


6th August 2007 21:22 UTC

I got it to work by resetting the camera postition to zero when it was close enough to the target. I was having problems with this method before, but I just played around with the numbers, and with all the camera movements, it is hardly noticable. Here is an almost blank preset with a DM similar to the one in my preset. If you want to see how it looked before I fixed it, remove the if statements after the ox and oy variables in the frame box. I put on blend so you can see where it should line up.


7th August 2007 13:34 UTC

Hmm, interesting.

The solution you have done is an appropriate one, wrapping manually with something like if(x1>1) x1-=1;