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
OpenGL ES 2.0: Point light optimisation
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement