Hi, I am very new to GLSL and have been experimenting with various shaders, testing code etc for the last week or so.
I have been attempting to implement normal mapping that has driven me a bit loopy for the last coupel of days.
I have been looking through dozens of online tutorials etc, for shaders just for standard per-pixel lighting and ofcourse now Normal mapping - I have perhaps jumped in one step to many… tutorials that just talk about shader code in the shader, not what has to be arranged for the shader for it to work(atleast in this case).
I read tutorials that specify
attribute normal; attribute binormal;
This is what I want to have confirmed…
It was my assumption(stupid?) that these are calculated for me to use (in this case to create a TBN matrix), I thought I was just telling the shader I wanted to have them made available.
I have been setting some uniforms in my shaders(getting location, then passing data etc)… Am i right in thinking that if I want to do a normal map shader I will have to compute the tangents myself, then pass them to the shaders attibute location?
With binormals I could do this the same way, or in the vert shader I could do with a cross(norm, tang) - is this better since GPU excels at vector math?
It did always bother me(well for a couple of days) why the normal had a predefined name, gl_Normal, and the others had no similar prefix, but I was letting tutorials lead me by the hand before so I did with this - not making that contection that it could be similar to when I specificy my uniforms.
I ask this here because I just stumbled across a few references and it made me think, I am about to go to bed - and I am hoping someone can say yay or nay so when I get up in the morning and look over this(normal map) some more I may gain back some of my sanity