@skyblond vars specified per vertex are linearly interpolated per fragment.
You should also check your normals and see if you are correctly transforming them.
@skyblond I'm not sure if I'm correctly following you, but if I had to pass anything to the fragment shader, I would pass mainly variables that can be interpolated that way, like the x, y coordinates and then compute theta and cos(theta) in the fragment shader.
@aluaces
That's a good idea, recovering theta from coordinates. At first I was worrying about the performance drop if I put all calculation in vertex shader, as what I know about CPU pipeline, each stage should use same time to do there work for the best performance, I guess the GPU pipeline also works that way too.
@skyblond you are right, but you are still way before hitting hardware limits, so you can afford to perform precise computations. Only if you are hard pressed you could resort to approximations and tricks as precomputing those values you need into textures.
@aluaces I see, it looks like if I'm passing theta from vertex shader, the theta value will be linearly interpolated and thus each fragment will have a theta not that correct. If I calculate cos(theta) before that interpolation, then pass it to fragment shader, the red color it self will be linearly interpolated, thus it looks way better.
I change red to theta/2pi, to show me how the theta value is interpolated though the circle, and it seems I need the first point to be (0,0) to make the center of circle properly positioned.