Jump to content


Photo

GenTree: Generator of Trees & Branches (YMD:100725)


  • Please log in to reply
97 replies to this topic

#1 MadJik

MadJik
  • Members
  • 2,428 posts
  • LocationLille;France
  • Reputation:20

Posted 07 June 2007 - 04:00 PM

GenTree: Generator of Trees & Branches Plugin

Posted Image
(reworked tree sample: background and shadows added...)

GenTree: Generator of Trees & Branches
Posted Image
(reworked tree sample: background and shadows added...)


:Warning: Warning :Warning:
Warning: Depending on the setting you choose, it could freeze PDN in some cases!
Advise: Save your work before you use this plugin!

Download it!
Plugin GenTree.dll
Posted ImageHere is the DLLPosted Image

The source is available with the plugins package!
http://forums.getpaint.net/index.php?showtopic=7186

How to install
Close Paint.net
Unzip and (re)place the DLL in your Effect folder usually: C:/Program Files/Paint.NET/Effects

Now let's play...

How does it work?

The first point is always the middle of the bottom edge of the image.
From this point, it chooses a length and destination for the first branch.
At the end of the branch, it decides to create (or no) one new branch and it goes on with the actual branch.
Then for each branch, it redoes the same till it has reached the number of levels...
Sorry, no leaf yet on the branch...

Programming tips?
It first uses a table with the size of the image to calculate and place each pixel.
The loop is self recursive for the branches.
It means that it could be unsafe to choose a big amount for the number of levels as well as a high % for new branch.
The CPU / Memory will be impacted by this settings...

I've added Green-Red guides under critical sliders.
If you stay in the green side, it should be ok.

You could go in the red side for one slider at a time it should be still ok.
Otherwise, prepare yourself to wait for the result... :P

The user interface
Posted Image

Length of Branch: [1,100, dft:70]
Affect the length of the branch. There is also a random adjustment to make it more natural.

Chance of a Branch: [0,100, dft:70]
At each end, it decides to create a new branch or no, based on this chance in %.
100% a new branch at each end...

Initial Velocity Vertical: [-100,100, dft:20] (used in absolute value: -100 = 100)
The branches are normaly going down to the floor, following a curve.
The Vertical velocity will affect the radius of this curve.

Initial Velocity Horizontal: [-100,100, dft:0]
The horizontal velocity could be considered as a wind factor...

Reseed Value: [0,100000, dft:0]
If the value is 0, then you choose to always have something new. The random generator is free.
If the value is not 0, then the random generator will always follow a sequence of values.
The tree will be draw and redraw in the same way for the same value.
Press the button with a question mask to obtain a random value.

Number of levels(loops): [1,30, dft:15]
This value tells how many segments you want from the first to the end of the branch. The bigger this value is, and the more resource it will need!
The velocities and the length of the branches are dicreasing randomly at each level.

Inner Shadow (add noise): [yes/no, dft:no]
Choose Yes to add some noise inside the branch width. It could simulate some wood details of leaves NEW with a gradient from Secondary color at the bottom to the Primary color at the top. Use the slider to modify the noise level...

Use Brush Width: [yes/no, dft:no]
Choose Yes to enlarge the size of each point.

Use Relief: [yes/no, dft:no]
Choose Yes create as a relief aspect. The best way to use this function is in two passes: First pass with Inner Shadow ; Select a darker color for the second pass with Relief.

Test it and let me know...

#2 drakaan

drakaan
  • Members
  • 619 posts
  • Reputation:0

Posted 07 June 2007 - 04:09 PM

Very interesting stuff...Where can I find the source for it?

#3 MadJik

MadJik
  • Members
  • 2,428 posts
  • LocationLille;France
  • Reputation:20

Posted 07 June 2007 - 04:11 PM

For now it's in my USB key drive ;)

#4 BoltBait

BoltBait
  • Administrators
  • 8,910 posts
  • LocationCalifornia, USA
  • Reputation:103

Posted 07 June 2007 - 04:21 PM

