PDA

View Full Version : [GIMP Plug-in] Creating a starfield



Sagenlicht
11-10-2008, 05:06 PM
*********************************
Update 14.11.2008

Release 1.1

Changelog

Added an option to change the nebula opacity
If you had chosen not to add a nebula but set the param useCustomNebula to 'Yes' the script didnt execute. This has been fixed and the useCustomNebula param will now be ignored if you deselect the nebula.
Added an option for the star size.
Added an optional glitter effect to the stars


Please note, that atm if you choose bigger stars, less stars will be generated and your starfield will look much smaller. I wouldnt advice to select something larger than 'normal'. The 'tiny' option is equivalent to the original 1.0 star generation version.

Please let me know what you think about these changes :)
*********************************


Hmm as I need to do a 2nd starfield for my monthly challenge I decided to wrap it up into a script as I dont like doing something similar twice that could be scripted :)

As I couldnt find a starfield script I did one by myself (yes I know maybe my google-fu aint highly skilled).

A few words of explanation before you use this script.

Before you start using the script, open your image or create a new one. The script itself wont modify any existing layers but will add its own ones.

The script itself can do 3 things:

- Just create a starfield. Use this if you just need a simple starfield.
For this function please set both Nebula params to 'no' and ignore the Nebula Color.

- Create a starfield with a 'random' Nebula. Use this if you want a starfield completly filled with a Nebula.
For this function please set the 'Add a Nebula' param to 'Yes' and the 'Use a custom Nebula shape?' param to 'No'. Set the Nebula Color to whatever color you want, it is looking better with darker colors of its type, so if you wanna have a gray nebula just choose something like 50% gray or slightly darker or if you wanna have a green nebula chose a darker green.
You wanna use this function if you wanna do an excerpt of your galaxy within a nebula. I dont think you will need this function often, but at least its there :)

- Create a starfield with a random shaped Nebula within your selection.
For this function you have to use the free selection tool before you start the plug-in. Select an area where you wanna have the nebula later on and start the script. Set both Nebula params to 'Yes' and and choose whatever color you like for the nebula. Again darker colors of its type are looking better.

Have fun with the script!

Attached is an example how you have to setup a Custom Nebula before you start the script and an example of the result. Please note that every starfield and nebula will look differently as I use random numbers to create them.

You find the script in your Filters Menu at Sci-Fi/Add Starfield. If you do not see the script, please read here (http://www.cartographersguild.com/showthread.php?t=3060), what you have to do.

If you tried to add a custom Nebula and you do not see one, you most likely forgot to add a selection before you started the script.

Please post any comments or problems you have with the plug-in.

P.S. If I did post this in the wrong section (I am not sure where I have to post plug ins tbh :) ) please move the threat :)

P.P.S. I plan to do a planet script in the next few days as well, so stay tuned :)

RobA
11-10-2008, 06:37 PM
Nice.

I'll try this when I get to a computer with gimp.

I would make one suggestion to register it under filters->render rather than just filter.

-Rob A>

nolgroth
11-10-2008, 08:05 PM
This is great. Would have made a great resource for my November challenge map. Have some Rep, feeble though my rep stick is. :) Definitely a five star thread.

jfrazierjr
11-10-2008, 08:42 PM
VERY Nice. A couple of suggestions if you feel like making any updates to it:



How possible is it to make the stars larger? I had my zoom set to 50% and generated several tries because I thought it did nothing.
Perhaps a control to control density and one for random size (between x and y size for example)
Option to NOT generate the starfield. This would be nice in case you wish to add multiple nebulas via selection and don't want to have to remove the extra starfields.
In addition to color for the nebula's a control to set the opacity of the nebula layer(color).

In any event, GREAT work. Thanks for stepping up with some really cool plugin's for GIMP.

Sagenlicht
11-11-2008, 04:00 AM
Thanks for the feedback :)

