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.

Work in Progress / Image Kit - Manipulate your images in-game!

Author
Message
entomophobiac
22
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 19th Nov 2009 08:44
Any possibility of seeing this for the GDK? Guess it would feel a lot more revealing to release the C++ core, obviously, but even as a DLL with an interface (such as Barnski's Lua plugin) would be truly awesome. =)

Anyways, great work!
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 1st Dec 2009 14:23
i would like to see ImageKit for GDK too as it's a great set of functions.

no need to release C++ code or Dll, just make it as a .lib
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 1st Dec 2009 17:18
Looking great.
I was wondering, since you've got it this far, it shouldn't be hard to add drawPixel / readPixel functions, right?
Would be really useful if you didn't have to go the memblock route for that.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 1st Dec 2009 21:38
Quote: "Any possibility of seeing this for the GDK? Guess it would feel a lot more revealing to release the C++ core, obviously, but even as a DLL with an interface (such as Barnski's Lua plugin) would be truly awesome. =)

Anyways, great work!"


Quote: "i would like to see ImageKit for GDK too as it's a great set of functions.

no need to release C++ code or Dll, just make it as a .lib"


I will do that, but probably later.

Quote: "Looking great.
I was wondering, since you've got it this far, it shouldn't be hard to add drawPixel / readPixel functions, right?
Would be really useful if you didn't have to go the memblock route for that."


Thanks. And I'll see what I can do.

I'm sorry that there hasn't been any progress lately. I've been busy with school. A lot of practical tests which require preparation before the test and data processing afterwards.
Meaning I'm usually too tired to start coding.

But within a week or two, multiple lessons will have ended so I might find the time then.

Cheers!
Sven B

Alfa x
18
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 7th Dec 2009 19:31
Hi Sven,
I have found an error some weeks ago, but hadn't the time to post it.

The code loads an image and copy it to another. Both image are .png
. In one case the command fails (uncomment the first two lines), and in the other it succeeds. I have uploaded the code with media so you can check it up.

AlfaX.

Attachments

Login to view attachments
Freedom Fighters
15
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 7th Dec 2009 22:57
This is epic. very nice, could use it in making terrain maps.
is there any plans to create one for GDK?
im still a bit rusty on my dbPro, more a fan of Gdk.

but this is real good, i look forward to seeing what it can do

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 14th Dec 2009 17:48 Edited at: 14th Dec 2009 17:50
Quote: "I have an little idea for a new command that you can implement with your plugin if you like it :

Change pixel r1,g1,b1,a1,r2,g2,b2,a2

r1 = 0-255 red color of the pixel to find
g1 = 0-255 green color of the pixel to find
b1 = 0-255 blue color of the pixel to find
a1 = 0-255 alpha color of the pixel to find
r2 = 0-255 red color to replace on the pixel that was found
g2 = 0-255 green color to replace on the pixel that was found
b2 = 0-255 blue color to replace on the pixel that was found
a2 = 0-255 alpha color to replace on the pixel that was found

it can be usefull in some way i think "


Quote: "I was wondering, since you've got it this far, it shouldn't be hard to add drawPixel / readPixel functions, right?
Would be really useful if you didn't have to go the memblock route for that."


Update v1.03
Introduced new commands:
- Paste Image Channel: allows you to copy a channel from one image to another.
- Set/Get Image Pixel
- Replace Image Color: allows you to replace a color.

Gask,
I decided not to implement the feature of checking whether the background had an alpha of 0. Instead, I made paste image channel to allow pasting the alpha channel seperately. You can achieve the same effect when pasting the alpha channel in reverse order.
After reading what you wanted to achieve, I still think the only option would be BLEND_NORMAL though.

Quote: "Any possibility of seeing this for the GDK? Guess it would feel a lot more revealing to release the C++ core, obviously, but even as a DLL with an interface (such as Barnski's Lua plugin) would be truly awesome. =)

Anyways, great work!"


Quote: "i would like to see ImageKit for GDK too as it's a great set of functions.

no need to release C++ code or Dll, just make it as a .lib"


Quote: "This is epic. very nice, could use it in making terrain maps.
is there any plans to create one for GDK?
im still a bit rusty on my dbPro, more a fan of Gdk.

but this is real good, i look forward to seeing what it can do"


Thanks. I have no experience with DarkGDK whatsoever, so I'm not quite sure how I should start on that. But I'll look into it.

Anyways, exams are coming up and times will be rough on this side. So there probably won't be any progress any time near.

Cheers!
Sven

Garion
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location: Poland
Posted: 15th Dec 2009 23:57
This is awesome in my opinion. Very, very very useful
Gask
17
Years of Service
User Offline
Joined: 1st Sep 2007
Location:
Posted: 17th Dec 2009 21:43
Quote: "Gask,
I decided not to implement the feature of checking whether the background had an alpha of 0. Instead, I made paste image channel to allow pasting the alpha channel seperately. You can achieve the same effect when pasting the alpha channel in reverse order.
After reading what you wanted to achieve, I still think the only option would be BLEND_NORMAL though.
"


Well , blend normal is too slow , that is why i ask it for fast blend , but it is not really a problem i get what i want with one of your new commands "replace image color"

I use a transparant image ( lets say 0,0,0 color to every pixel )
I paste image to image every project image to the transparant image.
Here i have a transparant image , with hide color in it from the many image , to show the image i use what you say :

Set Image Channel idimage,0xFF000000,255

Now i have an opaque image instead of an transparant image , so i can see the image but can't paste it on an other one as it is opaque.
In order to regain the transparant pixel again i do at the end this :

Replace Image Color idimage,0x00000000,0xFF000000

So i get again my transparant pixel and i keep all the other pixel opaque.
And i can paste this final image on an other one with transparancy management.

In fact this method is faster as i only do the alpha job one time.
It is slower if only one image is paste to an other as the replace image color will check every pixel even the one that is not 0xFF000000 , but if we paste ten or more image to the same image , it is faster to check all the final pixel for alpha , instead of pasting alpha every time an image is paste.

So i am very happy with this alternative ^^

The get pixel and set pixel fonction are really great too ten times faster than the dbpro ones.

The paste image channel , i can not really found a good way to use it for the time being , but maybe it can be usefull for somebody else ^^

So a great thanks for your hard work , it is much appreciated.
It will be use a lot !

Have a nice christmas
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 9th Jan 2010 11:01
@ Sven,

Are you closer now to the final version (ie. small non-debug version)?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th Jan 2010 12:05
Quote: "Are you closer now to the final version (ie. small non-debug version)?"


Not yet.
After the exams have ended, I was planning to add some gradient support. Then test it for a bit, and finally release it, hopefully along with a DGDK version.
My last exam is the 28th of January. Afterwards I have one week free, so I'll probably post an update around that time.

Cheers!
Sven B

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 9th Jan 2010 13:30
No worries SvenB - good luck with Exams!

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Super Nova
19
Years of Service
User Offline
Joined: 14th Jun 2005
Location: Earth
Posted: 12th Jan 2010 01:34
Just want to say that I love this plug-in, its exactly what I needed for my lemmings remake that is nearing a WIP post. Your name will be credited if you don't mind, thank you for sharing this!

"What I have shown you is reality. What you remember, that is the illusion."
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 22nd Jan 2010 21:08
Quote: "No worries SvenB - good luck with Exams!"


Thanks!

Quote: "Just want to say that I love this plug-in, its exactly what I needed for my lemmings remake that is nearing a WIP post. Your name will be credited if you don't mind, thank you for sharing this!"


You're welcome, and of course I won't mind being in the credits.

I wanted to let you know that I'm still working on this. Even though I can't get much done due to the exams, I did make some progress.

Van B complemented this plug-in, which was quite the honor. He also requested the feature of rotating images. Of course, this is added to the feature list. I also asked some information to Ian M about how I could access images using D3D instead of locking the image, and he explained how I could use render targets to render to images.
I have been researching a little into this, and I find the new results incredible. When using a render target, the pasting of a 512x512 image takes 0.037ms (<-> 4ms using a locked surface), with alpha blending.

This performance also comes with a drawback though. It is much faster, but because I have to use the D3D built in functions, some commands will not work and the result is usually of lower quality.
The next update will include at least this feature.

I have decided to customize all the commands so that they work with both a normal image and a render target image. This means it will be a pretty big update as I'll be rewriting pretty much all my code to make it compatible with render targets.

Sneak preview:

Average time to render: 0.0397ms (397ms for 10000 iterations)

Cheers!
Sven B

The Slayer
Forum Vice President
15
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 22nd Jan 2010 21:22
I did'nt get the time yet to test al of your ImageKit's features, but it looks very promising, Sven! Nice work! And with the update you're planning, this will come very usefull for alot of things.

Oh yeah, and good luck with your exams. What are you studying?
And btw, which part of Belgium are you from? I live in Zottegem.

Cheers

Slayer rules!!! Yeaaah, man!
Super Nova
19
Years of Service
User Offline
Joined: 14th Jun 2005
Location: Earth
Posted: 23rd Jan 2010 00:29
Just wanted to let you know that the 2DPluginKit uses the commands Get Image Pixel and Set Image Pixel (same syntax/parameters) so there is a conflict of keywords when both are installed. I'm not sure how to fix that so I have temporarily removed the 2DPluginKit for now.

"What I have shown you is reality. What you remember, that is the illusion."
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 23rd Jan 2010 09:33
Quote: "I did'nt get the time yet to test al of your ImageKit's features, but it looks very promising, Sven! Nice work! And with the update you're planning, this will come very usefull for alot of things.

Oh yeah, and good luck with your exams. What are you studying?
And btw, which part of Belgium are you from? I live in Zottegem."


Thanks!
I live in Grimbergen and I'm studying Civil Engineering (Ingenieurswetenschappen) at the Free University of Brussels (VUB).

Quote: "Just wanted to let you know that the 2DPluginKit uses the commands Get Image Pixel and Set Image Pixel (same syntax/parameters) so there is a conflict of keywords when both are installed. I'm not sure how to fix that so I have temporarily removed the 2DPluginKit for now."


Thanks for pointing out. I'll see if I can come up with a different name.

Cheers!
Sven B

The Slayer
Forum Vice President
15
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 23rd Jan 2010 18:50
Quote: "Grimbergen"


Hum, they have good beer there in Grimbergen, hey?

Quote: "Civil Engineering"


Sounds difficult. How long untill you have your engineers-degree? One year ago i've started a programming-course by the vdab in Dendermonde, and it was going quite well, but then my mom died, and a week later i had to do a test. I had a complete black-out and did'nt succeed the test, so i had to stop. Where or how did you learn to program? All by yourself, or at school?

Cheers

Slayer rules!!! Yeaaah, man!
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 23rd Jan 2010 21:44
Quote: "Hum, they have good beer there in Grimbergen, hey?"

We're famous

Quote: "Sounds difficult. How long untill you have your engineers-degree? One year ago i've started a programming-course by the vdab in Dendermonde, and it was going quite well, but then my mom died, and a week later i had to do a test. I had a complete black-out and did'nt succeed the test, so i had to stop. Where or how did you learn to program? All by yourself, or at school?"


I'm sorry to hear about your mom. I'm not sure when I'll have my degree. Next year is 3rd Bachelor, afterwards I'll be doing 2 years master and then I'll see if I'll do a master after master.
I started programming when I was 12. My parents thought it was a drag and drop editor for me to create games. It turned out to be the DBC-language.
It was pretty hard to learn, since English isn't my mother tongue, and we didn't have Internet in those days.


To be on-topic:
I had some time today, and I decided to alter the algorithms of blending a little in order to improve speed for normal images.
Here's a new benchmark list for those blend modes:


You may notice that BLEND_FASTNORMAL has become a little slower than the previous version. The reason is simply because I have added a simple ADD algorithm for the alpha channel.
Then again, it's the only algorithm that has become slower, all other commands (besides BLEND_FORCE and BLEND_FORCENOALPHA) are now (much) faster (sometimes the execution time even halved).
The most improved one would be BLEND_NORMAL (Old average: 22.684ms, New average: 9.833ms). The pixel color might be 1/256 off, but I don't think a game-developer would care.

Cheers!
Sven B

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 26th Jan 2010 11:42
Exams are slowly coming to an end, and so I have some more time on my hands.

I managed to make some more commands compatible with render targets. I'm not sure if I can make everything compatible, but I'll do what I can.

Negative Image:

(Real time rendered)

Cheers!
Sven B

Garion
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location: Poland
Posted: 30th Jan 2010 11:12
Amazing
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Jan 2010 13:57 Edited at: 30th Jan 2010 13:59
Update v1.10

- Introduced new commands: Create Target Image
- Support of target images (like camera images) (see list below)
- Added a parameter to Paste Image On Image: Angle. Only works for render targets (for now)
- Changed the command Copy Image Channel to Paste Image Channel ImgNr, x, y. The command will do exactly the
same.
- Changed the commands Set Image Pixel and Get Image Pixel() to Image Dot and Image Point() to avoid
conflict with the 2DPluginKit dll.

This is a pretty big update, (hence v1.10) and I'm pretty happy with it.
Basically, using render targets allows you to draw using the GPU instead of the CPU. Which is, of course, much faster. For now I don't have any example to show. But I don't think this should pose any problems.

Here's a table that shows which commands are compatible with render targets. The commands that aren't compatible will just return without error.
Target Images can also be used with IanM's MatrixUtils, so you should be able to draw to them using the 2D commands too.



I think I might be able to make some more commands compatible, but that will take some more time.
Update is attached. You can also download it from the first page.

One more note: I won't post a benchmark for render targets. The reason is simply because they all
execute in less than 0.2ms.

Please post any bugs or requests you might find.

Cheers!
Sven B

Attachments

Login to view attachments
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 2nd Feb 2010 20:34
I can't wait to try out these new features - and that's some crazy speed increase with render targets.

It's great to see this develop and become even more useful with blend modes and normal generation (genius).


Health, Ammo, and bacon and eggs!
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Feb 2010 21:32
Quote: "I can't wait to try out these new features - and that's some crazy speed increase with render targets.

It's great to see this develop and become even more useful with blend modes and normal generation (genius)."


Thank you!
I'm not sure if I'll ever get to normal generation though. I was already glad that I could implement the rotation feature you mentioned.

I was thinking of adding gradient support for the next update (radial & linear) and of course I'll also try to add render target support for as much commands as I can.

Cheers!
Sven B

Game pro
20
Years of Service
User Offline
Joined: 21st Mar 2004
Location: Usa
Posted: 4th Feb 2010 09:17 Edited at: 4th Feb 2010 09:18
Quote: "
This example loads layer images and a mask image and transforms everything to a blended image.
"

Hey, I was just thinking about making a skybox that has image transitions today. Looks like this plugin will save me alot of work. Thanks!

Check out my developer forums at:
http://archaicstudios.net/forums
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 11th Feb 2010 22:17
Amazing work Sven, I'm currently working on interactive surfaces and this is perfect for them (or there's nothing else fast enough to be honest). Can't wait to see how you develop this even more. Just Awesome

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 12th Feb 2010 12:13
@ SvenB,

