Git Product home page Git Product logo

sparse-voxel-octrees's Introduction

XYZRGB Dragon

Sparse Voxel Octrees

This project provides a multithreaded, CPU Sparse Voxel Octree implementation in C++, capable of raytracing large datasets in real-time, converting raw voxel files to octrees and converting mesh data (in form of PLY files) to voxel octrees.

The conversion routines are capable of handling datasets much larger than the working memory, allowing the creation and rendering of very large octrees (resolution 8192x8192x8192 and up).

This implementation closely follows the paper Efficient Sparse Voxel Octrees by Samuli Laine and Tero Karras.

The XYZRGB dragon belongs the the Stanford 3D Scanning Repository and is available from their homepage

Compilation

A recent compiler cupporting C++11, CMake 2.8 and SDL 1.2 are required to build.

To build on Linux, you can use the setup_builds.sh shell script to setup build and release configurations using CMake. After running setup_builds.sh, run make inside the newly created build/release/ folder. Alternatively, you can use the standard CMake CLI to configure the project.

To build on Windows, you will need Visual Studio 2013 or later. Before running CMake, make sure that

  • CMake is on the PATH environment variable. An easy check to verify that this is the case is to open CMD and type cmake, which should output the CMake CLI help.
  • You have Windows 64bit binaries of SDL 1.2. These are available here. Make sure to grab the SDL-devel-1.2.XX-VC.zip
  • The environment variable SDLDIR exists and is set to the path to the folder containing SDL1.2 (you will have to set it up manually). CMake will use this variable to find the SDL relevant files and configure MSVC to use them

After these prerequisites are setup, you can run setup_builds.bat to create the Visual Studio files. It will create a folder vstudio containing the sparse-voxel-octrees.sln solution.

Alternatively, you can also run CMake manually or setup the MSVC project yourself, without CMake. The sources don't require special build flags, so the latter is easily doable if you can't get CMake to work.

Usage

On startup, the program will load the sample octree and render it. Left mouse rotates the model, right mouse zooms. Escape quits the program.

Note that due to repository size considerations, the sample octree has poor resolution (256x256x256). You can generate larger octrees using the code, however. See Main.cpp:initScene for details.

Code

Main.cpp controls application setup, thread spawning and basic rendering (should move this into a different file instead at some point).

VoxelOctree.cpp provides routines for octree raymarching as well as generating, saving and loading octrees. It uses VoxelData.cpp, which robustly handles fast access to non-square, non-power-of-two voxel data not completely loaded in memory.

The VoxelData class can also pull voxel data directly from PlyLoader.cpp, generating data from triangle meshes on demand, instead of from file, which vastly improves conversion performance due to elimination of file I/O.

sparse-voxel-octrees's People

Contributors

bitxue avatar micahscopes avatar tmpvar avatar tunabrain avatar

Watchers

 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.