@RobA
Well RobA I'll do a script when I need it and I tend to organize my scripts within my themes not within the structure of GIMP cause I want to have my custom scripts not mixed up with the standard scripts. Every script I download is getting sorted into my structure as well. E.g. your great dungeon maker script is registered at Filters/RPG Filters for me :) Yes you may call that behaviour weird :)

Maybe I should reconsider this and change the registration for the uploaded scripts.

@nolgroth
Thank you very much :)

@JF
- What size did your test image have? I will add an option to make the stars larger though :)
- Not sure I do understand this point. What do you mean with random size? Do you mean the star size?
- I did plan to do a stand alone Nebula script for that purpose. Maybe its smarter to have only one script. Your opinion?
- I plan to do a version where you can control a few more options like the opacity of the nebula layer.

Another thing I will add is the option to merge all layers, I simply forgot to add it, cause I tend to not merge anything. I often have more than 30 layers in a challenge file :)

Anyways I will update the script in a few days, cause I have to do the planet script first as I need to get my challenge finished first :)

jfrazierjr
11-11-2008, 01:33 PM
Thanks for the feedback :)

@RobA
Well RobA I'll do a script when I need it and I tend to organize my scripts within my themes not within the structure of GIMP cause I want to have my custom scripts not mixed up with the standard scripts. Every script I download is getting sorted into my structure as well. E.g. your great dungeon maker script is registered at Filters/RPG Filters for me :) Yes you may call that behaviour weird :)

Maybe I should reconsider this and change the registration for the uploaded scripts.

@nolgroth
Thank you very much :)

@JF
- What size did your test image have? I will add an option to make the stars larger though :)
- Not sure I do understand this point. What do you mean with random size? Do you mean the star size?

The image was 1600x1200, which is pretty much what my starting base is.

Yes, the start size. Granted, this is "a lot" of extra work, but perhaps some option to have curve for start size. If the base star size is 2px, perhaps a second layer with 1/6th(or so) as many stars at 3px, and perhaps a third layer with perhaps 1/20th of the stars at 5px. Granted, the numbers may be bogus as hell and it may not work like I am thinking it might, but hope you should get the point. This is not so much a big deal (though it would be way nice) as being able to start with bit larger stars from the get go.




- I did plan to do a stand alone Nebula script for that purpose. Maybe its smarter to have only one script. Your opinion?


I would say one script. Since you have the power of Python(GUI-wise) and you are really working on such similar stuff, I would say it makes far more sense to keep everything together. Ultimately, you would have to create(or have an existing) a starfield to populate your nebula anyway, so it might as well be in the same script.

Sagenlicht
11-12-2008, 05:26 PM
Heh funny JF, I'll use 1600x1200 for all my tests, I did like the star size ;)

Anyways, I will add an option for the star size, though in the first step I wont replace the used hsv noise trick for the stars cause I will have to do some research how to generate better ones.

I'll attach an image with a new star size and made them more shiny. What do you think, does it look better?

In addition you can see how far my planet script is, as I did place a script generated planet into the starfield. I used " Khuutath" style colors :)
I didnt use any textures for this planet though the script can handle them as well :)

jfrazierjr
11-12-2008, 07:13 PM
Heh funny JF, I'll use 1600x1200 for all my tests, I did like the star size ;)

Anyways, I will add an option for the star size, though in the first step I wont replace the used hsv noise trick for the stars cause I will have to do some research how to generate better ones.

I'll attach an image with a new star size and made them more shiny. What do you think, does it look better?

In addition you can see how far my planet script is, as I did place a script generated planet into the starfield. I used " Khuutath" style colors :)
I didnt use any textures for this planet though the script can handle them as well :)

That is way sweet image. Very nice. Ultimatly, I was thinking of the size being variable because someone (not me, I am not that much into star mapping) might want ot make one at 3-4 times my default size if they want something really detailed...

hmm for the hsv noise... does it all get set to white color, or are each bits slightly different color? If close in color, and the scripting interface does this, perhaps you can do select by color, grow the selection and then fill?? Don't know, thats just a WAG....

