I want to understand how three.js works internally. One thing I don't understand is how three.js compiles and runs shader programs. If I were to reimplement three.js myself I would have a vertex shader attributed to a Geometry and a fragment shader attributed to a Material and then generate a shader program when they are combined in Mesh. But looking at the geometries and the materials they don't seem to reference any shader. Furthermore, the shaders (in the folder three.js/src/renderers/shaders/) in the project don't seem to be attributed to any specific Geometry/Material. I was wondering whether someone could shed light on how the three.js compiles and runs shaders.