Home
Products
Community
Manuals
Contact
Login or Signup

Planet Creator

Miscellaneous Forums/Blitz Showcase/Planet Creator

Krischan(Posted 1+ years ago) #1
I present you a small milestone of my current project (won't go into details here but it has something to do with Starflight), a dynamic planet texture/surface generator done in Blitz3D. It is roughly based on my Blue Marble code and could be part of a space game in the future.

I only use a preset style for a planet type with some parameters which can be quite random, blend two basemaps out of 51 predefined source heightmaps together, add some scaled fast perlin noise, emboss the final heightmap and apply a color gradient to it - so a whole planet with a 1024x512 detailed texture gets calculated below a second (on my 3 year old laptop). The source maps are classified in crater, dry, gas, ice, molten, plate and rock to get different planet types.

And then you get something like that, still in development but looking nice at this point:

14 different planet type presets screenshots


Maps output sample, here for the "Ganymede" preset


CURRENT RELEASE



The available keyboard shortcuts are listed here:

[A] Atmosphere on/off
[G] Planet Glow on/off
[S] Fake Shader on/off
[R] Rings on/off
[N] Nightside on/off
[T] Colormap on/off
[C] Clouds on/off
[M] Shadowmask on/off
[W] Wireframe on/off
[H] change Noise source (Perlin preset / Diamond)
[D] DOT3 Normalmap on/off
[V] Cloud Shadows on/off
[1] LOD Level 2048x1024
[2] LOD Level 1024x512
[3] LOD Level 512x256
[SPACE] Generate new planet
[RETURN] Save all maps to output Folder

Arrows/Mouse to move around, Mousewheel zooms

Download: PlanetCreatorDemo.exe [7.8MB 7zip SFX]

Last edited 1+ years ago


OldNESJunkie(Posted 1+ years ago) #2
Wow, that looks REALLY good.


stayne(Posted 1+ years ago) #3
Always a treat seeing your space stuff Christian. I would love to see a game from you. If you ever need music, I would love to contribute.

Your efforts are always greatly appreciated and I am sure I am not the only envious person here!

Last edited 1+ years ago


slenkar(Posted 1+ years ago) #4
velly niccceeee

ME LIKE ME LIKE


[Banned](Posted 1+ years ago) #5
It is incredible, every time I see what you do, I realize that the problem is not Blitz3D, or if not tools that I have no talent =)


ZJP(Posted 1+ years ago) #6
Wooooo. Nice tool Krischan. As usual..


Adam Novagen(Posted 1+ years ago) #7
You, Krischan, have my utmost respect in this project :D


EdzUp[GD](Posted 1+ years ago) #8
Excellent would love to see the code to this as this sort of thing interests me greatly :)

Inspires me to have a go at resurrecting star flight 2000 :)


Steve Elliott(Posted 1+ years ago) #9
Cool :D


Ross C(Posted 1+ years ago) #10
Always a pleasure to see your stuff man!


Aymes(Posted 1+ years ago) #11
Wow, those are awesome!

Are you going to release this for others to use, or keeping it for your own projects only?


Krischan(Posted 1+ years ago) #12
@all: thanks, I hoped that you all like it but now i'm astounded. You've seen absolutely nothing of it ;-)

Aymes: Well, it is not finished and I'm perfectionist. But at this stage it could be used as a texture generator for fictional planets. I think I'll release it when I found all nasty bugs on my list and commented the source.

With Saturn as my favourite planet, here is another screenshot (now with planetary shadow on the rings). Oh and by the way, this is B3D realtime ingame graphics using 2048x1024 source maps and calculated in 2.3 seconds, I hope your screen is wide enough :-D



Last edited 1+ years ago


[Banned](Posted 1+ years ago) #13
oO??? I Like Moon, But your planet Saturn will be my screensaver XD.


RemiD(Posted 1+ years ago) #14
You are really a talented coder Krischan. Respect :)

Is this for a Freelancer-like game with the possibility to land and to mine on each planet ?


