OpenGL ES 2.0: Point light optimisation

Started by
9 comments, last by marcClintDion 10 years, 10 months ago

You could also move these to the vertex shader so they are only being calculated once for every vertex instead of once every fragment. For low poly models which take up a lot of screen space this should be much more efficient.
//---------------------------------------------------------------------------------------------
vec3 toPointLight = vec3(u_LightPos);
float distance = length(toPointLight - v_Position);
vec3 lightVector = toPointLight - v_Position;
float diffuseDiff = 0.0; // The diffuse difference contributed from current light

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

This topic is closed to new replies.

Advertisement