GithubHelp home page GithubHelp logo

alberthuang96 / sparsevoxeloctree-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from otaku690/sparsevoxeloctree

0.0 1.0 0.0 125.85 MB

Sparse Voxel Octree Implementation - Upenn CIS-565 final project

License: MIT License

JavaScript 0.06% C++ 62.75% C 36.11% CSS 1.08%

sparsevoxeloctree-1's Introduction

SparseVoxelOctree

Sparse Voxel Octree Implementation - Upenn CIS-565 final project

Current Progress

  • SVO construction is completed.
  • Might need two more overnighters to do the Voxel Cone Tracing part.

Voxelized scene

Alpha presentation at UPenn CIS-565:

Final presentation at UPenn CIS-565:

Paper in JCGT format:

Scene Voxelization using GPU rasterization

  • Use the method described in Ch. 22 of OpenGL Insight.
  • Each triangle is orthographically projected, in geometry shader, along the dominant axis of its plane normal vector.
  • In the framebuffer we will get something like this:

projection

  • The whole scene can be voxelized in one single draw call.
  • In fragment shader, the geometry data is stored into a 3D texture, using GL_EXT_shader_image_load_store extension introduced in OpengGL 4.2.
  • Voxelized Geometry:

voxeledCow

  • Conservative Rasterization
    • While the hardware rasterization method is fast, it produces holes or cracks on voxelized thin surfaces. The following image shows an exmaple:

naive rasterization

The flagpoles are not fully voxelized. This scenario occurs because naive rasterization won't generate fragments in pixel locations where pixel center is not covered by primitives.
To mitigate this problem, this implementaiton uses a conservative rasterizaton method from Hertel et al.
Simply put, the triangles are enlarged in clip space in geometry shader to ensure every pixel location covered by the triangles has fragment generated.
The following is the result of the conservative rasterization:
conservative rasterization
Now the flagpoles are fully voxelized.

Sparse Voxel Octree (SVO) Construction

There are several methods available for constructing a SVO. This implementation uses the one described in Ch. 22 of OpenGL Insight, with minor modification.
Several steps are needed for this SVO construction method:

  • Build a voxel fragment list.
  • Build the SVO, level by level, using the voxel fragment list.
  • In each octree level:
  • tag nodes that need further division.
  • Allocate buffer spaces for next level.
  • Initialize the allocated buffer space.
  • After the octree structure is built. Inject the voxel atrributes (albedo, normal, etc.) into the leaf nodes, and average the values if multiple voxel fragments fall into the same leaf node.
  • Level by level, from bottom to top, mipmapping the node values into the interior nodes. The above steps are performed using compute shaders. The following image shows a voxelized Crytek Sponza model with color shown:
    Voxelized scene

Voxel Cone Tracing

  • Still working on it...

Performance Evaluation

  • One of the goal of SVO is to reduce memory consumption, here is a comparison of number of voxel nodes required in various data structure:

chart

References:

  • Cyril Crassin and Simon Green. “Octree-based Sparse Voxelization Using the GPU Hardware Rasterizer.” OpenGL Insights, pp. 303-319.
  • Cyril Crassin, Fabrice Neyret, Miguel Sainz, Simon Green, and Elmar Eisemann. “Interactive indirect illumination using voxel cone tracing.” Pacific Graphics 2011.
  • Stefan Hertel, Kai Hormann, and Rudiger Westermann. A hybrid gpu rendering pipline for alias-free hard shadows. In Proceedings of Eurographics 2009 Area, 2009

sparsevoxeloctree-1's People

Contributors

otaku690 avatar

Watchers

James Cloos 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.