Karro
11-13-2008, 10:05 AM
sagenlicht's cool script piccie

Apparently I've repped you recently. It won't let me do so again, today, but this is well-deserving of more. Nice pic; I shall have to acquire these scripts and play with them when I get around to wanting some nice sci-fi space pics! :D

bryguy
11-13-2008, 12:44 PM
this is awesome! ive always liked making starfields, but it has always taken me 30 minutes to an hour, now i can make one really fast! :D



p.s. how do you even make a plug-in anyways?

RobA
11-13-2008, 04:17 PM
For gimp, the easy ways are figure out either python or scheme... for scheme there a re a number of pointers on the net.

Search for "script-fu"

I usually take one close and modify it.

-Rob A>

Sagenlicht
11-13-2008, 04:57 PM
Thanks for all your replies :)

@Karro
no worries :) I usually have the problem that I cant rep RobA cause I did it recently :) I just rate the threat then :) But way more important than repping me, is that you find the script useful :) I will post an update soon, I just didnt have time the last two days.

@bryguy
Thanks bryguy :) About the plug-ins. To add some words to what RobA said:

There 3 ways to do plug-ins/scripts for GIMP (or at least I know 3 ways).
- Scheme
- Python
- C code and compiling it afterwards.

If you know scheme its easy, as there are (as RobA said) alot of scripts in Scheme for GIMP so you can easily get into it.

If you know python it aint as easy as with scheme as you do not find that many scripts in python for GIMP and the documentation is rather... useless. Open the procedure/routine browser in the help menu (whatever its called in the english version) in GIMP, there you can find all GIMP specific script functions.

If you dont know scheme nor python I would suggest trying out python because if you ever wanna do some scripting outside GIMP chances that you can use python are much higher than for scheme. Atm scheme is better integrated in GIMP but I think this will change sooner or later. For GIMP 2.8. a better python support is allready planned.


For the interested, here is roughly what is planned for GIMP 2.8, the next stable release:

* Merging Google Summer of Code 2008 projects to trunk, namely on-canvas text editing, tagging of GIMP resources and Python scripting enhancements.
* Continue integration of GEGL.
* And of course many other improvements...


Though if you know one script language it should be rather easy for you to learn another cause in the end they do all the same only the syntax is different. While I cant script in scheme cause I do not know its syntax I can read it pretty well. So ultimatly if I would wanna use scheme I would be able to learn it pretty fast.

I did not mention the C code at all, cause if you arent a C coder this wont be the way you wanna go, trust me :)

Sagenlicht
11-14-2008, 08:10 AM
Ok, I did find some time do some quick updates to the script :)

About more than one nebula: atm my code cant handle it, and I dont think I will change the code :)

So if you want to have more than one nebula do the following:


Generate your starfield with your first nebula.
Create a new transparent layer below the nebula color layer
use the free selection tool to select your cloud area
Fill it with the desired color
Discard the selection
Apply a gaussion blur with the value of about 50
Set the opactiy of the layer to a value you like, I suggest arround 35 for dark and 15 to 20 for bright colors


This will take about 30 seconds to do :)

RobA
11-14-2008, 12:07 PM
@bryguy - one more thing...

Scheme scripts are slower and less flexible with their GUI, as python scripts can use the whole python GUI library (WX I think?).

Both scheme and python are cross platform, unlike C that needs to be compiled with different targets to get binaries.

The scheme (script-fu/tiny-fu/tiny-scheme) interpreter exists internal to GIMP, so every user has it. Python can be a pig to install in windows, and 90% of windows gimp users don't bother, so won't use python scripts.

Another thing I didn't mention before is the mathmap plugin. http://www.complang.tuwien.ac.at/schani/mathmap/

It can be quite powerful and easy for simple, single layer image manipulation. Though with its animation support it can do some pretty neat things, too, like this explosion example. (http://laurent.despeyroux.free.fr/gimp/explosion-4.html)

-Rob A>