- // actually we do in sRGB fallback with sRGB lightmaps: Image_sRGBFloatFromLinear_Lightmap(Image_LinearFloatFromsRGBFloat(x))
- // neutral point is at Image_sRGBFloatFromLinearFloat(0.5)
- // so we need to map Image_sRGBFloatFromLinearFloat(0.5) to 0.5
- // factor is 0.5 / Image_sRGBFloatFromLinearFloat(0.5)
- loadmodel->lightmapscale *= 0.679942f; // fixes neutral level
+ if (vid_sRGB.integer && vid_sRGB_fallback.integer && !vid.sRGB3D)
+ {
+ // actually we do in sRGB fallback with sRGB lightmaps: Image_sRGBFloatFromLinear_Lightmap(Image_LinearFloatFromsRGBFloat(x))
+ // neutral point is at Image_sRGBFloatFromLinearFloat(0.5)
+ // so we need to map Image_sRGBFloatFromLinearFloat(0.5) to 0.5
+ // factor is 0.5 / Image_sRGBFloatFromLinearFloat(0.5)
+ //loadmodel->lightmapscale *= 0.679942f; // fixes neutral level
+ }
+ else // if this is NOT set, regular rendering looks right by this requirement anyway
+ {
+ /*
+ // we want color 1 to do the same as without sRGB
+ // so, we want to map 1 to Image_LinearFloatFromsRGBFloat(2) instead of to 2
+ loadmodel->lightmapscale *= 2.476923f; // fixes max level
+ */
+
+ // neutral level 0.5 gets uploaded as sRGB and becomes Image_LinearFloatFromsRGBFloat(0.5)
+ // we need to undo that
+ loadmodel->lightmapscale *= 2.336f; // fixes neutral level
+ }