Phong Lighting Shader Code

Hey, all!
It’s been some time since I’ve really been on the forums and in that time, I’ve been learning how to make my own Phong lighting. Below is a gist to the project code:

The code includes a 3D scene lit by a Phong lighting shader with 1 point light, and several functions that can be useful for adding vertices, normals and texture coordinates to meshes; such functions include: addCube, addEllipse & addCylinder. Change the variable useShader to false to compare the difference that the shader makes. All of the code is available for anyone to use in their own projects. Enjoy!

Photos are attached.

Very nice! How satisfying is it to write lighting shaders from scratch

It’s very satisfying. You learn a lot from it. Here’s my advice to anyone who understands 3D but wants Craft to do all the work: It may be easier to use Craft, but you learn a lot from making your own lighting. Start easy and use Ignatz’s ebook. Ignatz makes it really easy to understand.