Author Topic: Release: Shader Tests 0.2.0  (Read 4739 times)

0 Members and 1 Guest are viewing this topic.

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Release: Shader Tests 0.2.0
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:

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.
« Last Edit: September 15, 2021, 06:28:25 am by qazwsx »
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife

 

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Re: Release: Shader Tests 0.0.1
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.
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife

 

Offline EatThePath

  • 28
  • Laser Lich
    • Twitter
Re: Release: Shader Tests 0.0.1
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
Name your damn turrets and sounds! Numbers alone aren't helpful!
"if disco is dead then I am the laser lich"
"...[Warmachine] keeps changing as fast as EatThePath can force the engine to do his dark bidding..."

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Release: Shader Tests 0.0.1
Glad the little package I threw together was useful, excellent write up too!

 

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Re: Release: Shader Tests 0.0.1
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.
« Last Edit: July 20, 2021, 05:38:58 am by qazwsx »
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife

 

Offline EatThePath

  • 28
  • Laser Lich
    • Twitter
Re: Release: Shader Tests 0.0.1
My stuff last night was very very dark lighting settings, so I tried some tonight with no lighting flags and aces approx



Then some with reinhard_jodie and the same lighting



Then at Nyx's request some with reinhard_jodie and tanked ambient light, which might be my favorite so far




Name your damn turrets and sounds! Numbers alone aren't helpful!
"if disco is dead then I am the laser lich"
"...[Warmachine] keeps changing as fast as EatThePath can force the engine to do his dark bidding..."

 

Offline den5

  • 27
Re: Release: Shader Tests 0.0.1
These shaders work fine with FS2 MVPS and installed FS2 mods. But when I try to use any shader with The Babylon Project -3.7.6 I get a gray screen. I can see the HUD but nothing else. Any thoughts what is wrong?

[attachment deleted to save space]

 

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Re: Release: Shader Tests 0.0.1
These shaders work fine with FS2 MVPS and installed FS2 mods. But when I try to use any shader with The Babylon Project -3.7.6 I get a gray screen. I can see the HUD but nothing else. Any thoughts what is wrong?
Which engine version is this running on? These shaders work by replacing some of the internal engine files and there's no guarantee of compatibility between versions.
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife

 

Offline den5

  • 27
Re: Release: Shader Tests 0.0.1
I'm run it on fs2_open_21_0_0_x64_AVX, fs2_open_21_2_0_x64_AVX and Nightly fs2_open_21_3_0_20210718_5318fba07_x64_SSE2

 

Offline Nyctaeus

  • The Slavic Engineer
  • 212
  • My "FS Ships" folder is 582gb.
    • Minecraft
    • Exile
Re: Release: Shader Tests 0.0.1
I don't have time to give this a try myself, but I very much appreciate all efforts put into this thing :yes:
Exile | Shadow Genesis | Inferno | Series Resurrecta  | DA Profile | P3D Profile

Proud owner of NyctiShipyards. Remember - Nyx will fix it!

All of my assets including models, textures, skyboxes, effects may be used under standard CC BY-NC 4.0 license.

 

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Re: Release: Shader Tests 0.0.1
I'm run it on fs2_open_21_0_0_x64_AVX, fs2_open_21_2_0_x64_AVX and Nightly fs2_open_21_3_0_20210718_5318fba07_x64_SSE2
I'm chatting to some people on discord. TBP uses custom shaders, so there's a good chance there's a shader conflict causing this to mess up. My guess it's effects/post-f.sdr that's causing the issue, but it's late here, so I'll have to investigate tomorrow
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife

 

Offline EatThePath

  • 28
  • Laser Lich
    • Twitter
Re: Release: Shader Tests 0.0.1
There shined a shiny demon! (and also some molochs)

This really makes the age of the textures on the tev destroyers all the more painful, though...
Name your damn turrets and sounds! Numbers alone aren't helpful!
"if disco is dead then I am the laser lich"
"...[Warmachine] keeps changing as fast as EatThePath can force the engine to do his dark bidding..."

 