This is an excellent plugin. So many uses. Just thinking it could be used on a skysphere to alter day to night, even alter transformations on clouds... wonderful... Keep up the good work...

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 21st Feb 2010 04:08
Hello,

I'm trying to apply the blur image command to a image generated from a camera view. Unfortunately I haven't been able to make it worked.

This is the code.



If I apply "desaturate image" instead of "blur image" it works. I read something about "blur image" is not compatible with render targets, but I don't know if this is the case.

How can I do this?

Btw, if I try to blur a simple image, it works OK




Thank you

Best regards

JF
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 21st Feb 2010 17:19
Is there any chance darkGDK may get this plug-in, oh, and is it going to be free?

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Feb 2010 18:09
Quote: "- Changed the commands Set Image Pixel and Get Image Pixel() to Image Dot and Image Point() to avoid
conflict with the 2DPluginKit dll."


Why don't you just add your name in front of every command like in the DBP collision DLL?

SB_Set Image Pixel for example, just like SC_GetStaticCollisionX()

TheComet

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 21st Feb 2010 19:38
Thanks everyone for your input.

Quote: "I'm trying to apply the blur image command to a image generated from a camera view. Unfortunately I haven't been able to make it worked."


Unfortunately this "render target" thing is indeed the case in your example. When rendering the camera to an image, this image is made into a render target by DBP.

