Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 16,005 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
A noob question.... #30410
07/14/04 09:11
07/14/04 09:11
Joined: Jun 2004
Posts: 175
S
Skinney Offline OP
Member
Skinney  Offline OP
Member
S

Joined: Jun 2004
Posts: 175
What exactely are shaders?

Sorry for the noob question...

Re: A noob question.... [Re: Skinney] #30411
07/14/04 09:20
07/14/04 09:20
Joined: Sep 2003
Posts: 2,174
Israel, Haifa
ROMAC Offline
Expert
ROMAC  Offline
Expert

Joined: Sep 2003
Posts: 2,174
Israel, Haifa
I asked for an exact definition in an earlier thread, never got a satisfying answer. I don't remember what I go, look up in shaders forum: Definition of a Shader.

Re: A noob question.... [Re: ROMAC] #30412
07/14/04 10:55
07/14/04 10:55
Joined: Feb 2003
Posts: 2,826
Margaritaville (Redneck Rivier...
myrlyn68 Offline
Senior Expert
myrlyn68  Offline
Senior Expert

Joined: Feb 2003
Posts: 2,826
Margaritaville (Redneck Rivier...
Effectively a shader is just a set of commands that go straight to the GPU.

They are more effecient than processing the data through the engine (the way things used to be), as engine code goes through the CPU and then gets handed off to the GPU after the CPU realizes it doesn't need to do anything to it.

Now a bit more detail...

You have two types of shaders - Pixel Shaders and Vertex Shaders. Each of these come in a bunch of different versions. Not only do you have the PS 1.1, 1.4, 2.0... but they also exist in different languages. DirectX 8.1 uses assembler to write shaders. OpenGL uses the Cg predominantly. DirectX 9 uses HLSL. Cg and HLSL are a lot easier to work with (IMO) but they all effectively do the same things.

For the Pixel Shaders you are manipulating the texture of a model (or level geometry...sprite...). Now this can do a lot of things from a simple make it red or blue task - to really complex tasks like per pixel lighting with a procedural texture and normal mapping. Simpler tasks can often be done with a pixel shader alone, but most of the fun stuff requires data passed from a vertex shader.

Vertex Shaders deal with the vertex data of models. Many times it just gets the vertex position and orientation and passes that info off to a pixel shader for processing (as is the case in per pixel lighting) - but you can also use a vertex shader to deform the mesh. Some examples of this are the wavy grass shader and some water shaders. Whenever you are using a vertex shader it over rides the fixed function vertex pipeline...so if you are using a fixed function effect in conjunction with a shader you will have to take this into account (only for that model...other models in the scene are unaffected).

Now some more info...

Shaders take time. No matter what you may have heard - they are expensive to run...it is not a silver bullet by any means. The more shaders you have on screen the slower they will be. For example if you have a fur shader on a dog, a water shader on the dog's water dish, a gloss shader on the dogs collar, per pixel lighting on everything, a glow shader on the light and bump maps on everything - the scene will quite likely render piss poor slow even on a top of the line system.

Shaders can only manipulate...not create. Vertex shaders can move vertices around the screen...but they can not create anymore than what were in the model to begin with. Pixel Shaders have a bit more capability in this region...but even they do not allow you to run square up on a wall without pixelation.


Virtual Worlds - Rebuilding the Universe one Pixel at a Time. Take a look - daily news and weekly content updates.
Re: A noob question.... [Re: myrlyn68] #30413
07/20/04 04:45
07/20/04 04:45
Joined: Aug 2002
Posts: 2,692
California, USA
bupaje Offline
Expert
bupaje  Offline
Expert

Joined: Aug 2002
Posts: 2,692
California, USA
Thanks for the explanation, I vote to add this to a FAQ on the 3DGS Wiki.

For the sake of completeness can you, or someone else, now give a similar explanation of materials and how they effect performance etc?

There has also been talk of doing stuff like bump mapping via 'fixed function' instead of shaders which I personally would like clarified.

Thanks.

Last edited by bupaje; 07/20/04 04:48.

Find me at: |Stormvisions| Twitter|
Re: A noob question.... [Re: bupaje] #30414
07/20/04 06:59
07/20/04 06:59
Joined: Jan 2004
Posts: 585
Alexandria, VA
Alkai Offline
Developer
Alkai  Offline
Developer

Joined: Jan 2004
Posts: 585
Alexandria, VA
Same here! Myrlyn68 is a storehouse of knowledge who explains nicely...


If you gaze long into an abyss, the abyss will gaze back into you. 3.0 GHz Pentium 4 w/HT 1 Gig 400mhz DDR SDRAM 128mb NVidia GeForce FX 5200

Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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