Skip to content

AshKetshup/MarchGL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


MarchGL

MarchGL

A IsoSurface renderer using Marching Cubes on Modern OpenGL

View Demo · Report Bug · Request Feature

About The Project

Torus

(back to top)

Built using:

(back to top)

Features:

  • GPU (Compute Shaders) and CPU mode;
  • Wireframe viewmode;
  • Reflection effect;
  • Refraction effect;
  • Tesselation Control & Evaluation Shaders;
  • Perlin Noise implemented noise(vec3 p);
  • Time as a variable iTime;
  • All Marching Cubes algorithm is inside "src/cubeMarch.cpp";
  • Compute shader is inside "res/shaders/computeShaderOriginal.cs";
  • Limitations:
    • When voxel size < 0.1 it may not work (memory allocation problems)

Usage

  1. Apply desired settings in the "Render Settings" window
  2. Introduce implicit formula in the "Implicit Functions" window, and then render
    • f.e Sphere formula: x*x + y*y + z*z - radius*radius (replace radius for desired value)

Sphere Torus with Tesselation on Wireframe view

Marching Cubes - Algorithm

Iso-Surfaces using Marching Cubes in Modern OpenGL

  • All 15 unique possible cases:

cubes1 cubes2

  • Black: vertices numbers
  • Red: edges numbers

Example

  • Case 1: (only vertice 0 is inside the shape)
    • Decimal
      • Vertice: 0
      • Edges: 048 (lookup in first table)
    • Binary
      • Vertice: 0000 0001
      • Edges: 0000 0000 1100
      1. Calculate the points of each edge (Linear Interpolation)
        • Formula: (1-t) * p1 + t * p2, t = -D1/(D2-D1); D -> density on the point
      2. Add those vertices to a list
      3. "Organize" the vertices, in a way that the correct triangles are drawn (lookup third table, using the vertice binary)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the GNU General Public License v3.0. See LICENSE.txt for more information.

(back to top)

Contact

Diogo Simões - dsimoes2000@gmail.com Nuno Monteiro - (...) Manuel Santos - (...)

Project Link: https://github.com/AshKetshup/MarchGL

(back to top)

(back to top)