Shadows in WebGL
I have followed the learningwebgl tutorials and have gone over them many times trying different things.
- I have learnt about dot products (angle between 2 vectors)[/*:m:2dzmvpoo]
- I have learnt about a vector being a direction and magnitude(length of a vector)[/*:m:2dzmvpoo]
- I have learnt about what a normal is (perpendicular vector to a plane (and in this case, the center of 3 vertices? right?)[/*:m:2dzmvpoo]
- I have learnt about multiplying colours together to get a mix of colours that represent shading.[/*:m:2dzmvpoo]
- I have learnt that you can get the distance (magnitude) of a vector by doing what is pretty much pythagoras across x,y and z rather than just aČ + bČ.[/*:m:2dzmvpoo]
I have come across a fundamental lack of understanding now and it's time to clear it up so I can progress.
Here is a few questions to start this thread going:
- A vertex shader does linear interpolation between 3 points to find out all the pixels/points within that plane. The fragment shader processes each of those points which allows us to apply colours to it?[/*:m:2dzmvpoo]
- I noticed that in the shader files, there is void main() for each one. Can i then assume that these are completely different apart from whatever is declared within the vertex shader is eventually passed through into the fragment shader. [/*:m:2dzmvpoo]
- From the vertex shader, you are given a triangulated plane (3 vertices) in which you can do some math to... within the shader... to identify which points in the fragment shader need to be multipled with a 50% opaque black in order to cast a sexy shadow?[/*:m:2dzmvpoo]
I really do appreciate any help given. Although not utterly stuck, I find clarification the key to confident progression.
Thanks in advance!