/giulia

A GPU accelerated Julia Set fractal interactive viewer implemented in C++ that supports rendering through OpenGL or OpenCL.

Primary LanguageC++

Giulia

A GPU accelerated Julia Set fractal interactive viewer implemented in C++ that supports rendering through OpenGL or OpenCL. Giulia also features a Mandelbrot renderer.

Check out these sources if you wish to learn about the Julia Sets, fractals and their relation to the Mandelbrot Set:

This project features

  • Julia and Mandelbrot renderings
  • Real-time Rendering
  • Dynamic parameters
    • Panning & Zooming
    • Single or Double precision
    • Number of calculations per pixel
    • Compute mode (OpenGL or OpenCL)
  • Imgui based GUI
  • C++14 standard
  • CMake based
  • OpenGL & OpenCL Interoperation

Special Thanks

The Cherno for his awesome Youtube Channel and OpenGL tutorials.

How to use it

The Jiulia Set is defined according to the following equation:

{\displaystyle f(z)=z^{n}+c}

Giulia lets you tweak both n and c and see the result in real-time.

Move the red cursor on the Mandelbrot Set to choose a value of c.

Hold SPACEBAR + click + drag to pan around. Use the scroll-wheel to zoom in and out.

Use the Slider to adjust the number of iterations on each pixel. This impacts performance.

Use the Slider to change color presets. OpenGL only.

Use the check boxes to change rendering modes. There are no visual differences but trust me, under the hood this is completely different.

Use the check boxes to switch precision modes. Only needed if you zoom in enough. This has absurd impact on performance. OpenGL only.

Use the check boxes to toggle Full screen mode. OpenGL only.

Use the Slider to change the value of z

Dependencies

Tested build environments:

  • Ubuntu 20.04
  • Ubuntu 20.10
# Install OpenGL related dependencies
sudo apt install mesa-utils freeglut3-dev libglew-dev libglfw3-dev

# Install OpenCL related dependencies
sudo apt install opencl-headers ocl-icd-opencl-dev

Build

# Fetch
git clone https://github.com/bernardocrodrigues/giulia.git giulia && cd giulia

# Configure
mkdir build && cd build
cmake ../ 

# Build
make

Run

./src/app/Giulia

Future work

  • Create a static target for releases
    • There's no standalone bin being produced so the app can be easily distributed on-line. You'll have to install all build dependencies and build it locally to run Giulia
  • Implement CI
  • Print the value of c used in the Julia rendering
  • Improve way bin reads OpenGL & OpenCL kernels
    • Maybe put them as static strings on a header?
  • Implement remaining OpenCL features
    • Double precision
    • Color schemes
    • Full screen Viewing
  • Intelligent frame drawing
    • Only draw a new frame if something has changed; there's no point in redraw the same frames over and over
  • Low Resolution rendering
    • This could be used to improve panning on compute costly regions, especially when using double precision.
  • Support for variable screen size