Jump to content
Sign in to follow this  
Biology

Experimenting with the HDR shader

Recommended Posts

Hi,

I find the HDR mode colors extremely oversaturated, and given that EA works best with HDR, I've decided to experiment with the shaders. Looking at the HDR shader (ShadersHLSL/PostProcess/HDR.hlsl inside Prepar3D's main installation directory), it looks like P3D is using ACES tonemapping, which unsurprisingly oversaturates everything.

So, I've replaced the tonemapping function with several others (Uncharted 2, Reinhard and Exponential), which have a more filmic and less saturated look. Sadly, I don't have access to my main PC which has P3D installed right now, and I won't have access for several days.

But I was quite impatient and therefore decided to post the modified shader files - is anyone willing to test them and send comparison screenshots? I would be really appreciated.

Regardless, here is the default HDR shader of v5.0 HF2 (credits to @xTiMm_), please compare it with the one from v5.1 HF1 before using: https://hastebin.com/tenumiyiha.cpp

And here are the modified HDR shaders with new tonemapping functions:

Uncharted 2: https://hastebin.com/helinunaga.cpp (You might need to adjust the white point, see the comment on line 70 for more details)

Reinhard: https://hastebin.com/aqayozasib.cpp

Exponential: https://hastebin.com/udotoqazoq.cpp

Installation instructions:

Backup the default ShadersHLSL/PostProcess/HDR.hlsl inside the main installation directory.

Open the HDR.hlsl with a text editor like Notepad and replace the contents of it with the modified shader you want.

Launch P3D and enable HDR if you haven't.

Edited by BiologicalNanobot
  • Like 1
  • Upvote 1

PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post

Also, I mostly have a GLSL background instead of HLSL, so I'm not even sure if the modified shaders actually compile. Could a developer like @simbol check the syntax? I'd be really thankful.


PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post

What is a GLSL background?


Gigabyte x670 Aorus Elite AX MB; AMD 7800X3D CPU; Deepcool LT520 AIO Cooler; 64 Gb G.Skill Trident Z5 NEO DDR5 6000; Win11 Pro; P3D V5.4; 1 Samsung 990 2Tb NVMe SSD: 1 Crucial 4Tb MX500 SATA SSD; 1 Samsung 860 1Tb SSD; Gigabyte Aorus Extreme 1080ti 11Gb VRAM; Toshiba 43" LED TV @ 4k; Honeycomb Bravo.

 

Share this post


Link to post
13 minutes ago, pgde said:

What is a GLSL background?

OpenGL's shader language, it has slight differences to HLSL. In other words, I mostly code in GLSL and not HLSL. I've almost never coded in HLSL but I'm assuming it's quite close to GLSL.

Edited by BiologicalNanobot

PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post

Thanks for the info! That was one acronym I couldn't decipher!

  • Like 1

Gigabyte x670 Aorus Elite AX MB; AMD 7800X3D CPU; Deepcool LT520 AIO Cooler; 64 Gb G.Skill Trident Z5 NEO DDR5 6000; Win11 Pro; P3D V5.4; 1 Samsung 990 2Tb NVMe SSD: 1 Crucial 4Tb MX500 SATA SSD; 1 Samsung 860 1Tb SSD; Gigabyte Aorus Extreme 1080ti 11Gb VRAM; Toshiba 43" LED TV @ 4k; Honeycomb Bravo.

 

Share this post


Link to post
Quote

Uncharted 2: https://hastebin.com/helinunaga.cpp (You might need to adjust the white point, see the comment on line 70 for more details)

Reinhard: https://hastebin.com/aqayozasib.cpp

Exponential: https://hastebin.com/udotoqazoq.cpp

First one: I have black screen only. See nothing but can click buttons in cockpit

Second one: the same black screen

Third one: CTD during loading flight

Edited by AdiR
  • Like 1

Adrian

Share this post


Link to post

Black screen usually means the shader has failed to compile, so I guess I made a mistake. Do you have a log or something that shows the issue?

Edited by BiologicalNanobot

PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post
8 minutes ago, AdiR said:

First one: I have black screen only. See nothing but can click buttons in cockpit

Second one: the same black screen

Third one: CTD during loading flight

Just to make sure, could you send a screenshot of the modified HDR.glsl opened on Notepad or something else? I suspect you might've copied the line numbers as well.


PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post
31 minutes ago, BiologicalNanobot said:

Just to make sure, could you send a screenshot of the modified HDR.glsl opened on Notepad or something else? I suspect you might've copied the line numbers as well.

No line numbers for sure (can't check it right now cause I'm already in my bed  but I'm pretty sure as I write php code for web apps and rather don't make such kind of mistakes 😉).

Will try once again tomorrow 🙂 

  • Like 1

Adrian

Share this post


Link to post
14 hours ago, AdiR said:

No line numbers for sure (can't check it right now cause I'm already in my bed  but I'm pretty sure as I write php code for web apps and rather don't make such kind of mistakes 😉).

Will try once again tomorrow 🙂 

Oh, that's sad... Sadly I'm a GLSL guy and not sure what's wrong with the code. Just to make sure, what P3D version do you have? Could you upload your default HDR.hlsl to Hastebin? Thank you.


PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post
6 hours ago, BiologicalNanobot said:

Oh, that's sad... Sadly I'm a GLSL guy and not sure what's wrong with the code. Just to make sure, what P3D version do you have? Could you upload your default HDR.hlsl to Hastebin? Thank you.

  1. P3Dv5.1HF1
  2. https://pastebin.com/fS8R1MUq
Edited by AdiR
  • Like 1

Adrian

Share this post


Link to post
13 minutes ago, AdiR said:

This explains the issue... I got the shaders from v5.0 HF2 and it looks like v5.1 HF1 HDR shader seems to be different than v5.0 HF2 one.

Edited by BiologicalNanobot

PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...