Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / 2D Motion Blur

Author
Message
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 27th Dec 2007 03:19
I had this idea to make 2D motion blur using memblocks, but I'm so tired I can't work out what to do, I also am a noob with memblocks so that doesn't help.
If anyone wants to take on the code they are welcome.



Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 28th Dec 2007 15:42 Edited at: 28th Dec 2007 15:51
Is this how memblocks store bitmaps?

[edit]
Now it's more like a memblock (has a sort of header)


Bluestar4
19
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 7th Jan 2008 02:10
rather than using memblocks, why dont you use the blur bitmap commands?

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 7th Jan 2008 02:21
I heard blur bitmap is really slow... that may be why he's going for bitmap solution

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 7th Jan 2008 14:25 Edited at: 7th Jan 2008 14:33
@OBese87

Though this doesn't address the motion blur attempt, it should give you a little information that should be useful in dealing with memblocks as images.

When using memblocks and images or bitmaps, there are a couple of things to keep in mind. When converting an image to a memblock, the memblock will inherit the current screen depth of your app. It's important to remember this when you are converting a memblock to an image or bitmap. If your screen depth is 16 but you create a memblock with a screen depth of 32, you are likely to crash your program if not your computer. Check out the following example. It will create a white square out of a memblock. The screen depth is 32. Try running the same example but switch the screen depth to 16 to see what happens.



This example shows how easy it would be to create your own box command using a memblock. I wonder if it would be faster than using a series of lines or dots? If it were, gradations would be pretty quick.

In regards to pixel data, even though this example is 32 bit (4 bytes) the memblock will only use 3 bytes and leave one equal to zero. This last byte is reserved for an alpha channel, but DBC ignores this when converting between images. If you were to populate this 4th byte, DBC would read the entire value as a float and you would get unpredictable results.

32 bit is easy to deal with, 16 bit is a bit more difficult. The colors or rather the integers (DWORDS) that are generated using rgb(r,g,b) do not translate to the same value in a memblock representing a 16 bit image or bitmap. The colors are converted to WORDS or 2 byte values. Your graphics card determines how these values are converted. Look up 16bit RGB 565 or RGB 555 for a detailed explanation on the conversion.

Enjoy your day.
Bluestar4
19
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 7th Jan 2008 19:58 Edited at: 7th Jan 2008 19:58
Quote: " heard blur bitmap is really slow... that may be why he's going for bitmap solution"

hence the "loading " screen should appear and sync should be on - then you can load a bitmap into 2 seperate memory spaces - (ei load bitmap "images.bmp",1 : load bitmap "images.bmp",2 )blur the second one , and then capture all the images from both bitmaps. the images from the scond blurred bitmap would be used for the blurred images, while images from the first one would be the original untouched images..... just a thought {dont forget to delete the bitmaps when done grabbing the images) . A second possible solution would be to set the images from the original bitmap as sprites and use two sprites, one ofcourse would have the backsave status set to not update the background and 1 frame behind the original moving sprite. anyway , hope this helps a little.

Login to post a reply

Server time is: 2025-06-02 09:45:30
Your offset time is: 2025-06-02 09:45:30