Quote: "Is there any chance darkGDK may get this plug-in, oh, and is it going to be free?"


I'm not sure why people should pay for it as it's already released.
The DarkGDK version still has to be created. Though I'm actually focusing on DBP.

Quote: "Why don't you just add your name in front of every command like in the DBP collision DLL?"


Mhm perhaps I'm a bit paranoia about such things. I'm usually pretty picky about "clean" code. For some reason I find my code more 'flowing' when the commands match the style of DBP.

Cheers!
Sven B

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 21st Feb 2010 19:50
Cool, I know next to nothing about dbPro plug-ins and I am really interested about the possibility of getting this to DarkGDK, or S3GE(super 3D game engine) more specifically.

Is it possible for someone else to port it to GDK? I mean, are dbPro plug-ins written in C++?

If it's not written in C++, then how is it written?

Sorry about all the questions.

jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 22nd Feb 2010 19:21
Hello Sven B,

Thank you for your prompt reply.
I think Image Kit is a great plugin for DBPro, I'm looking forward to the new release

Quote: "Unfortunately this "render target" thing is indeed the case in your example. When rendering the camera to an image, this image is made into a render target by DBP."


Are you planning to add the blur function to render targets?
Could you recommend me a workaround?

Thank you again and best regards

JF
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 23rd Feb 2010 18:05
Quote: "Are you planning to add the blur function to render targets?
Could you recommend me a workaround?"


