The view position is simply the world position of the view setup, so taking the view position - world position will give you the vector that points from the world, to the view... You can get the view position from a matrix. You can get it by taking the fourth row of the inverse view matrix. So to finally get your…
thx Drew++ for your explanation :) During my work on that specular lighting I've found a bug in my shader, whenever I put a light between my models the outer one will be lit like the inner one? I think a picture describes this better: and my lambert shader:////////////////////////////////////////////////////////////////…
This 'simply' has to do with the matrix order. The majority of engines use "Column Major" Packing/Ordering by default. If they don't it could be a programmers mistake or preference, or compiler... It's like this in HLSL and GLSL. This means you would do mul(Vector, Matrix); or in GLSL (Vector * Matrix) For Maya it would be…
Sorry, I can't help with your question dnc, hopefully one of the others will be able to. I have started following the Eat3D CGFX tutorial DVD and have finally got around to making my fist shader! I have created it in notepad++ C# sytax highlighting seemed to be the best. Unless anyone else has any better suggestions? I…
I've now added normalmap,glossmap-support and light attenuation to my shader, and fixed some errors. Its still not the prettiest, but I think I've learned enough to move further. I can post my shader here, if anyone is interested ? I'm now learning cubemaps and how to use them for reflection/refractions. And I'm stuck…
LoL this makes me mad. I dont know if it is this hlsl compiler or max but it is crazy. I've put my code into some fancy functions like Xoliul did, to get a better overview. But instead working like before as I would expect it, it does not I've got no compile errors or anything else, but my specular calculation doesn't work…
Thanks for the detailed response, again :) I have a much better idea of where shaders are fitting into the overall pipeline. Also good to know of the scope that I will be learning. That is a great list of shaders to try and create too, I shall definitely be using something along those lines for "further learning" (once I…
I just tried changing the byte notation to 0x003 and the shader seems to mess up. If it is 0x002 then it just displays the sphere with a solid colour, but here is what happens with 0x003 it also seems to be a kind of plane as you can rotate it and move it about. Any ideas why this is happening? I also completed the next…
Hey all, trying to get Spec and gloss working now. I have my gloss in the aplpha of my spec channel. They look like this: But it seems that my specular is always getting blown out. Here it is with the gloss spinner at 100: And here it is at 0: Here is my code: string ParamID = "0x003";float4x4 wvp : WORLDVIEWPROJ < string…
Well, I just carried on plugging away and I have managed to get the spec working correctly, looks pretty much identical to XoliulShader (my benchmark to see if things are working correctly :p) I was multiplying and powering by the wrong things, I was trying to figure it out just form the Xoliul source, but it is a bit hard…