• Create Account

### #ActualHodgman

Posted 03 June 2014 - 09:46 PM

That variable has been optimized out by the shader compiler, because it's not actually used. If the compiler realizes that a uniform isn't used, it's free to delete it.

If you trace your variable through your code, it looks like it's used - it looks like it should influence the result of your shader:

vec3  toEye =          normalize(camera_position...);
float specularFactor = pow(...toEye...), specularPower);
specularColour = ... * specularFactor;
totalLight += ...specularColour;
return totalLight;

Except that float specularPower = 0.0; so:

vec3  toEye =          normalize(camera_position...);
float specularFactor = pow(...toEye...), 0); // anything raised to the power of zero is 1
//So the above two lines get optimized to:
float specularFactor = 1; 

And thus camera_position isn't used, so, it's correct that you can't locate it.

### #2Hodgman

Posted 03 June 2014 - 09:46 PM

That variable has been optimized out by the shader compiler, because it's not actually used. If the compiler realizes that a uniform isn't used, it's free to delete it.

If you trace your variable through your code, it looks like it's used - it looks like it should influence the result of your shader:

vec3  toEye =          normalize(camera_position...);
float specularFactor = pow(...toEye...), specularPower);
specularColour = ... * specularFactor;
totalLight += ...specularColour;
return totalLight;

Except that float specularPower = 0.0; so:

vec3  toEye =          normalize(camera_position...);
float specularFactor = pow(...toEye...), 0); // anything raised to the power of zero is 1
//So the above two lines get optimized to:
float specularFactor = 1; 

And thus camera_position isn't used.

### #1Hodgman

Posted 03 June 2014 - 09:45 PM

That variable has been optimized out by the shader compiler, because it's not actually used. If the compiler realizes that a uniform isn't used, it's free to delete it.

If you trace your variable through your code, it looks like it's used - it looks like it should influence the result of your shader:

vec3  toEye =          normalize(camera_position...);
float specularFactor = pow(...toEye...), specularPower);
specularColour = ... * specularFactor;
totalLight += ...specularColour;
return totalLight;

Except that float specularPower = 0.0; so:

vec3  toEye =          normalize(camera_position...);
float specularFactor = pow(...toEye...), 0); // anything raised to the power of zero is 1
//So the above two lines get optimized to:
float specularFactor = 1;
specularColour = ... * specularFactor;
totalLight += ...specularColour;
return totalLight;

And thus camera_position isn't used.

PARTNERS