Krischan(Posted 1+ years ago) #15
I'm looking forward to a Starflight 1 like game. This would be the perspective before you land on the planet. Here some updates in Wallpaper size, I added citylights/nightsides texture creation on the fly and tweaked every planet in a few hours or so. And I added a complete INI-System to tweak the planet types very easy.

With these additions it is possible to create Coruscant-like planets, glowing molten planets and I could even finish my first Death star (this is the same sphere like all planets, it is only a texture!) Oh and all of this is still vanilla Blitz3D :-D

You can create planets and destroy them in a second again, heh! Now witness the firepower of this fully ARMED and OPERATIONAL battle station! Luke... help me take this mask off.

Arid world with super advanced cities


Advanced Temperate World


Molten Planet, glowing on the nightside


Jupiter like Gas Giant


Saturn, my favourite


Death Star "Krischan 1" ready to rumble


Last edited 1+ years ago


EdzUp[GD](Posted 1+ years ago) #16
nice :D


slenkar(Posted 1+ years ago) #17
star wars video game HD version :)


jfk EO-11110(Posted 1+ years ago) #18
looks great, hats off.


stayne(Posted 1+ years ago) #19
jfk: Krischan is ahead of you in sig apps :)


Krischan(Posted 1+ years ago) #20
Stayne: but only with tech demos :o) By the way:

I've been making a lot of progress the last days converting and moving over to MiniB3D. I created a small executable demo for the audience showing a peaceful Temperate world: Teaatis (the name gets created random using the original Elite algorithm :o). In the first run the App converts the four included 2048x1024 RAW basemaps to smaller LOD levels. Then you should get something like this:



In this demo you can use these keys to switch some effects on/off:

[A] Atmosphere on/off
[G] Planet Glow on/off
[S] Fake Shader on/off
[R] Rings on/off
[N] Nightside on/off
[T] Colormap on/off
[C] Clouds on/off
[M] Shadowmask on/off
[W] Wireframe on/off
[H] change Noise source (Perlin preset / Diamond)

[1] LOD Level 2048x1024
[2] LOD Level 1024x512
[3] LOD Level 512x256

Use your mouse to move around the planet and the Mousewheel to Zoom in/out, Arrows Left/right turns the Planet and Up/Down moves towards or away, SPACE creates the next random world. And with [RETURN] all 10 maps are saved as PNGs to a "output/" folder: Noisemap, Heightmap, Embossmap, Climatemap, Normalmap, Merged Colormap, Pure Colormap, Nightmap, Ringmap and a Screenshot.

Grab it here: demo.zip [6.3MB]

You can open the RAW Basemaps in Photoshop or another Paint program, load them with 2048x1024 size, 1 channel (not interleaved) 8bits, no header. This is only a small part of the maps I created/converted the last weeks. My 2048 maps folder has 53 hires base maps with a total size of 108MB now capable of creating 20 different planet styles now.

I'll plan to release the full project with source as soon as I've created all the features I want to see, which can take some time. Oh and I would like to know how FAST the planet gets calculated in 2048/1024/512 LOD mode on your computer. To compare: start the App, press 1/2/3 and read the ms values from the top line. My records are 2541/631/165ms (C2D P9500 at 2.53GHz).

Last edited 1+ years ago


Kittomer(Posted 1+ years ago) #21
Oh, I hope you'll have good progress with this, I always wanted to make a game like Planet's Edge.

When I start the demo, something weird happens. I mostly just see a static background of stars and sometimes the planet, but the moving/turning planet is sort of... flickering in erratically.

Although I did manage to read the values, which are about 2700, 700 and 180 on my secondary desktop, which is a Celeron E3400, 2,6 Ghz, 4 GB RAM and a Geforce GTX 260, on Vista 64 Bit.


Krischan(Posted 1+ years ago) #22
Edit: Found the Bug and updated the package, there was one flip too much :-D Download and try it again please.

Last edited 1+ years ago