Unfortunately I don't have a plan for this yet. A blur needs the adjacent pixels to calculate the new color, which is something I will have to look a bit deeper into.

The only workaround I can think of right now is rendering to a smaller area (like 1/4 of the screen) then rescaling it to the full size and paste it.
I haven't actually tested it, but I can imagine it giving a bit of a pixelated effect.
It's the closest I can think of though.

Cheers!
Sven B

jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 24th Feb 2010 08:46
Hi Sven B,

I see... actually when I was trying to apply your blur function I did try scaling and rescaling the image... I posted my results as Pixelate function a couple of days ago here:

[href=http://forum.thegamecreators.com/?m=forum_view&t=166310&b=6
]http://forum.thegamecreators.com/?m=forum_view&t=166310&b=6
[/href]

Best regards

JF
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 24th Feb 2010 21:59
Hi!

I thought you were using the nearest pixel mode for resizing. I was thinking if you'd use the linear filtering mode for resizing you wouldn't get the pixelating effect (or at least less than that)...
Resizing with linear filtering only works for target images, so might as well make use of it ^^.

Sven B

jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 25th Feb 2010 04:46
Hello,


Thank you for answering.

Yes, I agree, unfortunaltey I couldn't make your resize image work... it didn't show anything on the screen. I tried with both nearest and linear, and nothing



