Cross platform program for visualizing 3D graphs, both using math and programing. The rendering of the voxels is fully done on gpu, per pixel. This gives results as close to perfect as float point will allow.
- Compile and render custom graphs on the GPU during runtime
- Save and load custom graphs
- Diferent types of voxels that you can create
- Custom display function for the voxels
- Make screenshots of your current rendered frame and save it to a .bpm file
- C++ is used as a main language
- GLFW is used as a cross platform window manager
- OpenGL is used as a rendering library
- Glad is used as a loader for OpenGL
- GLSL is used as a shader language and as a language for functions
- GLM is used as a math library
- ImGui is used as a GUI libary
- mINI is used as a .ini file reading library
- stb_image is used as a image loading library (part of stb library)
All voxel and function calculations are done directly on GPU via raycasting.
For every pixel on a custom texture, ray is sent and function is computed for every voxel ray goes through.
If blockFunction in shader returns non 0 value for curent voxel, pixel is colored according to displayFunction else ray continues.
If ray length exceeds maxRayLength, pixel is colored white.
Then resulting texture is rendered to the window framebuffer.
The size of the rendered texture and the window framebuffer may or may not be the same.
This gives us ability to send less rays for worse quality and better performance.
"Interpolation" can be used during this step.
data folder contains icons, default saves, and shaders.
saves folder contains yours and example saves.
screenshots folder contains screenshots you made.
For building you will need a C++ compiler, make, cmake, OpenGL headers.
Run these commands:
cmake -S . -B build
cmake --build buildResult will be in dest folder alongside with .zip file.
Windows:
- Help window
- Info window
- Parameters window
- Functions window
Tools:
- Screenshot
W - move forward
S - move backward
D - move right
A - move left
E - move up
Q - move down
Shift - 5 times slower
Control - 5 times faster
Alt+Z - open help window Alt+X - open info window Alt+C - open parameters window Alt+V - open functions window F2 - take screenshot
Variables that you create can be used in blockFunction and displayFuction. When you create a variable you will have to put a valid name (id rules), step, min value, max value.
!If you create 2 variables that while in lower case are the same, saving and loading will be an undefined behaviour.
blockFunction and displayFunction are essentialy just GLSH code. For using the program right, follow rules that tell what constants, variables, and functions you are allowed to use.
Basics:
- GLSL syntax
- you can use any standard GLSL math function
Used to check if voxel is solid or not and get the type of voxel.
Function signature:
int blockFunction(args...) {
@b // @b is replaced with your code
}If 0 is returned ray calculation continues. Otherwise the displayFunction is called and calculation is ended. This value then is put into displayFunction as an argument.
Consts you can use:
float epsilon- 1e-9float pi- to the tenth digitfloat e- to the tenth digitfloat phi- to the tenth digit
Vars you can use:
ivec3 coords- voxel coordsfloat x- short for coords.xfloat y- short for coords.yfloat z- short for coords.zivec3 rayDirSign- sign of every direction value, only 1 or -1float t- time from the start of the program in seconds
Funcs you can use:
void stop()- stops calculating ray after this voxelbool approx(float a, float b, float c)- returnstrueif difference betweenaandbis smaller or equal toc
Used to determine the color of the pixel after the voxel is determined to be solid by blockFunction.
Function signature:
vec4 displayFunction(args...) {
@d // @d is replaced with your code
}The returned color will be applied to the pixel whose ray we just calculated.
Consts you can use:
float epsilon- 1e-9float pi- to the tenth digitfloat e- to the tenth digitfloat phi- to the tenth digit
Vars you can use:
ivec3 coords- voxel coordsfloat x- short for coords.xfloat y- short for coords.yfloat z- short for coords.zfloat dist- distance from the ray origin to the endint lastCoord- last axis that was crossed to get to this voxel. 0 - none, inside a voxel. 1 - ox. 2 - oy. 3 - oz.int blockValue- return value ofblockFunctionfloat t- time from the start of the program in seconds
Funcs you can use:
bool approx(float a, float b, float c)- returnstrueif difference betweenaandbis smaller or equal toc
The license for this project is in LICENSE file. It is a modified MIT license.
The extern folder contains libraries that have their own licenses. This project's license is not applied to extern folder.
Creator:
GitHub: UAPROGRAMER
Email: stasyatskiu2008@gmail.com


