Posted By: Excessus
Questions, questions, questions.. - 07/17/06 13:21
Hello,
I have recently started learning about writing shaders and while I must say it's not as hard as it looks at first I have come across a few things I can't find an answer to. I'd really apreciate it if you guys could answer any or all of these questions.
1) Why do I (sometimes) have to initialise an output struct like VS_OUT Out = (VS_OUT)0;? (I guess this is not HLSL specific but I'd still like to know.
2) When I convert a vertex position to clipspace (SomeFloat4 = mul(InPos, matWorldViewProj)), what is in SomeFloat4.z and SomeFloat4.w?
3) How can a vertex have a normal? Is it that:
-each vertice is rendered multiple times, once for each triangle it is part of. It then gets the normal of the triangle that is currently being rendered.
-the vertex normals are just interpolated normals between all triangles that are connected to that vertex.
4) Can it be beneficial to include a technique that compiles a shader at 2_0 even if the exact same shader can be compiled at 1_1? Ofcourse I would also include a technique that compiles it at 1_1, but is a shader compiled at 2_0 faster for 2_0 cards?
5) Is it possible to imlement a shadowmapping shader without using a plugin? (If not, why not?)
6) Is it possible to implement a bloom shader without using a plugin? (If not, why not?)
I have recently started learning about writing shaders and while I must say it's not as hard as it looks at first I have come across a few things I can't find an answer to. I'd really apreciate it if you guys could answer any or all of these questions.
1) Why do I (sometimes) have to initialise an output struct like VS_OUT Out = (VS_OUT)0;? (I guess this is not HLSL specific but I'd still like to know.
2) When I convert a vertex position to clipspace (SomeFloat4 = mul(InPos, matWorldViewProj)), what is in SomeFloat4.z and SomeFloat4.w?
3) How can a vertex have a normal? Is it that:
-each vertice is rendered multiple times, once for each triangle it is part of. It then gets the normal of the triangle that is currently being rendered.
-the vertex normals are just interpolated normals between all triangles that are connected to that vertex.
4) Can it be beneficial to include a technique that compiles a shader at 2_0 even if the exact same shader can be compiled at 1_1? Ofcourse I would also include a technique that compiles it at 1_1, but is a shader compiled at 2_0 faster for 2_0 cards?
5) Is it possible to imlement a shadowmapping shader without using a plugin? (If not, why not?)
6) Is it possible to implement a bloom shader without using a plugin? (If not, why not?)