It is currently Wed Jun 26, 2024 4:39 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: GEGL Motion Noise plugin to create wood and metal textures
PostPosted: Sun Mar 24, 2024 12:16 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
Plugin is officially here
https://github.com/LinuxBeaver/Noise_in ... /releases/

Download binaries and code here *march 27 update
download/file.php?id=74205

We are getting a new GEGL plugin soon called "Brushed Metal". It is not yet in development but here is its graph. I will document part of the process of making this plugin in order to help future GEGL plugin devs and once the plugin is done I will link the Github download.

Preview of Graph
Attachment:
brushed.png
brushed.png [ 646.85 KiB | Viewed 686 times ]



Syntax to create effect

id=x
over aux=[ ref=x

color value=#59cbf3
noise-rgb red=1 green=1 blue=1  gaussian=true linear=true seed=223334
gray
]
crop

motion-blur length=70
unsharp-mask scale=3
opacity value=10
median-blur radius=0


Stay tuned.


Last edited by contrast_ on Sun Apr 14, 2024 11:39 am, edited 4 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Sun Mar 24, 2024 12:21 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
The syntax selected will be made into sliders and color pick dialogs. Below is the planned name of the sliders. Two sliders will use the same gegl:motion-blur

Color
color value=#HTML_COLOR_HERE

Direction of Metal Stain
motion-blur angle=90

Length of metal stain
motion-blur length=70

Detail
unsharp-mask scale=3

Seed
noise-rgb seed=123456789


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Sun Mar 24, 2024 12:25 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
There is a problem. The color slider I originally intended is a hidden color and gegl:gray knocks out its effect. But without it the metal stain is less intense. To get a correct color overlay we need something like


id=2 multiply aux=[ ref=2 color value=red ]

Attachment:
color_overlay_metal_stain.png
color_overlay_metal_stain.png [ 575.29 KiB | Viewed 682 times ]


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Sun Mar 24, 2024 9:40 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
When brown this graph looks like wood. Maybe it should be renamed to "brushed metal and wood"

Attachment:
wood_when_brown.png
wood_when_brown.png [ 589.43 KiB | Viewed 647 times ]


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Sun Mar 24, 2024 10:33 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 787
Location: SEA - South East Asia
contrast_ wrote:
When brown this graph looks like wood. Maybe it should be renamed to "brushed metal and wood"

"Brushed Texture" should encompass everything going out of that filter (paper, plastic (~3D prints), whatnot), an orientation slider would be mandatory, as well as a "Tileable" option like in "Solid noise" IMO (every rendered texture should have this option IMHO)
Attachment:
screenshot_20240325-122700.jpg
screenshot_20240325-122700.jpg [ 34.95 KiB | Viewed 611 times ]

_________________
Patrice


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 9:32 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
The GEGL nodes in attach have been listed. These are all the GEGL nodes this filter will use. Two of them have color properties attached (default and hidden color.) and Median Blur and Noise RGB have normal properties attached to them.


