Difference between revisions of "OpenGL Shaders (GLSL)"
(Vertex / Fragment pairs) |
m |
||
Line 60: | Line 60: | ||
** '''f''': This value is in combination with the above possible combinations and is used for fog based lighting condition effects. (not to be confused with the -f that denotes Fragment Shaders) | ** '''f''': This value is in combination with the above possible combinations and is used for fog based lighting condition effects. (not to be confused with the -f that denotes Fragment Shaders) | ||
** The '''-v''' files are vertex shaders, the '''-f''' files are fragment shaders. | ** The '''-v''' files are vertex shaders, the '''-f''' files are fragment shaders. | ||
− | * Vertex and framgent shaders are paired up by the functions | + | * Vertex and framgent shaders are paired up by the needed functions in the fragment part. Therefore, there are less vertex shaders than fragment ones. The used vertex shaders are: |
** '''Null-v''', which offers color/shading only. | ** '''Null-v''', which offers color/shading only. | ||
** '''l*-v''', which offers lighting. | ** '''l*-v''', which offers lighting. |
Revision as of 15:55, 8 March 2009
Contents
Introduction
As most of users know, FS2_Open has been ported to OpenGL API from its original DirectX API. Since 3.6.9. builds, OpenGL has been the preferred API and DirectX support is not guaranteed anymore in future builds. Eventually, DirectX support might be completely dropped.
In addition, starting with 3.6.10. nightly test builds, the graphic engine has been enhanced in order to use shaders following the OpenGL Shading Language (GLSL). This new rendering add-on has allowed the inclusion of normal and parallax mapping effects and a general improvement in the game looking with nearly no performance loss (or even with performance gains).
Notes and system requirements
- Because of the used shader code, a Shader Model 3.0 capable GPU is needed for shaders to work. So you need:
- nVidia: GeForce 6xxx or newer card.
- ATI/AMD: Radeon (X1xxx), HD 2xxx or newer card.
- Others (Intel included): Possibly, there's no working card.
- You also need a set of shader files (see below).
- If your card is not SM3.0 capable or you don't have the needed shader files, the game will automatically fall back to legacy fixed render pipeline, (you will lose normal and parallax effect).
- Legacy fixed render pipeline can be also forced through -no_glsl flag. This flag is useful for troubleshooting or performance tests.
- Within F3 lab, if GLSL mode has been enabled, fixed render pipeline can be optionally switched on/off. In this way, shader vs. legacy rendering quality can be evaluated. Nevertheless, this setting is restricted to F3 lab, the rest of the game will continue using GLSL.
Known issues
ATI/AMD X1xxx GPUs
These GPUs are, in theory, SM 3.0 capable so they should run the shaders fine. BUT THEY DON'T. The game usually crashes or freezes with these GPUs.
Several SCP people are studying the issue. Speculation about its lack of Vertex Texture Fetch support has been stated as the source of the issue. But nothing has been set as the final conclusion. Here you have a link to VTF article in opengl.org wiki.
Possible solutions:
- Use -no_glsl.
- Use-at-your-own-risk hack for Windows XP 32-bit users:
- Update your Catalyst to the latest version.
- Locate 7.9 or older Catalyst version.
- Extract the installation archive but do not install it.
- Grab Atioglxx.dll from it.
- Copy Atioglxx.dll in FS2 folder. In this way your system will be updated to the last Catalyst version BUT FS2 will use an old one.
- Run the game. Expect possible bad performance.
- (If you prefer, you can look for just old Atioglxx.dll download links in HLP forums).
Mac users
Shaders don't seem to run fine in Macs. Expect some troubles specially with env mapping. Here you have some interesting reports from Mantis:
ForceWare 169.xx
These drivers are buggy and don't work fine (several graphical glitches). Why the hell are you using them? They're ancient. Update to a newer version NOW.
Description of shaders
- Shader files have got .sdr extension.
- They are placed in effects subfolder within general data structure. They work like any other game file: they can be packed in vp archives and they are fully affected by overall precedence priority.
- Starting from version 3.6.10., MediaVP package includes a full set of shaders within mv_core.vp.
- The game uses a fixed number of shaders (66). Each one of them can be identified trough its name with this key:
- l: lighting enabled
- b: uses base/diffuse map
- g: glow map. As always, this effect is switched on by -glow flag and it needs associated glow maps.
- s: specular map. As always, this effect is switched on by -spec flag and it needs associated specular maps.
- e: environment map. As always, this effect is switched on by -env flag and it is affected by the alpha channel on the specular map.
- n: normal map. This effect only exists in GLSL mode. It needs the usage of -normal flag and new normal maps.
- h: height map (parallax mapping). This effect only exists in GLSL mode. It needs the usage of -height flag AND -normal flag. So you cannot have parallax mapping without normal mapping. It also needs the usage of new height maps.
- f: This value is in combination with the above possible combinations and is used for fog based lighting condition effects. (not to be confused with the -f that denotes Fragment Shaders)
- The -v files are vertex shaders, the -f files are fragment shaders.
- Vertex and framgent shaders are paired up by the needed functions in the fragment part. Therefore, there are less vertex shaders than fragment ones. The used vertex shaders are:
- Null-v, which offers color/shading only.
- l*-v, which offers lighting.
- *e-v, which adds the env translation matrix.
- *n-v, which provides access to the tangent space data needed for normal maps.
- *f-v, which gives you fog support.
- Examples of vertex and fragment pairs:
- The only special thing that lbgs-f needs is lighting, which means it only has to be paired up with l-v.
- But lbgse-f needs envmap support too, so it is paired up with le-v which has access to the env translation matrix.
External links:
http://en.wikipedia.org/wiki/Shader
http://en.wikipedia.org/wiki/GLSL
http://www.opengl.org/documentation/glsl/
OpenGL Org's Typhoon Labs Shader Designer
http://www.opengl.org/sdk/tools/ShaderDesigner/
nVidia Shader applications:
http://developer.nvidia.com/object/fx_composer_home.html
http://developer.nvidia.com/object/nv_shader_debugger_home.html
http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html
ATI Shader tools
http://developer.amd.com/gpu/rendermonkey/Pages/default.aspx
http://developer.amd.com/gpu/archive/ashli/Pages/default.aspx
Apple OpenGL tools
http://developer.apple.com/graphicsimaging/opengl/opengl_serious.html