This is the OpenGL version of my 3D renderer.
In essence, it is a straightforward implementation of the core principles of "polygon related" graphics theory. The source code includes:
Unlike the corresponding pure-software implementation, these sources use OpenGL to do the rendering. In fact, they use fragment shaders and Vertex Buffer Objects (VBO) to perform all the graphics calculations in hardware (if supported by your card). A 70$ graphics card (an ATI 4670) provides around 100 million phong shaded triangles per second with this renderer.
Download, compile and runThe Source code is available under the GPL. Win32 binaries are also available (compiled with MinGW).
Compilation follows the well known procedure...
bash$ ./configure bash$ makeAfter a successful make, you can then watch the packaged 3D objects:
bash$ cd 3D-objects bash$ ../src/renderer/renderer statue.plyTo navigate...
Creating more 3D objects on your own
Phong shadingNotice that the Phong shading mode is real phong shading, done through the vertex and fragment shaders. The vertexes' normal vectors are interpolated per-pixel, and the complete lighting equation is then evaluated. To improve the areas not touched by the light source (the ambient ones), the shaders also interpolate the per-vertex ambient occlusion factor that shadevis generates, thus creating radiosity-look-alike renderings.
Since my renderer uses shaders and vertex buffer objects, rendering speed is amazing: my Radeon 4670 draws a huge object I have (1.6 million triangles) at 86 frames per second, for an unbelievable 134 million phong-shaded triangles per second!
And just look at the difference between gouraud and phong shading...
Phong shading creates much better pictures than Gouraud; especially
at low tessellations.
Notice how the fragment shader creates Phong higlights, and also how it
interpolates the vertex ambient occlusion factor per-pixel.
|Index CV||Updated: Sat Oct 8 12:33:59 2022|