Giter Site home page Giter Site logo

einarbmag / moondemo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coryg89/moondemo

0.0 1.0 0.0 62.44 MB

A 3D Moon Demo in WebGL and JavaScript -- Texture map from Clementine spacecraft data

Home Page: http://coryg89.github.io/MoonDemo

License: MIT License

CSS 7.17% HTML 31.16% JavaScript 61.68%

moondemo's Introduction

Moon Demo

A photorealistic 3D graphics demo of our Moon written in JavaScript and WebGL featuring real high-resolution satellite maps. Check out the live demo! You'll need a modern browser with WebGL enabled in order to run it. I recommmend Google Chrome.

I recently tested this in Chrome for Android on my Galaxy Note 3 and it ran fine at 60 FPS. The stars were not visible. I think they are just too small.

Moon Demo Screenshot

Dependencies

This demo uses the following open source libraries:

Credit

In order to create a photorealistic demo I set out to find the highest quality public domain maps of the Moon available. I found out that there is good data published through the Map a Planet initiative and available on the USGS PDS site. The best data we have for our Moon was actually gathered by the Clementine spacecraft. It is possible to process a greyscale image of the entire surface of our Moon using this data, and as far as I know the best maps of the lunar surface we have today were derived from this data. I was delighted to know that all this great data available from USGS is public domain.

The best map I could find was processed by Jens Meyer and apparently also darkened up by Steve Albers. It and other high quality maps can be found on Steve Albers homepage and available free for personal non-commercial use. I say this map is the best in the sense that it has the highest resolution and detail compared to other maps I could find.

The original resolution of the map found on Steve Albers' homepage is 8192x4096. I am using a version scaled down in both width and height by 50% giving a texture at resolution 4096x2048. I find this size suitable for my demo.

My scaled down version is shown here:

Scaled Moon Map

Technical

This demo is an example of using WebGL with the Three.JS JavaScript library. GLSL shaders are used to create a material which is applied to the moon in order to simulate diffuse light calculated for each vertex on the Moon mesh. This allows the effect of the Moon changing phases.

I also generated 6 randomized star patterns in order to create the skybox around the scene, as well as generating a tangent space normal map from the original high resolution map. I generated normal maps at both the original size and the scaled verison.

The scaled normal map is shown here:

Scaled Normal Map

If you wish to learn more about how this demo was created, please check out my blog post for a more detailed technical explanation.

moondemo's People

Contributors

coryg89 avatar

Watchers

Einar Bui Magnusson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.