Jump to content

Search the Community

Showing results for tags 'crater'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. I have been experimenting with ways to generate moon-style craters as height maps in a reasonable processing time. The best method I have come up with so far uses 2D gaussian functions (2DGF). I set several parameters for a crater, each random within a certain range: crater radius, peak height, rim width and rim height (in arbitrary units for now). All my 2DGFs are circular in cross-section, so there is a single radius. My algorithm works as follows. Step 1. An inverted 2DGF with half-height radius (HHR) equal to the crater radius and height equal to the peak height is subtracted from the terrain, forming a bowl. The volume of this bowl is proportional to the radius squared (see the Wikipedia article again) so this total volume is noted. Step 2. The central peak is added as a positive 2DGF with HHR equal to the crater rim width and the peak height was given. The volume of this 2DGF is subtracted from the total volume noted in step 1. Step 3. Starting at a random bearing, positive 2DGFs are added with HHR equal to the crater rim width and height equal to the given rim height. The positions of these 2DGFs are random around the circumference of the crater. The volume of each is subtracted from the total volume noted before. This continues in a loop until the volume goes below zero. In this way the volume of material removed in step 1 is replaced by the peak and rim, which must happen in the real process of bombardment. (The proportionality factor is the same for all the volumes so there is no need to calculate it.) You can see my working version at grelf.net/contours/moon.html . This first shows a perspective view of a single (random) crater. From there you can go to a map and clicking the map enables you to create further craters, bombarding the moon. You can also see the height map in various formats (contours or height as brightness or colour). The code is an extension of 2 earlier contouring projects of mine: see grelf.net/contours/auto.html or simply grelf.net/contours/ . All are written in vanilla JavaScript in a standard 2D canvas. All use Paul Bourke's brilliant 1987 algorithm for drawing the contours. (I am fascinated by contour maps.) I realise that my crater rims are not jagged enough, so there is still work to be done. My source code is easily discoverable from the HTML page and I have deliberately not minified or obfuscated it - use it and improve it please. I want to encourage creative programming, particularly in plain HTML/JavaScript.
×
×
  • Create New...