Sonic Unleashed Shaders Ported to Sonic Generations (WIP)
It’s been nearly two years since the release of Unleashed Project, a full conversion mod of Sonic Generations PC which ported all main Day stages from Sonic Unleashed to the platform. The mod was very positively received, for both allowing players to relive the best content of Unleashed and for being the catalyst of Sonic Generations‘ modding tools/community today. Since its release, the project team has been digging in further to figure out what can be ported, with Dario FF now looking to port Unleashed‘s shader information. The following is a summation of his progress so far:
While I’m even busier than usual with exams and such, I decided to give the shader stuff another try and managed to fix a lot of the issues my converter had. There’s still quite a few glaring issues at the moment though:
- Inaccuracies in different shaders yet to be found or properly debugged.
- Shaders that don’t actually convert yet due to unsupported instructions.
- No Cubemap support until I recreate the math used for it.
- Very inefficient performance-wise as the translation from Xbox 360 GPU instructions to PC GPU instructions is expected to be. This would be a much different story if they were re-compiled from the source rather than specific optimizations for the Xbox 360. This might not be such an issue in the long run due to GPUs overpowering the game a lot anyway.
However, despite all these issues I’m really happy with the results so far, and it seems like getting the conversion done right is possible despite how insane the task looks at first. For the sake of properly doing this from scratch, I deleted all shader-list files (the ones used by materials) and instead been porting every single shader one-by-one with the converter, making sure all the time I got the correct vertex and pixel shaders. I did this only for materials, not for post-processing effects yet. I changed the stages in several ways as well:
- I removed all the color correction applied to the stages in the final mod (due to differences in shaders)
- The DoF was tweaked to be an approximation to the originals (See below for more info on a recent find)
- All the .material files and textures were reverted to their original versions, due to differences in lighting and other effects. That means no HD retextures yet, as they looked very out of place with the correct shaders. Reverting the .material files also means most of the stages now use their correct shaders, which had to be changed for the final mod since they were unsupported. (I.e. showed up as red or some other buggy effects).
- Zoney ported back a lot of the models and materials used on the common objects to be the Unleashed ones, for the sake of testing out even more shaders.
- Also using Zoney’s Unleashed Model mod with the correct materials, which had completely different shaders assigned.
Regarding the Depth of Field (DoF) effect, I brought up on Twitter recently that there seems to be a very odd bug with the PC version of the game, and this is not something specific to the Shaders or FxPipeline itself as far as I can tell. The DoF doesn’t scale properly with the display resolution, resulting in less blurriness as the resolution is increased. For testing this I made the DoF very strong in this stage and only changed the resolution. You can see the intensity of the Blur effect is much stronger the lower the resolution is, which should not be the case when they’re both displayed at native 720p. This also explains why my 8k screenshots barely had any DoF as well:
I’m not sure if my math is right yet, but I’ve been getting pretty good approximations as to what the DoF values should be, and it seems to be related linearly to 720p. That is to say, if I’m playing at 1440p, simply dividing them by 2 (Increasing Blurriness) gives me something that looks much more like the original stage does. I’ve uploaded a Cheat Engine Table for FxPipeline that has the addresses of the DoF values, and they can even be tweaked in real-time while playing. The reason I’m posting them is because we might need a way to turn this into either an exe patch or an injection to fix this bug, and properly scale these values to whatever resolution the player might be using (720p being the one where the values actually translate properly). This would solve the problem and avoid having to do multiple versions of the same mod depending on the resolution the player is using. Add to that the fact that I wasn’t copying the DoF values to the correct place in the XMLs yet, and it’s no wonder I never found the ability to correct it. I realize an effect like this is more about taste than accuracy, so I will clarify this has nothing to do with the shaders and can be disabled if necessary.
Here are some additional screenshots of Dario’s progress, along with the following disclaimer:
(Discrepancies in contrast/brightness might be related to capturing or the lack of color correction. When comparing colors, remember to compare with the PS3 version as it’s the one that does not have the screwed up gamma curve of the 360 version. Every single material you see rendered has been ported from the Xbox 360 version of Sonic Unleashed.)
Might we see Unleashed Project being updated somewhere down the line thanks to these (and more) continuing efforts? Only time will tell.