A year or so back I was planning on writing a congratulatory article to show my appreciation to Dave Airlie for fixing a long standing bug in Mesa that prevented users of older AMD Radeon HD cards from enjoying Trine Enchanted Edition on the free graphics stack. Bug 91808 resulted in a variety of graphical artifacts which, while not interfering with the gameplay, still put me off using that version of Trine.
After several years and a great deal of evident frustration on his part, Airlie was able to track down the root of the problem and at long last was able to push a fix to master in May 2018. Airlie and developers like him are often the unsung heroes of FOSS development, and I wanted to give him a well deserved public pat on the back for his effort in fixing a bug which would only have affected such a small number of people.
Unfortunately my research into this led me down an entirely different rabbit hole when I discovered the report for Bug 66067. A much more subtle misrendering of the game's colours and lighting, this bug is present in both Trine 2 and Trine Enchanted Edition. Unlike the previous instance where it was an issue in the drivers that was the culprit, this issue is present in the game binaries themselves.
Trine Enchanted Edition when affected by Mesa bugs 91808 and 66067.
Unlike the proprietary vendor drivers provided by Nvidia and AMD, the free Mesa stack as a rule does not implement application specific fixes and instead adheres more strictly to the standards outlined by Khronos Group and other similar bodies. There are a number of reasons for this, mostly relating to adhering to a higher standard of code quality, and thus limiting the maintenance overhead for the FOSS developers.
In developing their games Frozenbyte made certain mistakes related to texture sampling and shadow sampling which were not technically in line with specifications, but are still accommodated for by most vendor drivers. The result is that the game will only render correctly for AMD users on Mesa when provided with specific patches that allow it to mimic the same incorrect behaviour found in the proprietary blob.
Applying these patches is nontrivial for the uninitiated, but through the use of Arch Build System I was able to spin my own Mesa packages to play through my copies of both Trine Enchanted Edition and Trine 2: Complete Story as the developer originally intended. The proper solution would be for Frozenbyte to patch their games to adhere to the correct Cg standard, but that now seems very unlikely.
Trine Enchanted Edition rendering correctly with a patched Mesa.
Frozenbyte was an early adopter of Linux, first through the porting house Alternative Games and then later through their own in-house development starting with Trine 2. The Humble Frozenbyte Bundle in April 2011 was the first Humble Bundle I ever purchased, and I got a lot of enjoyment from their games through the first half of our soon to close decade. As recently as 2016 their game Shadwen was released with full Linux support.
Since then a lot has changed over at Frozenbyte. The studio no longer has the same depth of Linux savvy programmers it once had, and following the release of Shadwen has been teaming up with publishers more intent on the console market. Its last three titles have all lacked Linux support, and with the release of Trine 4: The Nightmare Prince last month, the series is no longer fully represented on our platform.
Lacklustre Linux sales and internal restructuring following the lukewarm reception on all fronts to the third release in the franchise Trine 3: The Artifacts of Power appear to have taken Frozenbyte out of the Linux market for good. With even their old games struggling to run well on the Mesa graphics stack, it marks a sad end to a series that once provided so much colour to our platform.
UPDATE: Daniel Scharrer got in touch in the comments to provide some technical clarifications and share his LD_PRELOAD hack that solves the problem at the application rather than the driver level.
Those wanting to try the series can find Trine: Ultimate Collection on either GOG.com or Steam. Note that as stated before Trine 4: The Nightmare Prince does not currently have Linux support.
Tip: Click to enlarge, the arrow keys to switch between them.
It honestly doesn't look terrible on Mesa, but it is absolutely worse. It was claimed in one of the bug reports from years ago that some puzzles are unsolvable from the borked colors/lighting/shadows. No idea if this is still true with today's Mesa.
Main menu background
Mesa:
Proton:
From level 1, Astral Academy (starting point)
Mesa:
Proton:
From level 2, Academy Hallways
Mesa:
Proton:
edit: added 2 more comparison image sets
Last edited by dpanter on 21 November 2019 at 10:03 pm UTC
Quoting: x_wingBut your GPU has supports up to OpenGL 4.5 (at least with core profiles).
[hamish@Gehirn ~]$ glxinfo | grep "OpenGL core profile version"
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.4
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.4
[hamish@Gehirn ~]$
That said, I just tried launching Trine 3 with Mesa overriding the OpenGL version to 4.1 and it does work.
export MESA_GL_VERSION_OVERRIDE=4.1 MESA_GLSL_VERSION_OVERRIDE=410
./trine3.sh
I can also confirm that Daniel Scharrer's LD_PRELOAD hack does fix the issues with Trine 2, so I have appended it to the end of the article.
Quoting: HamishQuoting: x_wingBut your GPU has supports up to OpenGL 4.5 (at least with core profiles).[hamish@Gehirn ~]$ glxinfo | grep "OpenGL core profile version"
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.4
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.4
[hamish@Gehirn ~]$
That said, I just tried launching Trine 3 with Mesa overriding the OpenGL version to 4.1 and it does work.
export MESA_GL_VERSION_OVERRIDE=4.1 MESA_GLSL_VERSION_OVERRIDE=410
./trine3.sh
I can also confirm that Daniel Scharrer's LD_PRELOAD hack does fix the issues with Trine 2, so I have appended it to the end of the article.
Me bad, you're one tier down: https://www.phoronix.com/scan.php?page=news_item&px=R600g-OpenGL-4.5-Hits
Quoting: HamishQuoting: eldakingI would say this story is a good example of the benefits we could have from games being FOSS.I had thought of mentioning this, but I could really turn this topic into an article in and of itself.
The original Unreal Tournament is stuck with a similar issue on Mesa that makes the old native build unable to launch. Enemy Territory: Quake Wars is plagued with the wchar bug when using modern versions of glibc.
Playing both of these games through WINE is now often easier than doing so natively, due to it being a stable environment. Both modern Windows and Linux are moving targets.
Frozenbyte released some of its source code in the past as part of the Humble Frozenbyte Bundle, although I doubt they are likely to do so again any time soon.
I just tried the old Enemy Territory: Quake Wars demo on an updated Arch and it works fine. Some bad screen tearing though.
Quoting: noxI may not have read the article well enough, but Trine and Trine 2 renders fine on my system with Mesa Aco. I guess there are fixes not in a release yet?
It renders fine, but there seems to be some subtle issues with lighting, as hinted in the screenshots a few posts above yours :)
@Desum, I thought only YoRHa-2B could use that profile pic :P
Last edited by MayeulC on 21 November 2019 at 6:02 pm UTC
Quoting: noxI may not have read the article well enough, but Trine and Trine 2 renders fine on my system with Mesa Aco. I guess there are fixes not in a release yet?
Quoting: Xaero_VincentI just tried the old Enemy Territory: Quake Wars demo on an updated Arch and it works fine. Some bad screen tearing though.I am going to reply to both of you here since the question I would put to both of you is the same. Are you sure you are not being affected? For both games the problems are subtle and hard to spot at first.
dpanter posted some comparison shots that do a good job showing some of the rendering differences in Trine, while with ET:QW the easiest to spot issue is that text strings will be missing their final character. Which, while annoying, would not be that much of a problem if it were not for the fact that the same bug causes segmentation faults under certain conditions.
What is really vexing with ET:QW is that it is not even really a bug in the game itself, but in the old GCC compiler that was used to build it. Just rebuilding the game on a modern setup would solve the issue.
See more from me