Offline den5

  • 27
Re: Release: Shader Tests 0.0.1
I'm chatting to some people on discord. TBP uses custom shaders, so there's a good chance there's a shader conflict causing this to mess up. My guess it's effects/post-f.sdr that's causing the issue, but it's late here, so I'll have to investigate tomorrow
Custom shaders, I forgot about them. Removed post-f.sdr and now everything works. Thanks for the help.

 

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Re: Release: Shader Tests 0.0.1
Updated with 2 1/2 new Tonemapping Operators, see OP for details
« Last Edit: July 23, 2021, 08:54:00 pm by qazwsx »
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife

 

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Re: Release: Shader Tests 0.0.2
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.
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife

 

Offline EatThePath

  • 28
  • Laser Lich
    • Twitter
Re: Release: Shader Tests 0.1.0
It's really hard for me to pick between things like this, and comparing simlar but not identical scenes makes it harder. So today I spent something like tn hours on and off whittling at the code until I made my FSO spit out a set of screenshots, one for each mapper, whenever I hit the printscreen. I'll probably take more, but here's a selection of my output so far.
First person of spray and pray Achilles lighting up a Deimos' hull
Subspace portals and beams
Orange Ravana in the dark
Hecate and Deimos in decent light
Hecate shadowy underbelly over neptune.
Background destroyers, beams, and 'splosions, midground achiles wing.
Foreground achilles, background orange ravana lit by beamfire
Moloch gonna **** you up.

Each link is to an imgur gallery of seven variations on each scene.

...Now if I could just pick a consistent favorite across them...
Name your damn turrets and sounds! Numbers alone aren't helpful!
"if disco is dead then I am the laser lich"
"...[Warmachine] keeps changing as fast as EatThePath can force the engine to do his dark bidding..."

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Release: Shader Tests 0.1.0
Ah these are very helpful, awesome work!

  

Offline EatThePath

  • 28
  • Laser Lich
    • Twitter
Re: Release: Shader Tests 0.1.0
Oh yeah, if anyone code inclined wants to mess with that capability, the code is at https://github.com/EatThePath/fs2open.github.com/tree/multishot.
Name your damn turrets and sounds! Numbers alone aren't helpful!
"if disco is dead then I am the laser lich"
"...[Warmachine] keeps changing as fast as EatThePath can force the engine to do his dark bidding..."

 

Offline EatThePath

  • 28
  • Laser Lich
    • Twitter
Re: Release: Shader Tests 0.1.0
Lest this look like a dead end for passers by, a little status roundup.

As I dug deeper and deeper into this and learned more about PBR, tonemappers, and how FSO handles them both, I became increasingly convinced that a mods using custom shaders or a switch to the engines' defaults would both be inadequate, and that if we're going to finally put the matter of FSO tonemapping to bed we have to go a lot harder.

Where this effort has gone, then, is to a plan to introduce a new table to FSO that allows mods to take control of their choice of tonemapper and various currently fixed settings. My hope is for this to take over entirely for the lighting flags that are currently standard, and overcome some of their limitations as well. There are a lot of things that look not quite right (or at least, not always what you want) in the current rendering pipeline that I think can probably be cleaned up in the course of adding everything to this that needs to be in that table.

Right now that project is on the shelf, but it's at the front of the shelf and as soon as WM R2 is out it's moving up the list.
Name your damn turrets and sounds! Numbers alone aren't helpful!
"if disco is dead then I am the laser lich"
"...[Warmachine] keeps changing as fast as EatThePath can force the engine to do his dark bidding..."

 

Offline qazwsx

  • POST DRUNK GET TITLE
  • 29
    • Minecraft
Re: Release: Shader Tests 0.2.0
Added new shader, designed to reduce specular glinting/shimmering on distant ships. See original post for details and video
<Achillion> I mean, it's not like he's shoving the brain-goo in a usb slot and praying to kurzweil to bring the singularity

<dsockwell> idk about you guys but the reason i follow God's law is so I can get my rocks off in the afterlife