Blur component "refresh"

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

Moderator: Moderators

User avatar
VilleK
Site Admin
Posts: 2360
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Nice article about convolution. Maybe we can make a property on the Blur-component that let's you optionally set the values of the convolution matrix using a zexpression? We can also have presets for all the common filters. Looks like the blur-component is becoming a little filter-factory of its own.
User avatar
Kjell
Posts: 1917
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi,

In case somebody wants to do image filtering using GLSL, here is a basic convolution shader with some variations.

In clockwise order: None, Blur, Sharp, Glow

K
Attachments
Convolution.jpg
Convolution.jpg (48.61 KiB) Viewed 53272 times
Convolution.zgeproj
(157.25 KiB) Downloaded 1635 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

That is cool Kjell,. I was wundering of ways to use shaders in a 2d sprite based game and I think I can adapt from those into some interesting effects,. . however yeah it is probably best to do bitmap generation in software to keep it uniform,. I do like the convolution filter,. perhaps we rename the 'blur' to 'convolution' and supply some presets,. .
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Ok guys: I'm positive about:
-Blur component with something that replaces the old "passes" variable with a "type of blurs" preset. 3 or 4 presets are possible. Plus we add a "convolution" component that can use presets and a 2-D array to get a custom filter computed.
-Rename the blur component and transform it into the "Convolution" component with some presets and 2-D custom array.

I'm not in with keeping the blur component (I mean keeping the name "Blur"!) while adding some functions. It's just a mess IMHO =)

So what so you guys think about this?
Ville, if I have understood how saving works, the option #2 (that is "rename" and extend the blur component) would break backward compatibility. Is this correct? Can we add some cases to the file loading function to keep the compatibility?

Y off set, we really need your opinion too! ^^ We need to know what the end user prefers ^^
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: 1917
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Depends,

Sometimes software only is the way to go .. for other projects you might want to have a hardware and software mode to choose from .. but going with the "modern video required" path can be just as valid.

You don't want to create a software path for heavy real-time filtering / lens-distortion ( see attached ) using Bitmap / Mesh Expressions :wink:

K
Attachments
FishEye.zip
(79.68 KiB) Downloaded 1576 times
User avatar
VilleK
Site Admin
Posts: 2360
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I think ease-of-use is a very important consideration to attract new users and for this reason I think we should keep a component called "Blur" because it is easy to understand. A "Convolution" component is quite advanced and require to read a tutorial before you fully understand how to use it.

So I vote for:
- Blur component with "Kind"-property for different style of blur-filters
- Convolution for more advanced convolution

Since both components will share most of the code it will not affect the code-size noticeable.
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Blur

Post by rrTea »

Hi Kjell!
Kjell wrote: Sun May 10, 2009 5:41 pm In case somebody wants to do image filtering using GLSL, here is a basic convolution shader with some variations.

In clockwise order: None, Blur, Sharp, Glow
I'm trying to use the Blur on a material with a material texture that has TextureScale.Y set to 5.

But as soon as I activate the Blur shader, it renders the bitmap as if it used TextureScale.Y of 1. How can I fix it?
User avatar
Kjell
Posts: 1917
Joined: Sat Feb 23, 2008 11:15 pm

Re: Blur

Post by Kjell »

Hi rrTea,
rrTea wrote: Fri Mar 08, 2019 5:22 amI'm trying to use the Blur on a material with a material texture that has TextureScale.Y set to 5. But as soon as I activate the Blur shader, it renders the bitmap as if it used TextureScale.Y of 1. How can I fix it?
Change the "gl_TexCoord[0] = gl_MultiTexCoord0;" line in the vertex shader into "gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;". However, this was merely a demonstration* of some things you can do with a convolution shader. If you just want blur, there are better performing alternatives.

*Aside from that example being outdated and containing fragment shaders that won't work on every system / driver anymore.

K
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Blur component "refresh"

Post by rrTea »

Alright thanks! I was just testing it but good to know it was just a demonstration / not guaranteed to work on some systems.
Post Reply