A IsoSurface renderer using Marching Cubes on Modern OpenGL
View Demo
·
Report Bug
·
Request Feature
- 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)
- Apply desired settings in the "Render Settings" window
- 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)
Iso-Surfaces using Marching Cubes in Modern OpenGL
- All 15 unique possible cases:
- Black: vertices numbers
- Red: edges numbers
- 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
- Calculate the points of each edge (Linear Interpolation)
- Formula: (1-t) * p1 + t * p2, t = -D1/(D2-D1); D -> density on the point
- Add those vertices to a list
- "Organize" the vertices, in a way that the correct triangles are drawn (lookup third table, using the vertice binary)
- Decimal
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU General Public License v3.0. See LICENSE.txt
for more information.
Diogo Simões - dsimoes2000@gmail.com Nuno Monteiro - (...) Manuel Santos - (...)
Project Link: https://github.com/AshKetshup/MarchGL