1 registered members (7th_zorro),
793
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Questions, questions, questions..
#81902
07/17/06 13:21
07/17/06 13:21
|
Joined: Jan 2004
Posts: 2,013 The Netherlands
Excessus
OP
Expert
|
OP
Expert
Joined: Jan 2004
Posts: 2,013
The Netherlands
|
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?)
|
|
|
Re: Questions, questions, questions..
[Re: Excessus]
#81903
07/17/06 14:17
07/17/06 14:17
|
Joined: Dec 2000
Posts: 4,608
mk_1
Expert
|
Expert
Joined: Dec 2000
Posts: 4,608
|
1) dunno, never used a structure 2) z is depth in clipspace. You can use the z value to render a depth map for example. 3) Normal is interpolated if you use soft edges (smooth) and the triangle's normal if use hard edges (flat mode). Hopefully the mdl format will support that soon. 4) Don't think so but I don't know it. 5) I think it's possible with pro. You need to render a depth map from the lightsource and then use render to texture to use it on your screen. 6) again you need pro 5/6 buy Sphere
|
|
|
Re: Questions, questions, questions..
[Re: ello]
#81905
07/17/06 15:25
07/17/06 15:25
|
Joined: Oct 2003
Posts: 4,131
Matt_Aufderheide
Expert
|
Expert
Joined: Oct 2003
Posts: 4,131
|
Quote:
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?
No. The rule of thumb is, always use the lowest version that works.. however, most modern cards perform well on 2.0 so its really not a problem (GeForce FX cards were terrible at 2.0, but if you dont care about them...)
Quote:
How can a vertex have a normal?
How can it not? Triangles dont really exist in direct 3d, only vertices. That is, there is no real polygon normal.. only the vertex normal, and the polygon that is eventually drawn has the normal interpolated fomr each vertex.
Think of a vertex as a vector, not a point.
|
|
|
|