These files features a complete software render pipeline from Triangulated Mesh to Fragments. Like the OpenGL software renderer, but without using any external libraries, and far less code. The renderer renders to a Matlab image, instead of the computer screen.
The render pipeline is written in c++ code, and supports, Phong shading, Color interpolation, Textures.
Also there is c++ code for calculation of Shadow Volumes, which can be used for self shadowing, and other real shadow effects.
The pipeline and all commandos are like in OpenGL, thus you can use the OpenGL documentation for things like your blending function and modelmatrix.
This is "version 0", thus there are only a few examples, only limited help available, and probably some bugs.
You need a c++ compiler to compile the code, before running the example. Compile code:
mex renderpatch.cpp -v
mex patchshadowvolume.cpp -v
mex patchnormals_double.c -v
Dirk-Jan Kroon (2020). Patch Software Render (https://www.mathworks.com/matlabcentral/fileexchange/27084-patch-software-render), MATLAB Central File Exchange. Retrieved .
When trying out this, to make it compile there were some changes that had to be made. The examples then looked good
In patchshadowvolume.cpp I had to:
Comment out/remove line 34 (// typedef long long int int64_t ;)
Change the line:
int Vout_ndims=2; int Vout_dims; Vout_dims=idn; Vout_dims=3;
mwSize Vout_ndims=2; mwSize Vout_dims; Vout_dims=idn; Vout_dims=3;
And in renderpatch.cpp I had to change the line:
double *Iin; const mwSize *Iin_dimsc; int Iin_dims; int Iin_ndims=0;
double *Iin; const mwSize *Iin_dimsc; mwSize Iin_dims; mwSize Iin_ndims=0;
Note, in this version is the following bug
Line 34 in renderpatch_shading.cpp:
Is a bug, must be:
Very impressive piece of code.
I have only one comment - I think depth check should be true by default