Blur component "refresh"

ZGE Source Code discussion. Ask questions, present your changes, propose patches etc.

Moderator: Moderators

kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Blur component "refresh"

Post by kattle87 »

Hi all! I am planning to work a little on the blur component. Before I start, there are a bunch of points I would like to speak about:
-Do you think that people will frequently use a blur on more than 2-3 pixels? Because if this is the case, changing a little the code will greatly help with speed.
-Do we _really_ need a tileable blur? I started thinking about this since blurring might be made just when an image is "almost finished" (already resized/shifted/rotated) and this would save a little code size... and we must scavenge for bytes here :P
-I will code an option for the vertical/horizontal only blur, would you like to try out some other "directional" blurs also? Keep in mind you will (almost) get the same result with rotating then blurring [Drawback: actually it needs the tileable blur to work properly :(]
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Hi Francesco,. :D is good to see you working on this!

One thing to keep in mind is that people will use these cool things you code in ways you may never have thought of. The guideing principle should lideally be to make it as WIDE ranging as possible, even more than you think may be usefull, if it is not limited for a good reason,. i.e. so it don't crash

Trying Villes first blur component as a guide I would say 8 or 16 pixels is a better limit,. IF one need be imposed. However, I also note that I can just do a blur of 2 or 4 and then another blur of 2 or 4 more, etc.! If you do get a great improvment by this limit the we can just do multi-blur sequences,. .

As far as tileable it would be really usefull with your cell component, (amoung others),. remember that if we do get the 'stackable' or 'node linking' interface (and evern if we don't) we can use blur as a small part of a much more complex bitmap layering sequence, to generate different textures, assuming that it is just used at the end is not such a good idea,.

also I would rearly use a texture as a whole surface of an object and more likely use it as TILEABLE material,. thus my desire for the tileable blur as well as more tile able stuff in general, noise, bricks, etc.

Directional is a great idea even just h/v,. as you say, we do have the rotate/scale component too.
Attachments
tileable_blur.zgeproj
remove the blur and see how nice it tiles!
(757 Bytes) Downloaded 753 times
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

jph_wacheski wrote: Trying Villes first blur component as a guide I would say 8 or 16 pixels is a better limit,. IF one need be imposed. However, I also note that I can just do a blur of 2 or 4 and then another blur of 2 or 4 more, etc.! If you do get a great improvment by this limit the we can just do multi-blur sequences,. .
I'm not going to set any limit on the pixel radius! :) I mean, the actual algorithm is good if you do use it let's say with a 2 or 3 pixel radius. But I can write a little bigger code with the exact same processing time for any pixel radius you choose (found it on the web). It would be pretty faster if used for blurs with 3 or more pixels. But it will increase the code size so if never used it would be a waste of space.


BTW: you convinced me to get a tileable blur with you example :P Unless I do find some unexpected problems when working on it.
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Sorry guys but I gived up :(
No high-speed algorithm nor size optimizations (at leas not now) only tileing and directional blur :P
Sending a patch to ville in a few hours (I hope) :P
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Ok I sent a patch to Ville.
Blur component now creates tileing textures, you can choose if blur only horizontally or only vertically (or both, of course), plus as a bonus you get a new setting: "amplify" that allows you to change the intensity of the colors used. You will be able to experiment with this soon, I hope :)
Attachments
Have you ever tried the 2 presets with non-square bitmaps? ;)
Have you ever tried the 2 presets with non-square bitmaps? ;)
NewBlur.jpg (49.82 KiB) Viewed 27213 times
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

well,. that sounds quite good actually,. what did you give up on?? a higher speed method? oh, well perhpas at a later date you will get inspired,. I often find that if i stop thinking about a problem,. some time later, an idea about a possible solution to that problem pops into my mind,. I attribute this to sub-consious processing that is happening all the time, only we are not consiously aware of it as it is bellow our consiousness threshhold,. . anywhay thanks for this work!
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Got the patch from Francesco for the blur-function. Also he made some size-optimizations for matrix functions in the ZMath-unit.

