Code Monkey home page Code Monkey logo

barionleg / planet-renderer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kelan0/planet-renderer

0.0 0.0 0.0 557.87 MB

This is a rendering engine I made to render a full-scale planet that the player can land one and explore from anywhere.

Home Page: https://barionleg.github.io/Planet-Renderer/lib/glm/cmake/doc/api/files.html

License: MIT License

JavaScript 0.02% C++ 25.48% C 33.91% Objective-C 0.04% CSS 0.08% HTML 40.18% CMake 0.09% GLSL 0.21% Batchfile 0.01%

planet-renderer's Introduction

Planet Render

This is a rendering engine I made to render a full-scale planet that the player can land one and explore from anywhere. This is a project I worked on for about 3 months in 2016. The project was named Voxel Renderer because I originally planned for the terrain to be made of voxels and to be editable, but this ended up not happening due to complications with storing voxels on a spherical planet.

Features

Some of the most notable features that this rendering engine achieves include:

  • Chunked level of detail to make distant terrain mesh render with a lower poly-count. The planet is a normalised cube, and so as the player gets close to one of the 6 faces, it subdivides into 4 smaller chunks, which can also be subdivided. There can be up to 20 subdivisions, meaning that for an earth-sized planet (a diameter of 13,000Km) the maximum resolution if a chunk is 12 meters.
  • Realistic atmospheric scattering using rayleigh and mei scattering in the fragment shader. The sky is a sphere around the planet with a slightly larger radius. The scattering shader is applied to the sky and also the terrain to make distant terrain fade into the sky a bit.
  • Frustum and horizon culling to make objects that the player cannot see not get uploaded to the video memory and be rendered. Horizon culling stops objects that are behind the planets horizon from being rendered, and frustum culling stops objects that are outside of the players view frustum from being rendered.
  • Terrain generation using 3D simplex noise. I plan to make the noise 4D to allow for ridges, overhangs and other such structures that would be impossible with just a heightmap. The terrain colours are calculated per-vertex based on altitude. Vertices below an altitude of 0m will be blue for water, and above a certain height they are white for snow, etc. This is not a very realistic way of colouring the terrain. I plan to implement texture splatting so that the terrain chunks can actually have proper textures rather than vertex colours.
  • Logarithmic depth buffer to be able to handle the massive ranges of mesh sizes for an entire planet. When the player is far away from the planet, it is actually about 1 OpenGL unit accross, but as the player gets closer, the planet symultaneously moves further away from the player and gets larger, so that it has the same apparent size to the player. When it gets larger, some depth buffer precision issues start to happen, which a logarithmic buffer solves.

Images

Some screenshots of all of this in action. Planet from space High altitude atmospheric scattering Terrain mesh and LOD Frustum culling More tmospheric scattering Terrain generation Atmospheric scattering on terrain

Installing

To run this, you can either clone the entire repository and run the visual studio project files (which I haven't tested. This may not work propery), or you can run the executable in the VoxelRenderer (Runnable) folder. This will likely not run on older versions of OpenGL. This was made using OpenGL 4.0.

planet-renderer's People

Contributors

kelan0 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.