PDA

View Full Version : Vertex and Fragment program: application



manpreet
01-05-2004, 02:18 AM
Hi,

I am relatively new to vertex and fragment program extensions. I recently just got some basic sample stuff running with using these two extensions.

From what I have seen, the main uses seem to be
vertex programs:
custom per-vertex light assignment
vertex manipulation (possibly for animation)
fragment programs:
custom shading (light and texture
interpolation).

But is this really so landmark for purposes of realtime games? What fundamentally different stuff can you do?

I'd appreciate some ideas on what has been done using these or what is possible.

Thanks,
Manpreet.

Ostsol
01-05-2004, 10:49 AM
The greatest strength of vertex and fragment programs is not simply better versions of what can already be done, but that they are extremely versataile and can be applied to perform effects that would previously have only been possible if performed by the CPU. Think about procedural textures, for example. They can now be created in realtime, each frame. With super-buffers we'll be able to perform real-time, adaptive displacement mapping from a texture input.

Still, what we're seeing mostly in games from fragment programs has alot to do with the fact that the video cards are simple more capable and faster, too. Being able to apply more textures or process more lights (including per-pixel shading and specular highlights) in a single pass is a very nice thing indeed.

jwatte
01-05-2004, 07:14 PM
There are several components of the BRDF that weren't possible to emulate on traditional 4-texture hardware, but you can now compute most of it in hardware except for very special cases. That means that things will look better (more like you want them) OR that things will look as good or nearly as good as before, but render much faster (i e, on the GPU instead of as a slow CPU-based ray trace or whatever).

For example, a single projection light with shadow map, spherical harmonics based ambient environment, specular highlight, environment mapping, fresnel term, micro-flake two-tone shading, and bump mapping that affects all of these terms correctly was physically not possible to render on last generation hardware, no matter how many passes, whereas it's a (relative) snap to do and will fit in the shaders of the current generation.

Now, if you have multiple of these lights in the scene, the current hardware will at some point either require smaller resolutions (640x480) or low frame rates. But for an average of two lights per object with the above requirements, a current card will do on the order of 60 fps in 1024x768, which is pretty decent!