Guy Fawkes(Posted 1+ years ago) #23
Are u releasing the source for this? :O


Krischan(Posted 1+ years ago) #24
I forgot to mention: the final release will include a license agreement that people who repetitive don't read my posts and ask me questions that are already answered in these posts are not allowed to use the source and its results or parts of it in private, commercial or whatever projects for all times.


Ross C(Posted 1+ years ago) #25
In otherwords, Post 11.


GaryV(Posted 1+ years ago) #26
I forgot to mention: the final release will include a license agreement that people who repetitive don't read my posts and ask me questions that are already answered in these posts are not allowed to use the source and its results or parts of it in private, commercial or whatever projects for all times.


Could you also add a clause that such people are not allowed to reproduce?


slenkar(Posted 1+ years ago) #27
you could give the planets an atmosphere by creating an inverted sphere and scaling it up slightly bigger than the planet, then give the sphere an alpha value of about .3


Kittomer(Posted 1+ years ago) #28
Yes, that fixed it, the planet is properly turning and displaying now!


Krischan(Posted 1+ years ago) #29
slenkar, my Atmosphere code is a little bit more complex than a sphere and uses a spherical projection texture loaded with flag 64. The atmosphere moves with the camera and disappers softly on the nightside, like in reality but faked very well :-D





Last edited 1+ years ago


[Banned](Posted 1+ years ago) #30


=)


Krischan(Posted 1+ years ago) #31
> you could give the planets an atmosphere by creating an inverted sphere and scaling it up slightly bigger than the planet, then give the sphere an alpha value of about .3

EXCELLENT. I tried it out and it looks even better, more realistic. I didn't need the invertion. It uses a much simpler code, I can save a mesh update per cycle, it has only a few more tris instead and most important: I save the Entityorder -1 which could cause trouble later. Thanks! I'll use your solution now, here you can see it in action:





Last edited 1+ years ago


EdzUp[GD](Posted 1+ years ago) #32
very nice


slenkar(Posted 1+ years ago) #33
looks good


Krischan(Posted 1+ years ago) #34
And now for something completely different: I changed the large images in this post here to thumbnailed links so the thread should load much faster now.


taumel(Posted 1+ years ago) #35
Cool, makes me want a new ELITE even more. For a couple of planet surfaces it seems to work pretty well, how about more of them (100s-10000s)? Does it still a good job then or will you notice that it's based on predefined source material?


Krischan(Posted 1+ years ago) #36
Taumel, this depends on the quality/variance of the sourcemaps and how "featured" they are and how many different basemaps are available. I spent several days to collect them, examine, blend with other maps and finetune their brightness/contrast. This has been very hard work and I have chosen the 5 best maps of each category.

Some basemaps look very neutral and the blended noisemap will make them very random as a result, some have features you can't blend off and then all the planets using this featured basemap will have this feature. But it is a feature that they have features so they look more interesting. And I don't care about 10000 different planets, perhaps 100 or 1000 planets in a game (and that's alot). You can't get this surface quality in realtime or you must preprocess ALL planets and this not realistic and takes too much filespace.

With 5 basemaps per category (ex. crater, rock, desert) you'll get a lot of combinations and the random noisemap makes them pseudorandom so they would look similar but unique. And we have at least 15 different and mostly unique planet styles, you could use a single seed for a whole solar system but all planets would look completely different as the styles are mixed in a system:

Arid, Desert, Temperate, Frozen, Icy Moon, Brown Dwarf, Jupiter, Mars, Molten, Neptune, Ocean, Saturn, Uranus, Venus, Acid

By the way - I implemented normal mapped clouds now, see the difference (upper half = DOT3 clouds, lower half = normal) :-D



Last edited 1+ years ago


taumel(Posted 1+ years ago) #37
Hmm, so i guess if you're after a lots of planets the best still is to feed some Fibonacci like unique ids for parameters of a procedural generation for a planet which you just calculate before entering a system.


Kittomer(Posted 1+ years ago) #38
If you wanted to go full monty, you could add cloud shadows, like so:



It adds a lot of depth and touchy-feeliness to the planets, especially up close.


Krischan(Posted 1+ years ago) #39
I don't reach the texture resolution in your screenshot and I don't have any shaders
working but with an additional sphere and the inverted, slightly lightened cloudtexture we'll have simple but nice cloud "shadows" now:





Last edited 1+ years ago


Krischan(Posted 1+ years ago) #40
Ok here we go for a snapshot of my current workfolder including the executable, all BMX sources, textures and the basemaps for the temperate world shown here. The source is partly commented and includes some functions which are not in use right now. But you can take a look how the planet is generated and play around with it. I hope it works with the standard MiniB3D 0.53 mod with the current BlitzMax release, didn't test it with a clean install. This is not the final release which will include all basemaps and templates for different worlds.

Notice: the DOT3 effect could be based on wrong angle calculations, if you're familiar with DOT3 calculations (I'm not) please take a look into it and correct it. And if you have ideas for general improvement please post them (and the source) here in this thread.



