Rendering 3D B-splines using OpenGL, Qt, C++ and Eigen.
B-splines are parameterics curves which consists of several Bezier curves whose control points satisfy some special conditions.
I used cubic Bezier curves for the interpolation of knots.
Given a set of knots, a cubic Bezier is generated between each knot. Then these Bezier curves are glued together and forming the final curve, B-spline.
The algorithm for the generation of the curves can be found here. Although it is about 2D B-splines, interpolating 3D B-splines is not so different.
I implemented the algorithm in CreateCoefficientMatrix
, GetSplineControlPoints
and Update
methods of Spline
class.
For the rendering algorithm, this resource helped me a lot. The vertex generation algorithm can be found in PipeDumb.geom
shader or in GenerateVertices
method of Bezier
class.
- Install
CMake 3.25.1
or latest. - Install
Visual Studio 2019
andMSVC C++ Compiler
. - Install
Qt 6.x.x MSVC2019 64bit
kit. - Define environment variable
Qt6_DIR
asC:\Qt\6.x.x\msvc2019_64
. - Clone the repo
git clone https://github.com/berkbavas/BSplineCurves3D.git
. - Create a folder
mkdir Build
. - Enter the folder
cd Build
. - Run CMake
cmake ..
. - Open
BSplineCurves3D.sln
withVisual Studio 2019
. - Build & Run with
Release
configuration.
C++, Qt 6, OpenGL, GLSL, Curves, Bezier Curves, 3D B-Splines, Eigen, 3D Rendering