implementing a simple phong lighting shader, i’ve noticed a strange performance issue:
in my first shot, i’ve implemented the refection & view vector computation in the fragment shader getting the interpolated value of the light direction and view direction from vertex shader (using varying variable).
Then, thinking that deferring the maximum of the computation to vertex shader would have increased the perf, i moved the reflection part to the vertex shader and added a varying variable to interpolate the reflected vector from the vertex shader to the fragment one.
I then noticed a serious performance hit (-20%).
Does someone have some kind of explanation for this performance hit?
The only explainations i can expect is that adding varying variable is far from “free” or maybe i’ve reach the vertex shader limitation …
thx for any help