Renderers

From SRB2 Wiki
Jump to navigation Jump to search

The renderer is the part of a computer program that is responsible for drawing graphics on the screen. SRB2 includes two renderers: the Software renderer and the OpenGL renderer.

Comparison of renderers

Renderer Software OpenGL
Processing unit used CPU GPU
Translucency 9 levels, pre-calculated1 256 levels, calculated at run-time
Sector brightness 32 levels, pre-calculated 256 levels, calculated at run-time
Texture filtering None 6 modes available
3D models No Yes
Perspective correction No Yes

1 Not including full opacity and full invisibility, which are not treated as levels of translucency in Software mode.

Software renderer

A screenshot of SRB2 taken in Software mode.

The Software renderer is the default graphics renderer for SRB2. Its name stems from the fact that it does not use a graphics card and instead performs all rendering calculations on the computer's CPU. This is because it is inherited from Doom, which was created at a time when graphics cards in personal computers were not yet common.

Software features

  • Software contains a default gradient fog, as well as having the camera act as a minor light source.
  • Software contains a vast array of colormap and fog effects that can be used to add extra atmosphere to levels.
  • Software also supports a host of lighting effects, such as pulsating and flickering lights.

Software limitations

  • Software requires translucency and sector brightnesses to be pre-calculated (this is done by use of the TRANSxx and COLORMAP lumps respectively, both of which are found in srb2.pk3; see Palette > Technical information). Because of this, Software has only 9 different levels of translucency, and only 32 different levels of sector brightness.
  • Software does not use texture filtering.
  • Software uses the CPU exclusively, which causes SRB2 to run slowly on computers with older processors, even if they have a powerful graphics card.
  • Software has no perspective correction. Therefore, the further one looks up or down, the more the view is distorted. This is most noticeable when playing in first-person view.

OpenGL renderer

The OpenGL renderer is SRB2's alternative graphics renderer. It is based on the Open Graphics Library and uses the computer's graphics card extensively. While this makes it much faster on most modern computers, it lacks support for some of SRB2's visual effects. The OpenGL renderer can be enabled with the command line parameter -opengl. Since v2.1, SRB2 comes with a batch file that automatically starts the game in OpenGL mode.

The OpenGL renderer was first added to SRB2 in Demo 4.32. While not officially supported, it was fairly complete during the Final Demo era and became popular in the SRB2 community. It was initially disabled in Version 2.0 because several of the new Single Player levels made use of features that were not rendered correctly in OpenGL, making the levels virtually unplayable. While the v2.0.6 patch re-enabled OpenGL rendering, the visual issues remained until Version 2.1, when most of them were fixed.

OpenGL features

  • OpenGL renders the terrain with perspective correction. This allows players to look straight up and down without any visual distortion. However, as a consequence of this, sprites appear flat when viewed at steep angles.
  • OpenGL also has a great deal of built-in error correction that deals with the vast majority of Software's potential graphical problems. Hall of mirrors and slime trails rarely, if ever, appear, even in some of the most glitchy maps ever made for SRB2.
  • OpenGL allows for 255 levels of translucency, as well as 256 levels of sector brightness.
(Click on the screenshots linked in the table below to view larger versions of the images; the differences between the filtering modes can be seen more easily in the larger images.)
Filtering mode name Example screenshot Description
Nearest Nearest-neighbour interpolation (Default filtering mode)
Bilinear Bilinear filtering
Trilinear Trilinear filtering
Linear Nearest Bilinear filtering for close graphics, nearest-neighbour interpolation for far-away graphics
Nearest Linear Nearest-neighbour interpolation for close graphics, bilinear filtering for far-away graphics
Nearest Mipmap Nearest-neighbour interpolation for close graphics, trilinear filtering for far-away graphics

OpenGL limitations

  • OpenGL renders sprites that are in contact with the ceiling of a sector with a colormap as if they are entirely inside the sector using the effect.
  • OpenGL renders most of Software's lighting effects but in a much less pronounced fashion.
  • OpenGL is unable to render visual portals.
  • OpenGL periodically has sorting issues with translucent sprites, walls, and floors, where ones behind are drawn in front.
  • OpenGL does not properly support use of the "flash" palettes (see PLAYPAL). While unmodified SRB2's flash palettes are emulated in OpenGL, this means that flash palettes included with a custom palette set may not be shown properly in the renderer.
  • Computers with an insufficient graphics card may not be able to run OpenGL at a playable framerate.

Windows 8 and 8.1

A workaround is required in order for the OpenGL renderer to function correctly on Windows 8 and 8.1.

You must enable the Compatibility Layer for Windows 7 in order to prevent SRB2 from crashing when the OpenGL renderer is used.

Inserting "set __COMPAT_LAYER=WIN7RTM" in a batch file that launches SRB2 will handle this for you, and is recommended, but right-clicking on srb2win.exe and setting it manually also works.

See also