#### Archived

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

# Shaders finally used in a game!

## Recommended Posts

angrytofu    138
I played the demo of NOLF2 and I think it is the first PC game I have played where I could see shaders being used (for the water).. Are there any new games that take advantage of pixel/vertex shaders? Or any game engines maybe? Or will I have to wait a few months?

##### Share on other sites
PiXeLatiOn    122
Just Wait for DOOM 3 , kickassss

~The fastest polygons are those you don''''t draw...~

##### Share on other sites
davepermen    1047

"take a look around" - limp bizkit

##### Share on other sites
Dobbs    164
Morrowind uses pixel shaders for its reflective water, and I''m sure there are others out there.

DanielH    138

##### Share on other sites
angrytofu    138
for xbox games Iam not sure which use shaders

Also, I am hoping shaders will be used more than for just pretty water.

maybe I am really not sure what.. but I have this geforce4 and I would like to see it put to good use

##### Share on other sites
easlern    134
I''m pretty sure Neverwinter Nights uses PPVs for its "sparkly water" effect.

angrytofu    138
ppv?

##### Share on other sites
Mulligan    378
quote:
Original post by davepermen

"take a look around" - limp bizkit

please, dont EVER quote Limp Bizkit....ugh

##### Share on other sites
yeah ut2003 also uses em for that "sparkly water" we all love

##### Share on other sites
pieman    122
Check out this list at nVidia''s site :

http://www.nvidia.com/content/optimizedgames/index.asp

##### Share on other sites
davepermen    1047
there are no shaders before dx9.. at least, no pixelshaders.. thats why we only see a palette of (combined) standart effects, even in doom3..

vertexshaders are used on about every xbox game, and most have eigther some sort of perpixellighting, or cartoonshading, or a post-rendering image filter, or combinations. shaders don''t "blam" into your eyes, a) because they are very restrictive today, and b) because most of them just add suptle details (wich get killed on crappy tv screens 90% of the time anyways:D)

"take a look around" - limp bizkit

##### Share on other sites
Basiror    241
can someone explain how vertex shaders work or what they are doing?

##### Share on other sites
Ivyn    132
Seems like any games coming out soon supporting pixel shaders will/should have options for turning them off, am I right about that?
It just seems like a bad idea to require people to have a Geforce 3-4 or Radeon 8500 when so many people use TNT2s, Geforce 2s-, and all the other numerous 3d cards out there.

-- Ivyn --

##### Share on other sites
Cold_Steel    835
quote:
Original post by davepermen
there are no shaders before dx9.. at least, no pixelshaders.. thats why we only see a palette of (combined) standart effects, even in doom3..

Umm, do you mean dx8? There are vertex and pixel shaders in dx8, its just that pixel shaders aren''t supported by all that much hardware, and there is no software support for pixel shaders, unlike vertex shaders.

##### Share on other sites
_the_phantom_    11250
quote:
Original post by davepermen
there are no shaders before dx9.. at least, no pixelshaders.. thats why we only see a palette of (combined) standart effects, even in doom3..

why would that effect Doom3?
Doom3 being an OpenGL engine, which has had ''pixel shader'' like effects with Reg-coms on Nivida hardware at least for ages now (well, does per-pixel stuff, not as flexable as proper pixel shaders) and OGL has pixel shaders as part of the offical spec now (1.4 addition I belive)

##### Share on other sites
_the_phantom_    11250
quote:
Original post by Ivyn
Seems like any games coming out soon supporting pixel shaders will/should have options for turning them off, am I right about that?

They will probably take the same method as Doom with different code paths, depending on which gfx card you have, for the main render, at least, thats what I''d do anyways, seems like a good plan to me

##### Share on other sites
davepermen    1047
quote:
Original post by _the_phantom_
[quote]Original post by davepermen
there are no shaders before dx9.. at least, no pixelshaders.. thats why we only see a palette of (combined) standart effects, even in doom3..

why would that effect Doom3?
Doom3 being an OpenGL engine, which has had ''pixel shader'' like effects with Reg-coms on Nivida hardware at least for ages now (well, does per-pixel stuff, not as flexable as proper pixel shaders) and OGL has pixel shaders as part of the offical spec now (1.4 addition I belive)

yes, dx8 has something called pixelshaders, but it is by no means capable of doing really interesting pixel shading. the texture sampling is a simple fixed function, and the color math operations are limited to 8 instructions. and the hw in the background still uses the fixed function pipeline (if you know opengl, you know what nvidia hw has in reality there..)

why does that affect doom3? because doom3 runs on the same hw as dx. dx is not only an api, but as well a system-spec. if a sytem is capable of dx8, it can do this and that.. doom3 works good on dx8 hw, because it uses the fixed, highly customisable configurable fragment pipelines of dx8 hw. but they are by no means yet shaders..

much of the "shading" is actually possible on gf2 and gf1, the biggest problem there is the restriction to two textures, else, nearly everything would be possible that is done on gf3 or gf4.

to the fancy shader water.. that was possible years ago on an old matrox. and its possible on older radeons as well. they don''t have shaders, they don''t need shaders. the water is just another way of generating texture coords. if you know gl_nv_texture_shaders, then you know that it actually is a simple pipeline where you can choose some settings.. it is 4 settings actually.. for each texture one.. thats why its implemented similar to tex-env..

sure, dx8 has something named shaders.. but q3 has something named shaders as well.. so what?

if the pixelshaders would be capable of doing some real shading, there would not be need for multipass for a single perpixellight.. the math is really short for it..

for me, shading starts with dx9 hw. in opengl, of course, but still, dx explains what a hw can do, wich generation it is.. opengl, with the power of extensions, most the time does not have a real this_works_only_from_this_version_on.. as sometimes there are exts implemented in lower versions that can do stuff anyways.. thats why i use dx to name hw capabilities..

"take a look around" - limp bizkit

##### Share on other sites
angrytofu    138
i tihnk shaders is a confusing term.. there are quake3 shaders with have nothing to do with dx shaders

as far as explaining what shaders do.. it is one of the more tricky things to explain it is not as simple as explaining what antialiasing does for example

I am still trying to figure out how to program it in CG

##### Share on other sites
davepermen    1047

they are simple.. to get your vertex on screen, it has to get transformed. to generate texture coords for example for spherical environmental mapping, the texcoord has to be generated per vertex as a function of the normal. for doing vertexlighting, for each vertex lighting has to be calculated (no:D)..
now instead of having a hw that can exactly this, it got replaced by a vertex shader. now the gpu can do a couple of instructions, wich you can choose, much like in asm. so you can code the program that should be done per vertex, instead of relying on the fixed functionality the gpu provides (like transformation, spherical env, lighting..). that is the vertex shader. simple said:

  for_each(vertex) { list.push_back(your_vertex_shader(vertex)); if(list.size()==3) draw_triangle(list[0],list[1],list[2]), list.clear();}

now draw_triangle processes each pixel, interpolates texture coords for each pixel, to sample from that coords the texture color, interpolates the primary and secondary color, and does some combination of texture colors and vertexcolors, together with constant colors for fogging zb, to generate the final color perpixel. now, instead of a fixed functionality on how to set that pipeline, again, a programable part with a fixed amount of instruction and a fixed instructionlist is supported, and you can set those instructions, calculate with it what you want..

  for_each(pixel of triangle) { your_pixel_shader(pixel); if(alpha_test) if(failed(do_alpha_test(pixel)) continue; if(z_test) if(failed(do_z_test(pixel)) continue; ... if(!blending) screen[pixel.coords] = pixel.pixelshaderoutputcolor; else do_blending(screen[pixel.coords],pixel.pixelshaderoutputcolor);

so those two tiny parts of the huge pipeline you can now set yourself..

but those two have a major effect on the whole.. thats why they are interesting..

but anyways, ps1.0 - ps1.3 are too primitive to be called pixelshaders for me.. ps1.4 is.. acceptable.. but real programability comes with ps2.0 (at least, thats a good beginning:D)..
vs1.0 was a good start, thought..

for opengl fans, they could read up GL_ARB_vertex_program, GL_ARB_fragment_program, GL_ATI_text_fragment_shader, GL_NV_vertex_program2, GL_NV_pixel_program. the two arbs are the most important for the future, ati_text_fragment_shader is backward compatibilty for the radeon8500, to have the possibility to use the same interface (thougth another shader language).. and the NV extensions are, again, fancy nvidia special exts.. they can''t live without it at any time:D

my hint: forget cg. most of the dudes trying cg don''t even know opengl or dx really, no wonder they have no clue what those shaders are capable and what not. and if you don''t know your geforce3/4, and the pixelshader1.1 exactly, you have no chance to set up a valid pixelshader in cg anyways. even asm is too highlevel actually to set up the pixelshader unit of the gf3, how should c work there?

most professionals state cg is dead, before it got alive.. so what? wait for shaderlanguages on hw that actually can do real shaders.. wait for dx9 or gl2. they both provide good languages. and yes the dx9 language is similar to cg. but guess why m\$ never released a language for dx8? they knew the first pixelshaders (and vertexshaders) are so primitive, asm coding is actually simpler most the time for them..

hope it cleared up some stuff..

"take a look around" - limp bizkit

##### Share on other sites
_the_phantom_    11250
quote:
Original post by davepermen
for me, shading starts with dx9 hw.

ah, this is better, the reason I brought it up was before you said :

quote:
Original post by davepermen

which implies that ''no one had shaders before DX9 had appeared'' which seems to say DX9 is on the only thing which had it, now you''ve clafied it with ''dx9 hw'' I see your point, the shaders on these new cards could wel be considered ''proper shaders'' when compared to what we have now, however I would still argue that the gf3 and gf4 has proper shaders, with less flexiblity I admit than new hardware (isnt that always the way), as they can handle more than 2 textures per pass so you CAN get good effects with a single pass (assuming I''m understand what you said correctly about single pass PPL)

##### Share on other sites
Guest Anonymous Poster
so you are saying forget about CG since dx9 will contain a shading language of its own? What will it look like? Will there be any applicaitons that will aid in the creation?

since honestly, I am not the smartest guy.. I can load 3d models and move them around but I do not really know linear algebra.. So I would still like to use shaders somehow.. I suppose one way is to use ones already created and just stick them in ?

Anthing thing.. about vertex shaders and animation.. how would that effect character animation? how does caracter studio/dx/vertex shaders all work together? That is still unclear to me..

luckily meanwhile I have plenty of other things to learn but if I could toy with shaders some it would be nice