Smoothing lasers?

Blitz3D Forums/Blitz3D Programming/Smoothing lasers?

Jimmy(Posted 2011) [#1]
I find it easy to get inspired by many amazing people here and what they do. And so I thought I'll try perhaps continue some old work, It's an retro arcade game, but got stuck on trying to get a smooth "laser" effect.
There's many ways to do this but I'm trying to do it using an buffer of 10 oldest movements and well the innerloop is selfexplaning. The buffer constantly feed by movements. Pushing the oldest out for a newer ones. When you want an interpolated you start with the freshest one *100%, older one gets 50% worth, next 25% and so on.

Including the smoothing below and put in a simple test so one could see the outcome.

But I'm not supposed to get this look of linear segments, more a smooth kind of curve. pressing mouse draws actual line segments inbetween every movementpoint to make things much more visible.




Adam Novagen(Posted 2011) [#2]
Is there any actual point in api_GetCursorPos() over MouseX()/MouseY()? In any case, I'm not QUITE sure what's supposed to be going on here. Are you saying you want some sort of - dunno if this is the right term here - spline curves to be drawn between the various points?


Jimmy(Posted 2011) [#3]
@Adam you're wondering about mouse part, yes I did posted about this issue earlier, using the inbuilt mousex/y actually introduces very visibly jaggies on some systems, using API is just a way to make sure mouse is correct on 100% of all systems, nothing more.

The API windows gives no more frequent output, but as mousex/y at times contains small errors. This happens on some systems for sure but I cannot say every single one. Since this discovery I'm using this instead.
About the actual problem, yes I need smoothness something like interpolation, a spline, and trying to to achive it with the buffering.

The buffer get's fed a new position every frame and the oldest gets popped out.
so 10 freshest positions from 10 last frames are always within the buffer.

This is not using any ordinary interpolation, more like a filter of some sort, this way to avoid lagging as much as possible.

Last edited 2011

Last edited 2011


Jimmy(Posted 2011) [#4]
I noticed Paul Nettle uses a very similiar algorithm but more general version. I rewrote mine to match and see if that made a difference.
Still the same exact results you still get interpolation but not what you would expect.



Sudden realising your still producing only one coordinate per frame. Interpolated or not that would be quiet linear at fast movements.

I still found Pauls's thoughts about this kind of interpolation profound, I include a snippet of Paul Nettles notes and their comments.
As it is big, I box it.