Jesse-V / iVoxely

Voxel-based game in C++11 and OpenGL
8 stars 0 forks source link

Support for multiple lights #9

Closed Jesse-V closed 11 years ago

Jesse-V commented 11 years ago

A Scene should support multiple lights, which can each be controlled independently.

Jesse-V commented 11 years ago

A Scene should also be able to not have any lights.

Jesse-V commented 11 years ago

A number of things are required here, all of which I need to puzzle out how to solve in an organized fashion. 1) Tell each light how many lights there are, and what it's light identification is so that it knows what to sync with in the GLSL array of Light structs. 2) Generate GLSL code that does the necessary projection calculations for each light's position. 3) When assembling the shader, avoid declaring the lighting methods multiple times. 4) Blend all the lights into a final color. 5) Figure out the specular or diffuse lighting not in the Light class, but based on the reflective properties of the RenderableObject. 6) Should the spread of a light be restricted such that it cuts off at a certain distance? If that is the case, maybe RenderableObjects outside this radius shouldn't know about this light. This should be done GPU-side, between the vertex and fragment shader.

Jesse-V commented 11 years ago

I need to figure out #12 before I tackle this. I need to know what data needs to be organized and sent around before I add loop structures and whatnot.