I am new to shaders. I am going through some tutorials online. There is this tutorial about Toon Shaders:
Now, it says:
In this section we will do the toon shader effect per fragment. In order to do that, we need to have access to the fragments normal per fragment. Hence the vertex shader only needs to write the normal into a varying variable, so that the fragment shader has access to the interpolated normal.
What I am confused is, we specify normals per vertex. But how can we get access to normals at fragments? Is there some interpolation done internally?
Could anyone please clarify this for me?
Do you know how varying variables “work”?
Those tutorials you are talking about are pretty ancient, but still one of the best on the net. Antonio Ramires Fernandes did a great thing, and I’m glad he is back again.
Your problem is that you didn’t read the tutorial from the start.
So, get back to the beginning and patiently read everything.
I just have to add that interpolation is presented only if interpolation qualifier is not flat. The default value is smooth which stands for perspective correct interpolation.
Also be aware that GLSL after ver. 1.30 doesn’t use varying variables. Now they are in/out.
Thanks Aleksandar, i will read it from the beginning.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.