Coder Social home page Coder Social logo

vercidium / voxel-mesh-generation Goto Github PK

View Code? Open in Web Editor NEW
104.0 5.0 11.0 17 KB

Optimised voxel mesh generation, written in C# and open sourced from the Vercidium Engine.

Home Page: https://sectorsedge.com

License: Apache License 2.0

C# 90.47% GLSL 9.53%

voxel-mesh-generation's Introduction

This Repository Is Outdated

The new repository is available here, which features faster greedy meshing and a standalone renderer.




voxel-mesh-generation

Optimised voxel mesh generation, written in C# and open sourced from the game Sector's Edge.

Overview

This repository contains C# code for mesh generation on the CPU, setting up VBO and VAOs for OpenGL rendering, as well as fragment and vertex shaders.

The explanation and visualisation of this mesh generation technique can be found in this blog post. Further optimisation details can be found in this blog post.

Mesh generation and VBO buffering is kept separate so that multiple chunks can be initialised on different threads.

Details

  • Chunks are composed of 32x32x32 blocks
  • Faces are generated by combining faces in runs along the X and Y axis.
  • This algorithm produces ~20% more triangles than greedy meshing and runs ~390% faster
  • Block position, texture ID, health and normal are packed into 4 bytes for faster buffering and rendering on the GPU.

Benchmarks

Benchmarks were run with a Ryzen 5 1600 CPU

  • ST = Single Threaded Time
  • MTT = Multithreaded Time - 12 threads each initialising 1/12th of the map
  • CMGT = Chunk Mesh Generation Time
Map Name Chunk Count Total STT (ms) Total MTT (ms) Average CMGT (ms)
Crashed Freighter 799 421 110 0.527
Soltrium Temple 648 280 73 0.432
Aegis Desert 441 201 51 0.456
Magma Chamber 293 157 38 0.535
Arena 108 30 12 0.278

In Practice

With 16 players per match, multiple chunk meshes must be regenerated every frame. This process has been optimised to ensure the game can be played smoothly on older hardware.

Soltrium Temple Screenshot

voxel-mesh-generation's People

Contributors

vercidium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

voxel-mesh-generation's Issues

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.