Make a backup, quick! I have had more than one of those things go bad. :(

Nice plugin. Can't wait to try it. Also, I wouldn't mind seeing the source as I am curious how you solved certain problems.
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#5 david.atwell

david.atwell

    Former Moderator

  • Members
  • 627 posts
  • LocationIndianapolis, IN (39°46′5.88″N 86°9′29.52″W)
  • Reputation:18

Posted 07 June 2007 - 05:08 PM

MadJik is one of my new favorite people. I can't wait for this one to go into final release!

Posted Image

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.


#6 MadJik

MadJik
  • Members
  • 2,428 posts
  • LocationLille;France
  • Reputation:20

Posted 07 June 2007 - 08:00 PM

Posted Image
I wasn't able to use the forum for about 45-60 min!
Grrr!
I made something burning!

_________________

Made a backup, source is safe !

#7 spike 121

spike 121
  • Members
  • 1,663 posts
  • LocationMichigan
  • Reputation:0

Posted 07 June 2007 - 08:02 PM

thats sweet! write a tut?
Posted Image
"No. Dreaming is illegal."~Pyrochild

#8 MadJik

MadJik
  • Members
  • 2,428 posts
  • LocationLille;France
  • Reputation:20

Posted 07 June 2007 - 08:12 PM

Small update and source added...

New image:
Posted Image

#9 The_Lionhearted

The_Lionhearted
  • Members
  • 2,613 posts
  • LocationSpringfield, MO
  • Reputation:1

Posted 07 June 2007 - 10:15 PM

Posted Image

Yes, Lord, I will go to Egypt! 8)

#10 Helio

Helio
  • Members
  • 1,954 posts
  • LocationMichigan, USA
  • Reputation:1

Posted 07 June 2007 - 10:37 PM

Did ya take your sandals off?

_________________

Sorry, back on topic. Nice one Madjik (as always). I could see the Alpha becoming fairly advanced!

v An excellent open–source strategy game—highly recommended.
Posted Image

"I wish I had never been born," she said. "What are we born for?"
"For infinite happiness," said the Spirit. "You can step out into it at any moment..."


#11 usedHONDA

usedHONDA
  • Members
  • 5,738 posts
  • LocationOrlando, FL
  • Reputation:3

Posted 08 June 2007 - 12:15 AM

@Madjik: Stop making cool example images and stick with the coding because frankly, it rules! Keep it up!

"The greatest thing about the Internet is that you can write anything you want and give it a false source." ~Ezra Pound

Posted Image

twtr | dA | tmblr | yt | fb


#12 david.atwell

david.atwell

    Former Moderator

  • Members
  • 627 posts
  • LocationIndianapolis, IN (39°46′5.88″N 86°9′29.52″W)
  • Reputation:18

Posted 08 June 2007 - 02:14 AM

@Madjik: Stop making cool example images and stick with the coding because frankly, it rules! Keep it up!


Yeah, MadJik makes us all feel a little inadequate.

----

I bet you could flip this effect over and use it as lightning. No more scribbling with the pen tool!

We're not too far away from never needing the pen tool ever again...

Posted Image

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.


#13 derkaderka

derkaderka
  • Members
  • 120 posts
  • LocationColumbus, Georgia
  • Reputation:0

Posted 08 June 2007 - 03:46 AM

i definitely fell a little inadequate...
Posted Image
Posted ImagePosted Image

#14 Ash

Ash

    Former Moderator

  • Members
  • 6,381 posts
  • Locationhttp://tinyurl.com/6kqz9v
  • Reputation:5

Posted 08 June 2007 - 04:10 AM

Very Nice! But I will wait till it's outta beta 8)

Posted Image
All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ]


#15 pyrochild

pyrochild

    Plugin Author of the Year 2012

  • Administrators
  • 11,247 posts
  • LocationColorado
  • Reputation:132

Posted 08 June 2007 - 04:56 AM

This plugin looks amazing! Shame about all the selection problems and performance issues though...