I don't know what I'm doing wrong, so any help is welcome.

Best regards

JF
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th Feb 2010 19:11 Edited at: 25th Feb 2010 19:11
Hi jfroco,



It appears that the image will not be updated by DBP if the image changes size. So you'll have to copy it each loop to another image and resize that...

Cheers!
Sven B

jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 26th Feb 2010 06:14
Hello Sven B,

Thank you very much for your answer.

That worked!!

I've been trying to do the same with AdvancedSprites library that has different algorithm for resizing sprites and have a demo of "fake blur" working that I'm goint to post in the "Pixelate" thread.

Best regards

JF
Freedom Fighters
15
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 23rd Mar 2010 13:07
any new update news?

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 24th Mar 2010 19:21
Not really.
Truth is that I'm not really programming at all lately (except for school which is obligatory).
I might pick up this project again though, but I don't know when.

I attached a release version of the plug-in for those that want to use it. It's basically the same plug-in, but without the debug messages, reducing file size (123kB).

Cheers!
Sven B

Attachments

Login to view attachments
hottap
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: &amp;FF0
Posted: 24th Apr 2010 18:43
Thanks for this Sven B. DB has been lacking in the image manipulation commands department for some time and your plugin is awesome.

I have knocked up a pretty simple bitmap fonts routine using Image Kit - may be of some use to some people:

