OpenGL Shaders (GLSL)

From FreeSpace Wiki
Revision as of 00:48, 6 March 2009 by Zacam (talk | contribs)
Jump to: navigation, search



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


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 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.

Reference Links:

OpenGL Org's Typhoon Labs Shader Designer

nVidia Shader Applications:

ATI Shader Tools

Apple OpenGL Tools