As a reminder, the available keyboard shortcuts are listed here again:

[A] Atmosphere on/off
[G] Planet Glow on/off
[S] Fake Shader on/off
[R] Rings on/off
[N] Nightside on/off
[T] Colormap on/off
[C] Clouds on/off
[M] Shadowmask on/off
[W] Wireframe on/off
[H] change Noise source (Perlin preset / Diamond)
[D] DOT3 Normalmap on/off
[V] Cloud Shadows on/off
[1] LOD Level 2048x1024
[2] LOD Level 1024x512
[3] LOD Level 512x256
[SPACE] Generate new planet
[RETURN] Save all maps to output Folder

Arrows/Mouse to move around, Mousewheel zooms

Download: PlanetCreatorDemo.exe [7.8MB 7zip SFX]

Last edited 1+ years ago


Kittomer(Posted 1+ years ago) #41
Yeah, I know, the image was just for illustration.

I was thinking you'd do it with an additional sphere.

But it looks good, I like it!


Armitage 1982(Posted 1+ years ago) #42
Awesome details !


Krischan(Posted 1+ years ago) #43
I'm making progress in object oriented design (and finetuning the planets). Now, a planet gets created using a custom "TPlanet" type and attributes are added very easy to it. In the screenshot, the Temperate world is the default with presets and Mars gets created with this simple piece of code (Venus, too with slightly changed variables):

Local p2:TPlanet=New TPlanet
p2.PlanetPalette="Mars"
p2.Clouds="clouds2"
p2.PolarCaps=0.01
p2.PolarAlbedo=192
p2.Population=0.0
p2.Detail1=64
p2.AtmoRGBA=[255,128,64,128]
p2.GlowRGBA=[255,192,64,255]
p2.CloudsRGBA=[255,96,32,100]
p2.CloudShadowRGBA=[0,0,0,100]
p2.NightRGB=[8,4,0]
p2.Shininess=0.0
p2.Generate()

You see three times the same planet heightmap only with different attributes applied, woohoo:



As a bonus, Mars from a different angle:



Last edited 1+ years ago


cws [retired](Posted 1+ years ago) #44
Jaw dropping amaizing creation! :O


Wiebo(Posted 1+ years ago) #45
beautiful!!


Steve Elliott(Posted 1+ years ago) #46
Stunning.


wmaass(Posted 1+ years ago) #47
Looks amazing. Krischan you are the natural environment guru.


[Banned](Posted 1+ years ago) #48


Beatifulll =).


Blitzplotter(Posted 1+ years ago) #49
Verrry nice eye candy


OldNESJunkie(Posted 1+ years ago) #50
Wow, this just gets better & better. Keep it up.


Armitage 1982(Posted 1+ years ago) #51
Crispy !

Did you generate the Nebula too !? Another nice addition if not :)
While different, I am amazed by the resemblance with solar system planets.
Great work.