The matrix functions are used by the Implicit-components and also the MeshBox component, and as far as I can tell they still seem to work after using your code.

Saved around 1120 bytes so that was very nice!

You can check code size yourself by compiling ZDesigner and select menu Project - Information for ZDesigner. In the dialog box you see "code size".

And for really detailed examining of the code you can set a breakpoint on a line, run the program, and when the program stops in the debugger you can select View Disassembly (Ctrl + Alt + D) in the "View - Debugging windows" menu. This will show you each source code line and directly afterwards the assembly code generated for that line.

The updates to the blur-component looks good too!

Great contributions kattle! I'll check in the code and update the beta later today.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

wow,. I been working with this new setup and it is quite very cool,. one thing i'm wunder is could the blur component's Amplify function work with a blur.radius of 0 ? I know I could do an expresion like this.pixel*=2; to get the same effect but the slider and realtime feedback are what makes this nice to work with,. .

also a sorta bug in the graph system; if you drag a bitmap componenet out of the tree and drop in in say a Group folder (outside the bitmap entierly),. it appears works in the tree and not in the graph,. perhaps this is a silly thing to do, but I would like to keep some components while building stuff and not have them conected,. so, that was my test method but it makes the graph seem buggy,. see attached. when you put it back it no longer functions,. . guess it's a monkey thing to do,. however I would like some sorta way to do that sorta thing,. . or course not crucial!
Attachments
bitGraph2.zgeproj
some tests,.
(1.66 KiB) Downloaded 807 times
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Not sure about this, but a couple of things might have changed from april the 4th and 5th build (the latter being in svn). I had really lesser problems with the components recently.

To Ville: I have no idea of why I wrote the amplify that way... Perhaps I was not thinking about the fact that one might want to use the amplify without the blur... so could you change this line:

Code: Select all

VecDiv3(Tot, Power(Radius*2+1,(IsHorizontal+IsVertical)/Amplify),P^)
to

Code: Select all

VecDiv3(Tot, Power(Radius*2+1,(IsHorizontal+IsVertical))/Amplify,P^);
This is the only thing that must be changed in order to get the ampl. work even if radius is zero. :P
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Updated the beta now with a fix to the drag-drop problem and kattles change to the blur-component. Download again to get the latest version.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

You da' man! thanks,.
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Glad to be of service jph! You know it strikes me that in the current situation when the only known releases of ZGE games comes from you then this place is like a small indie game developer team with you building the games and me, Francesco and Kjell building the engine. I mean really what's the difference? And that's fine by me, I'm happy and proud to supply the engine for games of such quality as Vector Locust.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

yeah I am happy to be able to work with this fine engine that you and the boys are continuing to amaze me with all the cool improvments and expansions,. it does feel that way a bit like we have a nice and tight little causal dev. team going,.
I sure do not know why we dont see more ppl working with the ZGE,. and perhaps they are and just lurking, but why more dont participate in the running discutions we be having etc. . and thanks for noticing that I did a lot of work on that game and I am proud of it and the ZGE as well :)

also in the promo areas these guys [http://handeyesociety.com/ ] havve asked for me to come down and present "a game in progress" at the next social, so of course I will be showing it right in the ZGE ide!!!
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

just found this:
http://mierendo.com/software/3d_filter_blurring/

This is really inviting... Ville, you can agree with me that if we are able to get this working properly, we can just delete the actual blur component and get the whole stuff working with this. We are getting (I think) size-indipendent blur, zoom blur, radial blur. And I'm pretty sure it will be FASTER :D
The ONLY concern is about tileing. This should "just work" if we are going to underzoom the image a little, or look up some other tricks :D
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hmm,

Instead of these really specific solutions I'd rather see a SetProjection ( Orthographic / Perspective ) + SetRenderTarget Component, so you can do this type of thing yourself .. as well as a thousand of other things.

K
Post Reply