Renderers

From SRB2 Wiki
Jump to: navigation, search

Renderers are the method through which the game is displayed on the computer screen. In SRB2, there are two main renderers in use currently:

Comparison of renderers

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

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 player 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 has support for transparent pixels in multi-patch textures.

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.srb; see Palette > Technical information). Because of this, Software has only 9 different levels of translucency, and only 32 different levels of sector brightness.
  • Software has no built in clip-distance. This means that levels must be confined to a certain size or a variety of graphical glitches such as slime trails will result. Thus, levels must be made smaller to fit within this limitation.
  • Software does not use texture filtering.
  • Software uses the CPU exclusively which causes SRB2 to run slowly on computers who have older processors despite how powerful their video card might otherwise be.
  • Software has no perspective correction. Therefore, the further one looks up or down the view is more and more distorted. This is most noticeable when playing in first person mode.

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 2.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 has a built in clip-distance, which allows levels to be made much larger and more open than can ever be supported in Software.
  • OpenGL allows for special fog effects that can be increased or decreased in the Options menu, under 3D card options. It draws fog in the distance and the color and density can be changed in the options.
  • 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-ex.png Nearest-neighbour interpolation (Default filtering mode)
Bilinear Bilinear-ex.png Bilinear filtering
Trilinear Trilinear-ex.png Trilinear filtering
Linear Nearest LinearNearest-ex.png Bilinear filtering for close graphics, nearest-neighbour interpolation for far-away graphics
Nearest Linear NearestLinear-ex.png Nearest-neighbour interpolation for close graphics, bilinear filtering for far-away graphics
Nearest Mipmap NearestMipmap-ex.png Nearest-neighbour interpolation for close graphics, trilinear filtering for far-away graphics
  • OpenGL has support for Object shadows, which are enabled/disabled using the console variable shadow which is saved in config.cfg.

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 periodically has sorting issues with translucent sprites, walls, and floors, where ones behind are drawn in front.
  • OpenGL has no support for the display offset feature for Objects.
  • OpenGL will render the view multiple times in different directions depending on vertical view angle, this can be seen on translucent walls.
  • 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 custom palette sets 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