I have no idea about your space simulation game, but I would love to land on them and discover generated landscapes. Procedural is really a powerful thing.

Last edited 1+ years ago


Krischan(Posted 1+ years ago) #52
The nebula: yes, take a look at my signature, it's an older creation. It is only combined with a real panorama of the milkyway in this version.

Planet Creator is pseudo-procedural only, you can't get these results with procedural algorithms only in a acceptable time, so it is a compromise. My goal is to create a whole planet in a second, and even that is a long time.

Here are two current screenshots, I added detail texture support now to greatly improve the appearance of some planet types even with low LOD details:






Krischan(Posted 1 week ago) #53
Here is a running WIP demo of my new planet creation algorithm, again in vanilla Blitzmax+miniB3D. Just the "Earth" in 1024x768 Fullscreen mode. If you want higher resolutions compile it yourself or give me a notice. Moving with Arrows and holding right Shift increases moving speed. Other keys with functions are:

1-5 = Milkyway background layers
F1-F5 = Planet Layers
V = Vsync
A = Atmosphere
C = Cloud Layer 1
D = Cloud Layer 2
P = Base Planet Layer
T = Planet Rotation on/off
ENTER = Create a different planet in only a few milliseconds, on my rig: 60-70ms (!)

It is taken from my project folder so it is not well commented or optimized yet but working. And I reduced the textures from 2048x2048 to 1024x1024 except the clouds and included only the earth textures to save space, this demo uses originally over 150MB space (with all planet types 600MB).

Short explanation how I did it: The base is a segmented Cube with added Simplex Noise to the vertices and it is spherified then. After that, additional layers with vertex alpha are added on top according to different height values from the base cube (VertexRed channel) and uop to three detail and one color texture are added to each of these layers. They overlap nearly perfect so there are nice transitions between them. And the creation is running so fast that you could create a whole planet system close to realtime! With nice clouds and a atmosphere it looks much better than the crap I made before in this thread :-D

There are a lot of other planet types possible, here only a few examples (not included in this demo), click for fullscreen:



And here we go: Download (13MB)

And for the most impressive feeling you should play a background music like "The Blue Danube" or even better: The "Itineris Spiritus" demo from this site (upper right): http://www.soundsonline.com/Symphonic-Choirs which is absolutely beautiful and always creating tears in my eyes while watching this demo. But don't use the Shift key then, just float down :-) It is most relaxing and inspiring then.


Brucey(Posted 1 week ago) #54
Shame it doesn't procedurally generate the planets :-)


Krischan(Posted 1 week ago) #55
Not quite - it is still semi-procedural - and the base planet IS actually procedural and dictates the form of the layers. A subdivision of the spherified cube would be the next logical step - anyone here who can do this? I'm helpless here.


Derron(Posted 1 week ago) #56
Christian, somehow the planets in your screenshots (the 2nd, 3rd and 4th some posts above) look like it is stretched at the right side - is this because of the viewport or the lighting - or the camera settings (ortographic, perspective - and their different angles).

But yeah, it is looking nice. Generating the "basemap" (bright, dark parts defining mountains, oceans, grassland) should be the most tedious part (to make it look "realistic" - realistic in the definition of what we think of other planets), afterwards it is - I assume so - more or less adding "variations".

bye
Ron


Krischan(Posted 1 week ago) #57
Derron, I can't see any distortion where you describe it. I've reviewed my code and there is no FOV or Zoom change in the camera. It could be just an optical illusion due the widescreen screenshot, the planets are still perfectly round. The planet is not a sphere - it's a spherified cube - there is still some distortion at the seams of the cube edges, but not so ugly compared to a standard sphere at the poles (no pinch effect!). The distortion is visible in the grey moon screenshot, in the middle of the moon you could see a large triangle like structure. But the distortion can be minimized by "warping" the edges with a proper Photoshop plugin, I'm using the free "Make Cube Tile" / "Make Iso Cube Tile" Plugins from Flaming Pear for that. This nearly eliminates the seams. I think the clouds have been corrected with it, too.

