Hi everyone,

So, I got my lightning system working: I calculate for each pixel its color value based on the lights sources in the scene, and if it is in a shadow or not. But my problem is: currently, I am doing eveything in the fragment shader, which runs once for each pixel, and I have heard that it is not the wisest solution to compute complex operation in the fragment shader. So my question is: is it better to calculate what can be calculated in the vertex shader, then pass it to the fragment shader through varyings, or rather calculate what I need in the Opengl app, and then give these inputs to the fragment shader that can calculate the final color of the fragment? Or maybe even another solution that I haven't thought about?

I have heard about lightmaps and stuff, but sadly I have absolutely no clue on how to implement these.

And fot those who are wondering, I an using SFML to communicate with these shaders, which makes that I can't use a GLSL version higher than 1.2 (and 1.2 is working well enough for me so far).

Thanks in advance for taking the time to answer me!