Make a backup, quick! I have had more than one of those things go bad. :(


I've never had one go bad, but I have a tendency to lose them... a lot.

Very Nice! But I will wait till it's outta beta 8)

You're assuming that it will go out of beta. CodeLab is still beta, Gmail has been in beta since I joined, and I was one of the first ones to receive a random invite on the Google page.

Posted Image
[I write plugins and stuff] [Follow my stupid brain on Twitter]

If you like a post, upvote it!


#16 davidtayhs

davidtayhs
  • Members
  • 195 posts
  • Reputation:0

Posted 08 June 2007 - 08:35 AM

If we asked Einstein, he would say it's all a matter of relativity!

If someone like Madjik never warned that a plugin was a beta but now tells us that his latest is a beta, then I choose to believe him!

#17 MadJik

MadJik
  • Members
  • 2,428 posts
  • LocationLille;France
  • Reputation:20

Posted 08 June 2007 - 10:47 AM

Back to Beta:
Is anyone could explain me the difference between:
r = Utility.ClampToByte©;
and
r = (byte)c;
?

__________________
For now it's working if you follow the recommendations (no selection, etc...). It will
stay 'Beta' as long as I've not fixed any crash...

#18 BoltBait

BoltBait
  • Administrators
  • 8,910 posts
  • LocationCalifornia, USA
  • Reputation:103

Posted 08 June 2007 - 04:23 PM

A little bit of testing should tell you the difference for the following values:

int c = -1;

or

int c = 256;

;)
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#19 MadJik

MadJik
  • Members
  • 2,428 posts
  • LocationLille;France
  • Reputation:20

Posted 07 June 2007 - 04:00 PM

Goto here for the lastest version:
http://paintdotnet.1...p?p=67583#67583

____________________
Original version was :
____________________

GenTree: Generator of Trees & Branches

Posted Image
(reworked tree sample: background and shadows added...)

Warning
Warning: Depending on the setting you choose, it could freeze PDN in some cases!
Advise: Save your work before you use this plugin!


Download
New plugin GenTree.dll
here is the zip of DLL
here is the zip of Sources

Now let's play...


How does it work?

The first point is always the middle of the bottom edge of the image.
From this point, it chooses a length and destination for the first branch.
At the end of the branch, it decides to create (or no) one new branch and it goes on with the actual branch.
Then for each branch, it redoes the same till it has reached the number of levels...
Sorry, no leaf yet on the branch...


Programming tips?

It first uses a table with the size of the image to calculate and place each pixel.
The loop is self recursive for the branches.
It means that it could be unsafe to choose a big amount for the number of levels as well as a high % for new branch.
The CPU / Memory will be impacted by this settings...

I've added Green-Red guides under critical sliders.
If you stay in the green side, it should be ok.
You could go in the red side for one slider at a time it should be still ok.
Otherwise, prepare yourself to wait for the result... :P


The user interface

Posted Image

Length of Branch: [1,100, dft:70]
Affect the length of the branch. There is also a random adjustment to make it more natural.

Chance of a Branch: [0,100, dft:70]
At each end, it decides to create a new branch or no, based on this chance in %.
100% a new branch at each end...

Initial Velocity Vertical: [-100,100, dft:20] (used in absolute value: -100 = 100)
The branches are normaly going down to the floor, following a curve.
The Vertical velocity will affect the radius of this curve.

Initial Velocity Horizontal: [-100,100, dft:0]
The horizontal velocity could be considered as a wind factor...

Reseed Value: [0,100000, dft:0]
If the value is 0, then you choose to always have something new. The random generator is free.
If the value is not 0, then the random generator will always follow a sequence of values.
The tree will be draw and redraw in the same way for the same value.
Press the button with a question mask to obtain a random value.

Number of levels(loops): [1,30, dft:15]
This value tells how many segments you want from the first to the end of the branch. The bigger this value is, and the more resource it will need!
The velocities and the length of the branches are dicreasing randomly at each level.

Inner Shadow (add noise): [yes/no, dft:no]
Choose Yes to add some noise inside the branch width. It could simulate some wood details of leaves NEW with a gradient from Secondary color at the bottom to the Primary color at the top. Use the slider to modify the noise level...

Use Brush Width: [yes/no, dft:no]
Choose Yes to enlarge the size of each point.

NEW
Use Relief: [yes/no, dft:no]
Choose Yes create as a relief aspect. The best way to use this function is in two passes: First pass with Inner Shadow ; Select a darker color for the second pass with Relief.

Test it and let me know...

EDIT1: Added shadow slider...
EDIT2: Added link to the sources...
EDIT3: Added Relief mode and [?] to give a random value...
EDIT4: Crash fixed...RC instead BETA!

#20 drakaan

drakaan
  • Members
  • 619 posts
  • Reputation:0

Posted 07 June 2007 - 04:09 PM

Very interesting stuff...Where can I find the source for it?