Modding, Mission Design, and Coding > The Modding Workshop

Release: Shader Tests 0.2.0

(1/4) > >>

qazwsx:
Link: https://fsnebula.org/mod/qaz_1

CHANGELOG

2021-09-14: Anti-glitter shader tweak has been accepted by the SCP, the next release of FSO will include it by default

Version 0.2.0

Added new shader designed to reduce specular glinting/shimmering on distant ships.


This is based off a 2015 GDC talk by valve (slides here, page 43/44). Surfaces are made to have a lower glossiness value if the normal buffer's gradient is too high.

As this modifies a different shader to the previous tonemapping work, it can be used in combination with any one of the tonemapping options

Version 0.1.0


* Updated exposure correction factors to be equal across tonemappers, this means the same colours/intensities are going into all of the shaders, making comparisons much easier.Apologies to anyone using this mod, you'll have to play with your lighting settings again.

Version 0.0.3


* Fixed edge case in PPC tonemappers, intensities brighter than the maximum defined by shoulder strength no longer render as black.
Version 0.0.2

Added 2 1/2 new tonemappers:


* Cineon - AKA Hejl/Burgess-Dawson tonemapping. Less aggressive toe than ACES but still a very nice effect. From http://filmicworlds.com/blog/filmic-tonemapping-operators/
* Piecewise Power Curves  - as proposed by John Hable of UC2 fame here: http://filmicworlds.com/blog/filmic-tonemapping-with-piecewise-power-curves/

* Piecewise Power Curves RGB - same as above, but operates on the channels separately, probably the better choice Piecewise Power Curves are quite nice as the tweakable parameters are all quite sensible and not too difficult to understand, please play around with the values in the shader! There's 5 parameters to tune that really capture most of what you want out of a filmic curve, you can even eliminate the toe entirely.
Visualise tuning the parameters here: https://www.desmos.com/calculator/tb8hf94h28

Original Post

Hi all,

There's been some discussion on Discord about the way the shaders in FSO work. Right now I believe there's a disconnect between the material and tonemapping models used in the tools people are creating textures in, (e.g Substance Painter, Armorpaint) and those being used in FSO. This introduces an issue where models won't look the same when creating them and when viewing them in game, leading to repeated tweaking and potential frustration.

Luckily FSO has the ability to load external shaders, overriding the ones built in to the executable. Because of this, I've started working on a small mod to test out different potential material models and tonemapping operators. Right now, it consists of a small core package that enables external shader loading, and several optional packages that implement different tonemapping operators. The tonemapping operators are as follows:


* Uncharted 2 - The tonemapper used by Uncharted 2 and currently the default for FSO, as described by original author John Hable here
* ACES - ACES (Academy Color Encoding System) tonemapping operator, default in Unreal Engine 4.
* ACES Approximation - An approximation of ACES tonemapping, developed by Krzysztof Narkowicz. Oversaturates bright colours. Faster.
* Reinhard
* Reinhard-Jodie - Operates on luminance rather than RGB as brightness is perceived differently for each channel.
* Linear - Not recommended
Please enable ONLY ONE of the optional packages.

This mod can be tacked-on to any other existing mod/TC if you know how. Feel free to try it out with Warmachine, Solaris etc. I'd love to see some screenshots  :D.

The code for all of these tonemappers has been cribbed from https://64.github.io/tonemapping/, many thanks to wookiejedi for the initial work on implementing these shaders.

Future work:

* Tease out the default material models used in popular engines/tools, port them to FSO's shader system
* Use Renderdoc and a camera script to generate HDRI environment maps so you can load Freespace environments into your texturing tool of choice.

qazwsx:
Oh yeah, I'm running on a 3070 here, there shouldn't be any issues with older openGL versions as everything here is pretty simple. But, if you're having issues, post hog log.

EatThePath:
Excellent. This is one of those things that I've thought about poking at but never gotten around to, I'm glad you've gotten this ball rolling

wookieejedi:
Glad the little package I threw together was useful, excellent write up too!

qazwsx:
Some shots from EatThePath testing out ACES Approximation:






Some more thoughts:

The built-in "Uncharted 2" tonemapper has a habit of bumping up the brightness of dark parts. This isn't present in the ACES tonemapper, so scenes will seem a lot darker.

Default tonemapping

Post processing off


There's a lot of detail being lost in the shadows here, which the UC2 tonemapper tries to recover -  to the detriment of specular highlights. The ACES tonemapper does a better job at preserving these details, but right now needs to be balanced with a higher ambient factor to preserve the standard "look".

There's a tradeoff between the tonemappers. With ACES, the backgrounds end up having blacks crushed heavily and a lot of the subtle nebula detail is lost. On the other hand, the images above are a great example of the issues with the black-boosting of UC2. The gradient on the planet's atmosphere is blown out and makes the whole thing look like a fuzzy ball.

There's a fundamental difference between background creation and ship creation, and applying tonemapping to backgrounds is always going to give results that look different to the 2D originals. The toe and shoulder curves of whatever tonemapping operator you use are going to interfere with what the original background artist settled on. Unfortunately I really don't know how to square that circle beyond big rendering engine rewrites.

Edit: Can someone explain how skyboxes are rendered? Might be possible to avoid a load of hell here if we just brighten the skyboxes so they're shifted into the linear region of the tonemappers.

Navigation

[0] Message Index

[#] Next page

Go to full version