By way of example I have set up 2 different fonts at 2 different sizes each and included the png files in the attachment - I have also included the photoshop setup file for this layout. Just select all the character layers and change the font - resize the image to create different font sizes.


Attachments

Login to view attachments
Garion
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location: Poland
Posted: 28th Apr 2010 23:26
Sven B, could you please add two modes to the box blur command: only horizontal and only vertical?

I'm trying to do directional blur and thought that using this plugin will give faster results
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 8th May 2010 12:24 Edited at: 8th May 2010 12:25
Hi, I was trying to set the alpha of a created image via something like:

set image channel local_image1, CHANNEL_ALPHA, 100

But once applied, the transparent background of the image turns black.

Testing with the fadeout example:
I tried loading a png image and sure enough it does the same thing. Make sure you have the background color something other then black to see:
cls rgb(100,100,100)

I have the png file I tested with attached.

The transparent area of test.png should not turn black. right?

Attachments

Login to view attachments
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 8th May 2010 12:31 Edited at: 8th May 2010 22:10
sry for the double post

But wanted to show what I see with the fadeout example too.

The snapshot is attached

Edit:
Here's the exact code I used with fadeout with two edits:




Attachments

Login to view attachments
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th May 2010 03:11 Edited at: 9th May 2010 18:07
Quote: "But once applied, the transparent background of the image turns black."


Yes this is normal behavior. The transparent background is because of the alpha channel, which you're changing.
255 = opaque
0 = transparent

because the actual color is black but with an alpha of 0, you usually don't see this.

I would suggest using set image brightness, like this:



Quote: "Sven B, could you please add two modes to the box blur command: only horizontal and only vertical?"


I'll see if I can do this without too much work. I basically have the blur commands so all I have to do is do one/two pass instead of two/four (meaning probably some copy-paste & delete).

I can't give you guys big updates for the moment, but if anyone reports a bug, or thinks he noticed one, please tell. I'll free some time to fix it.

Cheers!
Sven B

Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 9th May 2010 04:16 Edited at: 9th May 2010 04:17
Ok that worked for me for that fadeout program. But not for my program.

I make a render target image using "Set Camera To Image", draw to that.. then use your "copy image" to copy from the render target image to a separate image. That works like that with no problems. But, when I do any alpha value with your "set image brightness" command Like:

set image brightness local_image1, 1.0, 1.0, 1.0, 1.0

...somehow it simply makes the new copied image not appear or wipes everything to alpha 0 or something. I assume the value 1.0 would make the image to be 100% visible? There is no help file on your commands at least explaining what values that parameter takes. So I'm assuming this command does not work with an image copied from a "Set Camera To Image/Set Bitmap -Camera" created image?

