Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 793 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Questions, questions, questions.. #81902
07/17/06 13:21
07/17/06 13:21
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

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 Offline

Expert
mk_1  Offline

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


Follow me on twitter
Re: Questions, questions, questions.. [Re: Excessus] #81904
07/17/06 14:34
07/17/06 14:34
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
[quote1) 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.




you aint forced to do so, but if you like to use the same input or output more often you will find it usseful to do so.

Re: Questions, questions, questions.. [Re: ello] #81905
07/17/06 15:25
07/17/06 15:25
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

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.


Sphere Engine--the premier A6 graphics plugin.
Re: Questions, questions, questions.. [Re: Matt_Aufderheide] #81906
07/18/06 11:12
07/18/06 11:12
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Thanks alot guys.

I have some more questions:
7) How do I define where the pixelshader output gets written? For example if I want to render a depthmap from a lightsource position, I don't want the output to be written to the backbuffer(and appear onscreen) but rather be written to some bitmap/texture. I think this is called a render target, how do I set it?
8) I often see people complain about limitations of the 3dgs shader system, but it's not exactly clear what these are. I've heard people say you can't access a depthmap and that there are only 2 render targets. What exactly are the implications of this and what other limitations are there? This is especialy important information for converting shaders I find on the net or in books.

Re: Questions, questions, questions.. [Re: Excessus] #81907
07/18/06 13:51
07/18/06 13:51
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
You can certainly render a depth map (and I wrote that in the thread you're talking about).
afaik you need a render target for each light source you're using but I'm not sure about that since I don't own pro and haven't tried shadow mapping.


Follow me on twitter
Re: Questions, questions, questions.. [Re: mk_1] #81908
07/18/06 17:13
07/18/06 17:13
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
I think doing shadow mapping is not currently possible in Pro because of many factors, such as no floating point render targets, and so on. Certainly you could make a hack that could sort of work, but quality would be not good. Also there is littel chance you could do omni directional lights like in SPhere.

Basically not worth trying I think.


Sphere Engine--the premier A6 graphics plugin.

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1