doodlum / Skyrim-Community-Shaders

SKSE core plugin for community-driven advanced graphics modifications for AE, SE and VR. Also fixes bugs and improves performance.
GNU General Public License v3.0
137 stars 41 forks source link

chore: convert to skyrim half gamma space #428

Closed Pentalimbed closed 1 month ago

Pentalimbed commented 1 month ago

From Exist, empirically we have:

Then consider the equations:

  1. vanilla_pixel_value = vanilla_albedo * vanilla_light
  2. pbr_pixel_value = pbr_albedo * pbr_light If we assume pbr_light = pow(vanilla_light, 1.5), then

vanilla_pixel_value = pow(pbr_pixel_value, 1.5)

Also, vanilla_pixel_value is directly outputed as if it is srgb which is equivalent to tonemapping with a 2.2 gamma curve

Therefore, we can say the final presented pixels are equivalent to pbr values tonemapped with a gamma curve of 2.2/1.5 = 1.44, and true physically based light luminance is the 1.5 power of vanilla light.

PP is not edited in this commit in order to preserve vanilla visual, but pbr integration has been altered:

  1. Light colour conversion using 1.5 gamma
  2. Landscape albedo are blended in vanilla space to preserve visuals, then converted to linear for PBR, finally back to gamma for saving

EDIT: using sqrt(2.2) = 1.48 gamma now.