Jump to content
How to Install Plugins ×

Clouds Plugin


Sepcot

Recommended Posts

I have finally got around to creating the "Clouds" plugin I promised.

 

Cloud Effect Configuration Dialog (version 1.1):

 

CloudsDemo.png

 

DLL Download Link (version 1.1): <broken link removed by EER> (Unzip - Drop the CloudEffect.dll file into your Paint.NET\Effects folder)

Source Download Link (version 1.1): <broken link removed by EER>

Edit: Updated to version 1.1

Changes made (v1.1):

  • 1. Added random numbers to the dialog box for the user to set if they like.
    2. Set default random numbers - same cloud pattern will appear with each invocation (until reseeded)
    3. Moved the GUI around - simple options at the top to more advanced at the bottom

Left to do:

  • 1. Optimize the noise function

 

Download >>   CloudsEffect.zip


(Note: DLL recompiled by @Ego Eram Reputo from original source on GitHub. HDPI fixes by @ReMake May 2022).

 

 

Plugin can be found under the Effects > Render > Clouds

Link to comment
Share on other sites

Could you tell me what do the values do?

These values are inputs to a Perlin Noise function which generates psudeo random values that determine the look of the clouds.

Frequency gives you number of noise values defined between each 2-dimensional point.

Persistence is a constant multiplier adjusting our amplitude in each iteration.

Octaves define the number of iterations over the noise function for a particular point. With each iteration, the frequency is doubled and the amplitude is multiplied by the persistance.

Amplitude is the maximum value added to the total noise value.

Those variables act within the perlin noise function to generate a cumalative total. There are two other user adjustable variables that act upon the total after the noise function that help in defining the finished look of your scene.

Cloud Coverage is a constant that gets added (or subtracted) to each total. The default value is zero, meaning that the total should not be altered. Adding values will increase the size of the clouds, while subtracting will reduce them.

Cloud Density is a constant that gets multiplied with the total to increase or decrease the apparent thickness of the clouds. The default value is 1, meaning the total should not be altered. Any number between 0 and 1 will reduce the apparent density (making the clouds appear more like fog).

More information on the Code Lab implementation can be found in my blog entry at: http://www.sepcot.com/blog/2006/08-2006-PDN-PerlinNoise2d.shtml

Link to comment
Share on other sites

A couple of things, from looking at the source code:

* You should probably put the random seed values r1, r2, and r3 into the token. You cannot assume that your configuration dialog was ever called before your Effect, and it looks like you're relying on it to set these values. For example, if I'm using this effect outside of Paint.NET, or if I'm relying on the Effect->Repeat... menu item, your configuration dialog will never have existed and these values will be 0 and we'll have some (presumably) boring looking clouds.

* The "Random" class, from what I recall, is not thread safe. You can work around this by putting the [ThreadStatic] attribute on it. For performance sake, only retrieve this field once in your Render() method and store it into a private method variable. You can check out our Add Noise effect's code to see what we do here. (By the way I'm serious about the performance -- performance went up 10x with the retrieve-the-field-once optimization.)

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

* You should probably put the random seed values r1, r2, and r3 into the token. You cannot assume that your configuration dialog was ever called before your Effect, and it looks like you're relying on it to set these values. For example, if I'm using this effect outside of Paint.NET, or if I'm relying on the Effect->Repeat... menu item, your configuration dialog will never have existed and these values will be 0 and we'll have some (presumably) boring looking clouds.

Fixed in version 1.1 - moved random seed values into the token (and GUI).

* The "Random" class, from what I recall, is not thread safe. You can work around this by putting the [ThreadStatic] attribute on it. For performance sake, only retrieve this field once in your Render() method and store it into a private method variable. You can check out our Add Noise effect's code to see what we do here. (By the way I'm serious about the performance -- performance went up 10x with the retrieve-the-field-once optimization.)

Added [ThreadStatic] to the Random class called when the "Reseed Noise" action is triggered.

I am only calling the Random class once (per click) as of version 1.0. The Noise function in CloudEffect.cs could still be optimized... Looking into it...

Link to comment
Share on other sites

I haven't gotten to try this one yet, new action pack subscription came in a couple weeks ago and i'm waiting to rebuild the computer, but its on my list of going to try soon:)

OctLogo.png
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 2 years later...
  • 8 years later...

I use this plugin quite frequently and I've just noticed the download links are broken, so I'm creating this post in order to fix the problem should anyone else need it. Here's the zipped DLL: <removed>

  • Upvote 3
Link to comment
Share on other sites

Many thanks Max! I'll pop a link into the first post.

 

Edit: what do you know - it's one of my compilations :lol:

  • Upvote 1
Link to comment
Share on other sites

If the source code is available, I wish this could be moved to the Render submenu.

 

EDIT: I see that the head post says that's where it is, but it actually seems to be under the main Effects menu.

  • Upvote 1
Link to comment
Share on other sites

Knew I couldn't trust Max! :lol:

 

I'll upload my version tonight - it is definitely located in Effects > Render

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...