static void attach (GeglOperation *operation)
{
  GeglNode *gegl = operation->node;
  GeglColor *hidden_color = gegl_color_new ("#a0a0a0");
  GeglColor *default_color = gegl_color_new ("#e98944");


    GeglNode *input    = gegl_node_get_input_proxy (gegl, "input");
    GeglNode *output   = gegl_node_get_output_proxy (gegl, "output");


    GeglNode *normal    = gegl_node_new_child (gegl,
                                  "operation", "gegl:over",
                                  NULL);
    GeglNode *idref    = gegl_node_new_child (gegl,
                                  "operation", "gegl:nop",
                                  NULL);
    GeglNode *hcolor    = gegl_node_new_child (gegl,
                                  "operation", "gegl:color", "value", hidden_color,
                                  NULL);
     GeglNode *noise   = gegl_node_new_child (gegl,
                                  "operation", "gegl:noise-rgb", "red", 1.0, "green", 1.0, "blue", 1.0, "gaussian", TRUE, "linear", TRUE,
                                  NULL);
     GeglNode *gray    = gegl_node_new_child (gegl,
                                  "operation", "gegl:gray",
                                  NULL);
     GeglNode *crop    = gegl_node_new_child (gegl,
                                  "operation", "gegl:crop",
                                  NULL);
     GeglNode *motion    = gegl_node_new_child (gegl,
                                  "operation", "gegl:motion-blur-linear",
                                  NULL);
     GeglNode *sharpen    = gegl_node_new_child (gegl,
                                  "operation", "gegl:unsharp-mask",
                                  NULL);
     GeglNode *opacity    = gegl_node_new_child (gegl,
                                  "operation", "gegl:opacity",
                                  NULL);
     GeglNode *endfix    = gegl_node_new_child (gegl,
                                  "operation", "gegl:median-blur", "radius", 0, "abyss-policy", 0,
                                  NULL);
     GeglNode *multiply    = gegl_node_new_child (gegl,
                                  "operation", "gegl:multiply",
                                  NULL);
     GeglNode *color    = gegl_node_new_child (gegl,
                                  "operation", "gegl:color", "value", default_color,
                                  NULL);


The UI strings for the filters properties has been filled out. This is the slider name and description area.

#include "config.h"
#include <glib/gi18n-lib.h>

#ifdef GEGL_PROPERTIES

property_color (value, _("Color"), "#e98944")
    description (_("The color to paint over the brushed metal/wood. The default color makes wood"))

property_double (direction, _("Direction"), 0.0)
    description (_("Direction of brushed metal/wood"))
    value_range (-180, 180)
    ui_meta     ("unit", "degree")
    ui_meta     ("direction", "cw")

property_double (length, _("Length"), 70.0)
    description (_("Length of brushed metal/wood in pixels"))
    value_range (20.0, 150.0)
    ui_range    (20.0, 120.0)
    ui_gamma    (1.5)
    ui_meta     ("unit", "pixel-distance")

property_double (sharpen, _("Sharpen"), 3.0)
    description(_("Sharpen the brushed metal/wood "))
    value_range (0.0, 10.0)
    ui_range    (0.0, 10.0)
    ui_gamma    (3.0)

property_seed    (seed, _("Random seed"), rand)
    description  (_("The random seed for the noise function"))


Last edited by contrast_ on Mon Mar 25, 2024 10:52 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 9:34 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
PixLab wrote:
contrast_ wrote:
When brown this graph looks like wood. Maybe it should be renamed to "brushed metal and wood"

"Brushed Texture" should encompass everything going out of that filter (paper, plastic (~3D prints), whatnot), an orientation slider would be mandatory, as well as a "Tileable" option like in "Solid noise" IMO (every rendered texture should have this option IMHO)
Attachment:
screenshot_20240325-122700.jpg


It is impossible to do that because this filter does not use solid noise. It depends mostly on linear motion blur and RGB Noise


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 10:11 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
Here is the GEGL Graph itself that list the nodes from attach

/*main graph here. normal and multiply are composers (aka blend modes)*/
  gegl_node_link_many (input, idref, normal, crop, motion, sharpen, opacity, endfix, multiply, output, NULL);
/*the normal blend mode has everything from idref to gray inside it*/
  gegl_node_connect (normal, "aux", gray, "output");
  gegl_node_link_many (idref, hcolor, noise, gray,  NULL);
/*the multiply blend mode has a color node inside of it. obviously to blend the color*/
  gegl_node_connect (multiply, "aux", color, "output");


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 10:15 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
The GEGL Operation class, title and filter description, and where the filter goes in the menu is here. Since we don't use update_graph, everything will stay in default.

If anyone has been noticing I've been giving my plugins reference hash names based on pop culture references (media, music politics, video games).

static void
gegl_op_class_init (GeglOpClass *klass)
{
  GeglOperationClass *operation_class;
  operation_class = GEGL_OPERATION_CLASS (klass);
  operation_class->attach = attach;
  gegl_operation_class_set_keys (operation_class,
    "name",        "lb:woodmetal",
    "title",       _("Brushed Metal and Wood"),
    "reference-hash", "dancingthroughthenightonthegroove",
    "description", _("The same background that makes brushed metal also makes wood texture."),
    "gimp:menu-path", "<Image>/Filters/Render/Fun",
    "gimp:menu-label", _("Brushed Metal and Wood Background..."),
    NULL);
}

#endif


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 10:20 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
Here is something very unique to this filter that only a few filters of mine have.

A mandatory -180 180 and ui_meta ("direction", "cw") are needed to get this circular slider in plugins.

property_double (direction, _("Direction"), 0.0)
    description (_("Direction of brushed metal/wood"))
    value_range (-180, 180)
    ui_meta     ("unit", "degree")
    ui_meta     ("direction", "cw")


If it is not (-180 180) with the extra ui_meta tag this circular slider will not show up
Attachment:
azimuth_cyclic_slider.png
azimuth_cyclic_slider.png [ 4.15 KiB | Viewed 574 times ]


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 10:33 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
Here is where we define the filter properties that are all based on other filter properties.

gegl_operation_meta_redirect (operation, "seed", noise, "seed");
gegl_operation_meta_redirect (operation, "sharpen", sharpen, "scale");
gegl_operation_meta_redirect (operation, "length", motion, "length");
gegl_operation_meta_redirect (operation, "direction", motion, "angle"); 
gegl_operation_meta_redirect (operation, "color", color, "value"); 


First is the property name we gave
Second is the defined name in attach
Third is the original filters property name

"newproperty", attachname, "originalproperty")