The most difficult part was to find/create matching base colormaps with interesting features for temperate planets, the other planets are much easier to "build" as you only need a good structured greyscale map / photo and I have tons of them.

One open issue is that I couldn't find a solution to create a cylindrical 2D map of the planet out of my 3D planet. For a game it would be important to have a 2D topdown map of the whole surface, for example if you're driving around on the planet surface and want ot know where exactly you are.

Perhaps somebody has an idea how to achieve this.


Derron(Posted 1 week ago) #58
@topdownmap

Can you "read" the texture displayed on each face/quad - if this is the case you "just" need to undistort each polygon. Then just - like a pattern - place the quads next to each other.
This should work, as you use a spherified cube, so the top and bottom vertices are not existing (no triangles in the "last" and "first" part) - they would lead to a visible seam/concentration point.


I think what you are looking for is "mercator projection":
http://paulbourke.net/geometry/transformationprojection

(You are German, so the link is the German Wiki entry)
https://de.wikipedia.org/wiki/Mercator-Projektion

Another planet generator doing this (when searching for "mercator projection" you will find that page)
http://www.diku.dk/~torbenm/Planet/

A dissertation about such textures and their generation:
http://www.inf.ufrgs.br/~comba/papers/thesis/diss-guilherme.pdf



bye
Ron


Krischan(Posted 1 week ago) #59
I tried some algorithms but either they were too slow or the result was not sufficient or with gaps/distorted. I need a formula / loop where you cycle through all X/Y pixels of the target map and get the corresponding pixel from the camera frustum, the camera must be rotated during this operation somehow and is placed in the center of the sphere with the sphere flipped i guess. But I dunno how.

And the map should be equidistance rectangular, not mercator. The formula for 2D/3D projection is simple like that, but without textures, only using the noise values:

' calculate 2D map
Global hmap:Int[width, height]

Local n:Float
Local h:Int

For Local y:Int = 0 To height - 1

	For Local x:Int = 0 To width - 1
	
		Local theta:Float = Normalize(x, 0, width - 1, 0, 360)
		Local phi:Float = Normalize(y, 0, height - 1, 0, 180)
		
		Local x3d:Float = (Cos(theta) * Sin(phi))
		Local y3d:Float = (Cos(phi))
		Local z3d:Float = (Sin(theta) * Sin(phi))

		Local n:Float = Noise2(x3d, y3d, z3d, seed, Octaves, persistence, scale)
		Local h:Int = ((1 + d) * 127.5)
				
		hmap[x, y] = h
		
	Next

Next

Here, the X3D/Y3D/Z3D variables are the coordinates of the corresponding 2D pixel in 3D space if you assume the sphere/planet has a radius of 1 unit until you multiply the scale with these values.

To give you an idea what I want to achieve here is a much earlier stage of the demo above where you can drive around on the planet with a "terrain vehicle" using the arrow keys. With Enter you can switch between chase and freeflight mode while LMB/RMB lifts you up in the sky. Right shift increases speed like always. It was just a small test so see if you can drive around seamless on a planet and it was hard to code in miniB3D using Euler to Quaternion functions (that you can freely drive in all directions, sounds simple but isn't).



Download EXE+Source+Media (5.5MB)


Derron(Posted 1 week ago) #60
so you need some cylindrical unwrapping code


http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO5/BOUNDARY/WVS/PCSOFT/IPROJ.C

http://ian.macky.net/pat/1.0/lib/proj/lcc.c


Like you already said: you need a formula calculating resulting pixels for a given spot in 3d space and a starting point (center of your camera). With helping values like "focal length" you should be able to "unwrap" it.


Also: do you happen to know the "grid coordinates" on the planets? Like 122m1s? In that case you can simply unwrap by storing that on a pixel grid. "duplicate pixel grid coordinates" then need to mix with all in a group (each pixel group is then a set of values - and at the end you calculate the average of all values to get the resulting pixel value).


bye
Ron