How does your "Create Target Image" work? How do I use the DBPro 2d commands to draw to that Image? You said "Create Target Image" works like "Set Camera To Image" way of creating images? I don't have a camera to set the "Set Bitmap" for me to draw to.

Thanks for any help

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th May 2010 18:05 Edited at: 9th May 2010 18:07
Hi Todd,

I have to admit the commands aren't well documented because I simply haven't made help files yet.

Quote: "...somehow it simply makes the new copied image not appear or wipes everything to alpha 0 or something. I assume the value 1.0 would make the image to be 100% visible? There is no help file on your commands at least explaining what values that parameter takes. So I'm assuming this command does not work with an image copied from a "Set Camera To Image/Set Bitmap -Camera" created image?"


Set Image Brightness ImgNr, Red, Green, Blue[, Alpha]
Alters the image brightness. But it basically multiplies each channel with these values. Eg. set image brightness 1.0, 0.5, 1.0, 1.0 will halve the green channel. Values >1.0 are also possible.

So the value 1.0 would leave the channel untouched. This command should work with both types of images (normal and render targets). Are you sure you have the latest version? I couldn't reproduce the problem here.

I posted a list of commands that were compatible with target images a while back, but I'll post it here again:



Because I don't really have an idea where the problem might be situated, I decided to code a small example of how I think you want to use it:
up/down arrow keys to change alpha


Quote: "How does your "Create Target Image" work? How do I use the DBPro 2d commands to draw to that Image? You said "Create Target Image" works like "Set Camera To Image" way of creating images? I don't have a camera to set the "Set Bitmap" for me to draw to."


A render target is basically telling to DirectX the image can be rendered to (hence "render target"). It allows you to use the GPU to draw to an image which improves speed greatly compared to the CPU version. This is also why when using "set camera to image" the image will be made a render target to allow fast rendering to an image. The downside is that you can't copy those images to dynamic memory for direct access. Any editing of the image has to be done using the GPU.

My plug-in doesn't support drawing to images, but IanM's MatrixUtils plug-in does. Create Target Image is basically the same command as his make image and you shouldn't have any problems using them both in one program.

Cheers!
Sven

Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 10th May 2010 02:21 Edited at: 10th May 2010 02:25
Ahhhhh ok. I finally see what I was doing wrong with your help of coarse. I was not thinking right on how your commands worked.

For example, like when you use "set image brightness" on an image, the effect is permanent. I simply can not apply "set image brightness" on the same image again and again to get the desired effect.

I need a "result" image derived from the source image using your "copy image", as you have commented, to reset the channels before applying "set image brightness" again with different values.

Everything should be smooth sailing from here on out.

Thanks for your time and help

Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 10th May 2010 03:29 Edited at: 10th May 2010 04:02
Arg... well now I see that there was something wierd going on

I need to change my application to the size of the desktop. For some reason "Set Display Mode" breaks your "set image brightness" somehow. For me, once the "set image brightness" command is issued, the image just disappears.

I've added:
Set Display Mode DESKTOP WIDTH(),DESKTOP HEIGHT(),32
Maximize Window
to the code.

Try this:




EDIT:

Interestingly, the new fadeout program that you first posted for me works with the set display mode change.

this code above works if you set the "create target image" to "create image". It looks like "create target image" is having the same problem as I'm having with using "Set Camera To Image" for creating images after changing the display mode. Which is wierd. After all, copying the image to a new "result" image works fine. I just don't understand why manipulating the new image copied from a render target image should be any different then the regular "create image" way. ??

EDIT 2:
When I take out:

Set Display Mode DESKTOP WIDTH(),DESKTOP HEIGHT(),32
Maximize Window

in my program that Im working on, it does finally work. But, I do need it to work when changing the display mode :\

Login to post a reply

Server time is: 2024-11-24 15:30:33
Your offset time is: 2024-11-24 15:30:33