Results 1 to 10 of 32

Thread: Planet texture generation code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Oct 2012
    Location
    Columbus, Ohio
    Posts
    4
    Blog Entries
    3
    SilverWarior,
    I am attempting the impossible.
    Part of my plan is to start with a planet as the game area as opposed to a square. I have been looking for a google earth, earth 3d, ossimplanet equivalent for Pascal but have not found anything...until I found this post.
    I would be very interested in learning about your progress.
    Thanks in advance,
    Bill

  2. #2
    whtemple1959 welcome to PGD first.
    Unfortunately I haven't done much progress so far. As you might nit know this was part of myGame project with whic I intended to ener 2nd PGD mini competition. But since there was a time limit I had to abandon further development on this part and try to finish rest of the game. Unfortunately I was unsecsessful as the time ran out before I managed to create games GUI (spent more time on this mater than I planed).
    Even after the 2nd PGD mini competition was over I had not resumet work on this becouse I got idea of making a library which would alow me to easily make GUI for any of my future games.
    I must also admit that I haven't done much programing in the last mont or so. I0m having problem getting myself to do any work.

    My original goal was to use perling noise function to generate heightmap texture, use some postprocessing on this texture for finetuning and then finaly use the heightmap to generate planets surface texture. I didn't have intention to make actuall planet model but only to make texture which I could render on a sphere so that it will look atleas a bit similar to planet.
    Sure I could apply heightmap to the sphere to actually gain elevated terrain but this was deffinitly out of my reach for a project which needed to be done in a month time.

    You are saying that you intent to use sphere for game map instead of square map. What dimensions do you intent to use? If you want lots of percision you have to realize that this will require lots of space for textures.
    For instance Google Earth suposingly uses more than 150 TB of data for storing all the surface images.
    http://www.gearthblog.com/blog/archi...up_google.html

    Now if you want quickest answer about how to implement planetary map in your game I recomend you to get in contact with Sascha Willems the author of game named Projekt Weltherrscher.
    http://www.pascalgamedevelopment.com...t-Phase-2-quot
    He is using planetary map in his own game and I'm sure he will be glad to help you out. I only think that he has no algoriithm for radom map generation but I might be wrong (havent tried latest version of his game).

  3. #3
    Gimp is your best friend if you want a simple planet done I just drew all kinds of noise and blurs with different colors, then finally apply "Make seamless" effect. This makes the texture wrap from sides so that you can use it as texture, without visible edges when coords 0 and 1 clash. Different planet types ended up looking like this:
    https://docs.google.com/open?id=0B7F...HhhbVRnam9rTVU
    Each have 2 cloud layers which rotate the planet at different pace.

  4. #4
    Yes I agree but if you remember I was trying to make algorithm which would randomly generate planet textures inside my game.

  5. #5
    Depends on what you need from the texture. To backtrace actions you would do with Gimp, and replicating with Pascal is not that hard. But does it need to support close-up generation, like zooming in tiny section of the planet and generate a new high quality texture to that? Then you need a real formula, and can't rely on random, blurring or anything like that. I could suggest sine-waves in multiple layers and in different frequencies. You can have 1 set of waves with X-coordinate and other for Y, then sum them up for RGB or heightmap representation.

    Say, sin(X) does a very static wave that you can see repeating. But (sin(X)+sin(0.9+0.31235*X)*0.7124) will not make any repetitions. Although, for it to wrap around seamlessly you might want it to have some repeat, scale it with proper PI-multiplications etc...

  6. #6
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    Guy W. Lecky-Thompson wrote a couple (maybe more books) on this subject which I found very interesting.

    Inifinite Game Universe: Mathematical Techniques (ISBN 1-58450-058-1)
    Infinite Game Universe: Level Design, Terrain and Sound (ISBN 1-58450-213-4)

    I'll confess I've only really read the first one properly, it's about the maths behind things like sequence generators, pseudo random number generators and fractals (to name a few) which you can use to seed levels from a single number. I was reading them because I wanted to be able to store a huge game universe in an absolute minimum amount of data. Anyone old enough to recall the game Whirlygig and the ST and Amiga? I believe that used seeding techniques for scenario generation and had something like 33 million levels and yet fitted on a single sided 3.5" disk, a mere 360KB.

    Anyhow, I digress. There is a lot of information about this sort of procedural generation and seeding available on-line. User137 is quite correct though, for more than a handful of planets, building them by hand will be too much effort and maths will have to take center stage to generate them. As he has alluded to, the trickiest part is the seamless texture, but if you use 3D Perlin noise to generate your data values (this is seeded and so will be repeatable if memory serves and more importantly, it is seamless so you don't have to worry about that specifically) you can use a polar coordinate scheme to map a position on the sphere to a position on a bitmap and generate your textures dynamically. Perlin noise can also, again if memory serves correctly, scale well so you can zoom in fairly easy.

    I say 'if memory serves' alot, because I did spend a lot of time looking into this stuff myself about 6 years ago... I've consumed a few crates of beer since then and I've slept quite a lot so my memory of the details isn't 100%, just the principles.
    :: AthenaOfDelphi :: My Blog :: My Software ::

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •