Results 1 to 10 of 32

Thread: Planet texture generation code

Hybrid View

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

  2. #2
    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...

  3. #3
    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
  •