It is currently Thu Jun 25, 2026 8:17 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Tue Jan 27, 2015 10:19 pm  (#41) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
Hah, you did catch me. Off to replace it now.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Tue Jan 27, 2015 10:40 pm  (#42) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
2-ton As I said it's a good update as it's also a bugfix (for possible bug pointed out by Saulgoode)

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Wed Jan 28, 2015 1:06 am  (#43) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
graechan, I haven't used G'MIC but on line 62 of your script (rel 3), you have:

(plug-in-gmic 1 image layer 1


I do not understand why the third argument is 'layer' and not 'copy'. Could you double-check or explain, please?

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Wed Jan 28, 2015 1:25 am  (#44) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Thank you Saulgoode just a Typo
it should say copy and fortunately for me as long as the layer entered exists it will still work as it selects the active layer which was copy, all fixed now

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Wed Jan 28, 2015 1:21 pm  (#45) 
Offline
GimpChat Member

Joined: Aug 30, 2013
Posts: 63
Wow, in just a few days you've taken this from a casual suggestion to a fully-realized, very capable filter. Like I always say, every day is like Christmas morning around here. And the toys keep getting better. Thanks, Santa! :clap


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Wed Jan 28, 2015 4:40 pm  (#46) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Thank you Acmespace I,m glad you enjoyed the script

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Wed Jan 28, 2015 9:08 pm  (#47) 
Offline
GimpChat Member
User avatar

Joined: Oct 29, 2014
Posts: 28
Location: Vancouver Island, BC Canada
Yes! A most opportune tutorial .... I'm playing with filters at the moment and your suggestions will be really helpful.

_________________
"I have learned that the ambition of those who follow selfish precepts is no more than chaotic waste, a finite gain that must be followed by infinite loss. For there is indeed a harmony in the universe, a concordant singing of common weal. To join that song, one must find inner harmony, must find the notes that ring true.

There is one other point to be made about that truth: Evil creatures cannot sing."

~ Drizzt Do Urden (Sojourn)


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Thu Jan 29, 2015 10:00 am  (#48) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 161
I downloaded the updated script, set the spikes to 6, the length to 100, iterations to1 and it's been going for about 5 minutes now and it's up to 84 layers. Is that supposed to happen?


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Thu Jan 29, 2015 10:43 am  (#49) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Charlie wrote:
I downloaded the updated script, set the spikes to 6, the length to 100, iterations to1 and it's been going for about 5 minutes now and it's up to 84 layers. Is that supposed to happen?
No, it is not. There are a few different ways to remedy the problem.

@graechan, the problem is caused by the SF-ADJUSTMENT returning a non-integral number, even if you have the precision set to "0" (see the second part of this posting for a description).

You can remedy this by one of the following methods:
  • Change the SF-ADJUSTMENT from a slider to a spinbox (i.e., change last argument from "0" to "1"). (You might also change the step value to "1"; I can think of no reason to disallow an odd number of spikes.)
  • Add "(set! spikes (truncate spikes))" to the start of your procedure.
  • Change the test in your spike loop from "(unless (zero? cnt)" to "(when (>= cnt 0)".
.

note: whatever you do may have to be done twice in the script, once for the G'mic version and once for the plug-in version.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Thu Jan 29, 2015 11:11 am  (#50) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 161
I had to force close gimp to get stop. I gave it another test leaving it set to default and it worked fine. Then I adjusted # of spikes up 1 and it went buggy again.


Attachments:
Star filter 1.png
Star filter 1.png [ 583.31 KiB | Viewed 2506 times ]
Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Thu Jan 29, 2015 4:52 pm  (#51) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Charlie unable to replicate your problem using the same settings

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Thu Jan 29, 2015 5:56 pm  (#52) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
saulgoode wrote:
Charlie wrote:
I downloaded the updated script, set the spikes to 6, the length to 100, iterations to1 and it's been going for about 5 minutes now and it's up to 84 layers. Is that supposed to happen?
No, it is not. There are a few different ways to remedy the problem.

@graechan, the problem is caused by the SF-ADJUSTMENT returning a non-integral number, even if you have the precision set to "0" (see the second part of this posting for a description).

You can remedy this by one of the following methods:
  • Change the SF-ADJUSTMENT from a slider to a spinbox (i.e., change last argument from "0" to "1"). (You might also change the step value to "1"; I can think of no reason to disallow an odd number of spikes.)
  • Add "(set! spikes (truncate spikes))" to the start of your procedure.
  • Change the test in your spike loop from "(unless (zero? cnt)" to "(when (>= cnt 0)".
.

note: whatever you do may have to be done twice in the script, once for the G'mic version and once for the plug-in version.

Saulgoode I can change to a spin box and the reason I have disallowed an odd number of spikes is that Gmic's Linear blur blurs in both directions e.g when set to 90 degrees it also blurs at 180 degrees so if was set to 5 spikes it would actually return 10 spikes (I'll try something else from Gmic)

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3 (Added setting for number of spike
PostPosted: Thu Jan 29, 2015 7:10 pm  (#53) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Graechan: I get the same result as Charlie .. if any adjustment is made to the "Spikes" slider the script goes awol.

The problem is as saulgoode indicated ..ie. the slider is defined with precision=0 (meaning that only the integer part of the value is displayed in the dialog box) but the value passed to the script is a full float value (accurate to about 10 decimal places) representing the actual position of the slider as set by the user. That float value will never decrement to precisely zero ..it goes past zero and just keeps on going negative! (The "(zero? cnt)" condition never retruns true.)

Since the "spikes" value is also used to determine the spike-angle you also get some very strange angles ..again accurate to about 10 decimal places.

The simplest solution is to insert the line:
(set! spikes (truncate spikes))
at the top of the procedure ..it works fine then.

For good measure you could also change the "(unless (zero? cnt) .." to "(while (> cnt 0) ..)" ..the same as the "iterations" loop later in the script.

Further thoughts and observations:
1.
Graechan wrote:
the reason I have disallowed an odd number of spikes is that Gmic's Linear blur blurs in both directions
You have set step=2 to eliminate odd numbers but it is still possible to enter an odd value by manually dragging the slider ..and yes you do get double the number of spikes expected!

2. You set the initial angle as half the inter-spike angle (eg. if spikes=4 inter-spike angle is 90 degrees and therefore initial angle is 45 degrees). User has no control over angle. Surely the initial angle could be set with an "offset angle" slider (as is done in many other scripts and plug-ins) so that the user can decide.

3. a minor typo in the "soft" filter registration:
SF-ADJUSTMENT "Spokes" '(4 1 10 1 1 0 0)
Methinks it should read "Spikes" (although I suppose "spokes" is actually a close synonym in this case!)


Top
 Post subject: Re: Star Effect Filter Scripts Rel3.1 (added more checks and balances)
PostPosted: Thu Jan 29, 2015 9:05 pm  (#54) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Thanks Saulgoode and Jontait2 I have ammended the script and posted 3.1

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3.1 (added more checks and balances)
PostPosted: Fri Jan 30, 2015 3:21 am  (#55) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
@Graechan:
Two problems:

Firstly, your script gets confused if the input image has any layers ABOVE the active layer. This is caused by the way the "copy" layers are created below the first ("layer") layer:
(gimp-image-add-layer image copy 1)
Using imagestack layer number = 1 assumes that the first layer created is now top of the imagestack (ie. layer 0) - if the user has any layers above the active layer it all gets horribly confused and the final merge-down fails.

This can be corrected by stacking the layers upwards, remembering the topmost copy layer's reference and then merging-down from that uppermost copy layer. This code works okay in the "soft" filter:
    (let loop ((cnt (- spikes 1)))
           (unless (zero? cnt)
               (set! copy (car (gimp-layer-copy layer TRUE)))   ;***JT*** change (let to (set! to use the main scope "copy" variable
               (gimp-image-add-layer image copy -1)      ;***JT*** imagestack layer number = -1
               (gimp-layer-set-mode copy SCREEN-MODE)
            (gimp-drawable-set-name copy (string-append "layer" (number->string set-angle)))
            (plug-in-mblur 1 image copy LINEAR spike-length set-angle center-x center-y)
            (set! set-angle (+ set-angle spike-angle))
               (loop (- cnt 1))))            ;***JT*** removed closing bracket for the (let

   (gimp-image-set-active-layer image layer)
   (plug-in-mblur 1 image layer LINEAR spike-length initial-angle center-x center-y)

   (set! layer copy)            ;***JT*** start merge-down from last copy
   (let loop ((cnt (- spikes 1)))
           (unless (zero? cnt)
            (set! layer (car (gimp-image-merge-down image layer EXPAND-AS-NECESSARY)))
            (gimp-layer-set-mode layer SCREEN-MODE)
               (loop (- cnt 1))))
[The same applies for the "hard" filter, of course.]

Secondly, the length of spikes produced by the "soft" filter varies with direction (and hence with the number of spikes chosen):
Image
In each case above the spike-length was set to 100 and the red circle is of radius 100.

This seems to be an "unpublished feature"/functional drop-off/bug in the motion-blur plugin, not your script. It looks like the plugin is producing trails out to the sides of a square of the specified size ..which can be up to 40% longer than intended.
Cheers.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3.1 (added more checks and balances)
PostPosted: Fri Jan 30, 2015 4:29 am  (#56) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Jontait2 error 1 fixed new layer will always merge and end up above active layer
error 2 is due to atmospheric conditions or in truth the plugin does not return an exact length every time
look for Rel3.2

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3.2 (bugfix)
PostPosted: Fri Jan 30, 2015 5:13 am  (#57) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 161
Your scripts are making my CG art look really good. I used your GC Lens flare and Star Effect on this one. Thank you again Graechan, and thank you for the bug fixes.


Attachments:
SpaceStation.png
SpaceStation.png [ 1.12 MiB | Viewed 2868 times ]
Top
 Post subject: Re: Star Effect Filter Scripts Rel3.2 (bugfix)
PostPosted: Fri Jan 30, 2015 7:06 am  (#58) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Charlie thanks for posting the Image, It looks great :paint :bigthup

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Star Effect Filter Scripts Rel3.2 (bugfix)
PostPosted: Fri Jan 30, 2015 7:10 am  (#59) 
Offline
GimpChat Member
User avatar

Joined: Apr 07, 2010
Posts: 14182
Your image looks great Charlie.

_________________
Image


Top
 Post subject: Re: Star Effect Filter Scripts Rel3.2 (bugfix)
PostPosted: Fri Jan 30, 2015 7:57 am  (#60) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Graechan wrote:
error 2 is due to atmospheric conditions or in truth the plugin does not return an exact length every time
What "atmospheric conditions"? The input image in the results I posted above was just a quick test image I made in Gimp (while I was trying to work out what the f*** was going on with one of my real pics!) consisting of a pure white circle, diameter 20px, on a pure black background. No extraneous factors at all. What you see in those result pics is what comes out of the motion blur plug-in.

The fundamental problem is that the motion blur plug-in produces streaks by simply copying the input image N times over (where N is the specified length) and shifting the layers a little each time along the specified angle. This is okay if the direction is parallel to one of the axes (x or y) ..the resultant streak is the length you specified, N. But at any other angle ..the resultant streak length is N/cos(angle) ..which can be up to N*sqrt(2) at 45 degrees.

You can try this yourself: create a test image with just a white spot on black say, then in the SFC:
> (gimp-image-list)
(2 #(31 19))
> (gimp-image-get-active-drawable 31)
(582)
> (plug-in-mblur 1 31 582 0 100 45 0 0)
(#t)

..and you'll get something like this:
Image
The streak is formed 100px to the left AND 100px upwards and therefore has length 100*sqrt(2) ..ie 141px (ish).

As far as I can see this is a functional drop-off ..the plug-in should adjust its iteration count according to the specified angle such that the resultant streak will be of the length specified (or close as possible).
Cheers

Edit: just had another look at the plug-in source (blur-motion.c) and it DOES try to compensate for the angle:
  n = mbvals.length;
  px = (gdouble) n * cos (mbvals.angle / 180.0 * G_PI);
  py = (gdouble) n * sin (mbvals.angle / 180.0 * G_PI);
but for some reason this doesn't appear to work properly.


Top
Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group