Usually I keep new and old property names the same to keep it simple but I understand this confuses newbies.

motion is the new property name we defined here
     GeglNode *motion    = gegl_node_new_child (gegl,
                                  "operation", "gegl:motion-blur-linear",
                                  NULL);


length and direction are both new and old property names

in example gegl:motion-blur angle=30 motion=40 is valid syntax that explains these two lines of code.

gegl_operation_meta_redirect (operation, "length", motion, "length");
gegl_operation_meta_redirect (operation, "direction", motion, "angle"); 


Last edited by contrast_ on Mon Mar 25, 2024 10:54 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 10:37 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
I just got done compiling the plugin and have no idea if it will work if I did it right or not.

Attachment:
gegls_compile.png
gegls_compile.png [ 285.25 KiB | Viewed 574 times ]


*update I had to tweak several sliders and recompile 4 times or so before I got it right.


Last edited by contrast_ on Mon Mar 25, 2024 11:28 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 11:27 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
The filter is done and appears to be working fine. It will be on Github tomorrow or later tonight.

Attachment:
on_soon.png
on_soon.png [ 603.75 KiB | Viewed 564 times ]


Anyone is welcome to compile this early. The entire working code is here.

/* This file is an image processing operation for GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* GEGL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
*
* Copyright 2006 Øyvind Kolås <pippin@gimp.org>
* 2024 Beaver, Brushed Metal Wood

Recreate graph using this GEGL syntax

id=x
over aux=[ ref=x
color value=#59cbf3
noise-rgb red=1 green=1 blue=1  gaussian=true linear=true seed=223334
gray
]
crop
motion-blur length=70
unsharp-mask scale=5
opacity value=10
median-blur radius=0 abyss-policy=none clip-extent
multiply aux=[ color value=#e98944]
*/

#include "config.h"
#include <glib/gi18n-lib.h>

#ifdef GEGL_PROPERTIES

property_color (color, _("Color"), "#e98944")
    description (_("The color to paint over the brushed metal/wood. The default color makes wood"))

property_double (direction, _("Direction"), 0.0)
    description (_("Direction of brushed metal/wood"))
    value_range (-180, 180)
    ui_meta     ("unit", "degree")
    ui_meta     ("direction", "cw")

property_double (length, _("Length"), 70.0)
    description (_("Length of brushed metal/wood in pixels"))
    value_range (20.0, 120.0)
    ui_range    (20.0, 120.0)
    ui_gamma    (1.5)
    ui_meta     ("unit", "pixel-distance")

