Archived

This topic is now archived and is closed to further replies.

This topic is 5112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there anyone here that could explain shaders to me, i recently watched Half Life 2''s source engine video and they used shaders the same as those used in Toy Story , What effects would my shaders do to my game? and what shaders are out there? Engage

Share this post


Link to post
Share on other sites
Shaders can actually mean two things. For instance, in Half-Life 2, they most likely use a shader language they (Valve) developed, which allows you to set the properties of a surface, such as which textures you want to be displayed on there, which bumpmap to use, which glossmap to use, what special effects to perform, etc. However, Half-Life 2 then uses a lower-level shader language to implement the special effects, which might be bumpmapping, glossmapping or whatever other per-pixel effect is required. In that case, the shader language is HLSL, also know as Cg (developed jointly for DirectX and OpenGL by Microsoft and NVIDIA).

Cg was actually developed as a real-time equivalent to the offline shader language used by RenderMan, the software developed by Pixar to create Toy Story and all their other films. That''s why HL2 looks so impressive...


Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can''t stand 1 bit of competition.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks, what shaders would you reccommend on using for an RTS game?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think you''re still not clear on what shaders are. As iNsAn1tY explained the word itself can have more than one meaning - material shaders or.. well.. shaders, as in vertex and pixel shaders. I believe what you are referring to is the last.

A vertex shader is a small piece of code that you, the application programmer, writes which is then executed once per vertex instead of the fixed function vertex processing. Similarly, pixel shaders are small programs that are executed once per pixel instead of the fixed function pixel processing.

In themselves there are nothing fancy about shaders... they don''t have to be used for special effects or any particular set of graphics effects. You cannot always see if a shader is used or not because their output can be identical to that of the fixed function pipeline. In fact the newer ATI cards (Radeon 9700 for example) chose to emulate the fixed function pipeline with shaders.. so on those cards you are *always* running shaders!


Therefore your question about which shaders to use for a RTS game doesn''t make any sense! It''s the same as asking: I''m making a RPG, what algorithms should I put in my C++ code?

Clearly noone can answer that for you since it depends on the game!

Same thing for shaders.. instead of looking for particular shaders to use you must first ask yourself: What graphical effects do I want/need for my RTS.
Then, once this is decided, you''ll ask yourself: How can do those effects? Should I use shaders or can I use the fixed function pipeline.

- Kasper Fauerby

Share this post


Link to post
Share on other sites
The term ''shader'' is unfortunate and often leads to confusion.

The standard for photorealistic rendering has been Renderman, and they use shaders as a software solution. Those are scripts that calculate each pixels color when doing raytracing.

Quake 3 uses the term ''shader'' for an ascii property or script for a surface (which they call a face). Quake 1 and 2 specified the texture name in the map after each face, in Q3 a shader can blend more textures, animate the texture, etc. But this is more a texture property. It also adds properties like solid/nonsolid and visible/invisible for the game to use.

Finally DX8 uses ''shader'' for two different things. In traditional 3D you specify a bunch of triangles. They first get transformed to 2D space, then filled with pixels in 2D. For older cards this is software, the Geforce 1 and up can do this in hardware, then the two steps are called Transform & Lighting, or T&L.

Later cards (GF3 and ATI Radeon 8500) made these two processes programmable using assembly in GPU instructions. The process is more flexible, the vertex process gets a vertex as input and some constants, but it can interpret it as it likes, eg. changing x/y/z dynamically. This allows for animation.

Then the painter process (pixel shader) gets called for each pixel, but it can get its information from somewhere else. This way you can get all kinds of nice effects.

Just understand that the naming of these things is often fucked up, especially when quake is involved. These things have nothing to do with shade or shading, it''s just a way of programming parts of the graphics card to make them do things different from the standard T&L way.

Share this post


Link to post
Share on other sites
quote:
Original post by EngageProductions
Thanks for explaining that, i am creating an RTS game so what would you advise using? Polybump? Shaders?
As the AP said, the fragment programs (pixel shaders) and vertex programs (vertex shaders) you choose to use are a reflection of your game more than anything. If you want to draw the coast, for example, you could use a vertex shader to create waves, and a water-effect pixel shader to animate the surface of the water. You might want to make a particularly nice fire effect, realistic-looking grass, or real-time shadows for your characters. Fragment/vertex programs can be used for all these things and more...


Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can''t stand 1 bit of competition.

Share this post


Link to post
Share on other sites