property_double (sharpen, _("Sharpen"), 4.5)
    description(_("Sharpen the brushed metal/wood "))
    value_range (2.0, 10.0)
    ui_range    (2.0, 10.0)
    ui_gamma    (3.0)

property_seed    (seed, _("Random seed"), rand)
    description  (_("The random seed for the noise function"))

property_double (desaturate, _("Desaturate (for brushed metal)"), 1.0)
    description(_("Desaturation option to make brushed metal"))
    value_range (0.0, 1.0)
    ui_range (0.0, 1.0)

#else

#define GEGL_OP_META
#define GEGL_OP_NAME     brushed_metal_wood
#define GEGL_OP_C_SOURCE brushed_metal_wood.c

#include "gegl-op.h"

static void attach (GeglOperation *operation)
{
  GeglNode *gegl = operation->node;
  GeglColor *hidden_color = gegl_color_new ("#a0a0a0");
  GeglColor *default_color = gegl_color_new ("#e98944");

    GeglNode *input    = gegl_node_get_input_proxy (gegl, "input");
    GeglNode *output   = gegl_node_get_output_proxy (gegl, "output");

    GeglNode *normal    = gegl_node_new_child (gegl,
                                  "operation", "gegl:over",
                                  NULL);
    GeglNode *idref    = gegl_node_new_child (gegl,
                                  "operation", "gegl:nop",
                                  NULL);
    GeglNode *hcolor    = gegl_node_new_child (gegl,
                                  "operation", "gegl:color", "value", hidden_color,
                                  NULL);
     GeglNode *noise   = gegl_node_new_child (gegl,
                                  "operation", "gegl:noise-rgb", "red", 1.0, "green", 1.0, "blue", 1.0, "gaussian", TRUE, "linear", TRUE,
                                  NULL);
     GeglNode *gray    = gegl_node_new_child (gegl,
                                  "operation", "gegl:gray",
                                  NULL);
     GeglNode *crop    = gegl_node_new_child (gegl,
                                  "operation", "gegl:crop",
                                  NULL);
     GeglNode *motion    = gegl_node_new_child (gegl,
                                  "operation", "gegl:motion-blur-linear",
                                  NULL);
     GeglNode *sharpen    = gegl_node_new_child (gegl,
                                  "operation", "gegl:unsharp-mask",
                                  NULL);
     GeglNode *opacity    = gegl_node_new_child (gegl,
                                  "operation", "gegl:opacity", "value", 10.0,
                                  NULL);
     GeglNode *endfix    = gegl_node_new_child (gegl,
                                  "operation", "gegl:median-blur", "radius", 0, "abyss-policy", 0,
                                  NULL);
     GeglNode *multiply    = gegl_node_new_child (gegl,
                                  "operation", "gegl:multiply",
                                  NULL);
     GeglNode *color    = gegl_node_new_child (gegl,
                                  "operation", "gegl:color", "value", default_color,
                                  NULL);
     GeglNode *desaturate    = gegl_node_new_child (gegl,
                                  "operation", "gegl:saturation",
                                  NULL);
/*main graph here. normal and multiply are composers (aka blend modes)*/
  gegl_node_link_many (input, idref, normal, crop, motion, sharpen, opacity, endfix, multiply, desaturate, output, NULL);
/*the normal blend mode has everything from idref to gray inside it*/
  gegl_node_connect (normal, "aux", gray, "output");
  gegl_node_link_many (idref, hcolor, noise, gray,  NULL);
/*the multiply blend mode has a color node inside of it. obviously to blend the color*/
  gegl_node_connect (multiply, "aux", color, "output");

gegl_operation_meta_redirect (operation, "seed", noise, "seed");
gegl_operation_meta_redirect (operation, "sharpen", sharpen, "scale");
gegl_operation_meta_redirect (operation, "length", motion, "length");
gegl_operation_meta_redirect (operation, "direction", motion, "angle"); 
gegl_operation_meta_redirect (operation, "color", color, "value"); 
gegl_operation_meta_redirect (operation, "desaturate", desaturate, "scale"); 

}

static void
gegl_op_class_init (GeglOpClass *klass)
{
  GeglOperationClass *operation_class;
  operation_class = GEGL_OPERATION_CLASS (klass);
  operation_class->attach = attach;
  gegl_operation_class_set_keys (operation_class,
    "name",        "lb:woodmetal",
    "title",       _("Brushed Metal and Wood"),
    "reference-hash", "dancingthroughthenightonthegroove",
    "description", _("The same background that makes brushed metal also makes wood texture."),
    "gimp:menu-path", "<Image>/Filters/Render/Fun",
    "gimp:menu-label", _("Brushed Metal and Wood Background..."),
    NULL);
}

#endif


Top
 Post subject: Re: GEGL brushed metal background - COMING SOON
PostPosted: Mon Mar 25, 2024 11:41 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
POST RETRACTED - DOWNLOAD OUTDATED


Last edited by contrast_ on Wed Mar 27, 2024 1:09 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL wood and brushed metal background plugin
PostPosted: Tue Mar 26, 2024 10:36 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
Plugin will be getting an update with new features like this

It will have a tab to choose between linear motion blur, circular motion blur and zoom motion blur

Image

Image


Image


Top
 Post subject: Re: GEGL wood and brushed metal background plugin
PostPosted: Tue Mar 26, 2024 10:38 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
From a technical perspective this filter is a motion blur applied on rgb noise with a multiply blended color overlay.


Maybe I should rename the filter to "Motion blur on noise texture" as that is far more logically accurate then "wood/metal". I could call it "Motion blurred noise".


Top
 Post subject: Re: GEGL wood and brushed metal background plugin
PostPosted: Wed Mar 27, 2024 6:01 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: Jan 06, 2020
Posts: 343
Location: The Netherlands
I installed it, but I get this error message!
I am using Gimp 2.10.36 and 2.99.17

Solved!
I have now added 2.99.18 and it works now. Thank you!


Attachments:
Schermopname (27).png
Schermopname (27).png [ 256.89 KiB | Viewed 473 times ]


Last edited by Jappaloe63 on Thu Mar 28, 2024 1:43 am, edited 3 times in total.
Top
 Post subject: Re: GEGL wood and brushed metal background plugin
PostPosted: Wed Mar 27, 2024 9:31 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
I tested it on Windows 10 Gimp 2.99.18 and it worked.

Jappaloe63 wrote:
I installed it, but I get this error message!



Are you using Gimp 2.10.32? As my plugins require GEGL 0.4.46 and up now


If you are using above that try backing up and removing every other plugin but brushed metal and tell me if it works.


Top
 Post subject: Re: GEGL wood and brushed metal background plugin
PostPosted: Wed Mar 27, 2024 1:08 pm  (#19) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
Please try these new Windows and Linux binaries and let me know if they work.

Download Windows and Linux binaries and code here of plugin update
Attachment:
noise_in_motion.zip [80.11 KiB]
Downloaded 24 times


Top
 Post subject: Re: GEGL wood and brushed metal background plugin
PostPosted: Wed Mar 27, 2024 1:12 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1446
Jappaloe63 wrote:
I installed it, but I get this error message!
I am using Gimp 2.10.36 and 2.99.17


Please try the update. It has no errors unlike the earlier version that did and make sure the update works with all the other plugins of mine you have.


Top
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Baby's first GEGL plugin - a very basic GEGL plugin anyone can make.

9

No new posts Attachment(s) Let's post guides on how to create cool textures with Gimp.

2

No new posts Attachment(s) Felimage Noise Plugin v 0.1.1 Win10_and_LINUX_64bit.

21

No new posts Attachment(s) Just making noise earlier. Christmas stocking plugin

11

No new posts Attachment(s) GEGL Starfield - Partially Inspired by David Wood's fireworks guide

16



* Login  



Powered by phpBB3 © phpBB Group