[1.0.6] "True" gamma

#1
Actual gamma correction takes every pixel on the screen and raises its R,G and B components by a power of 1/gamma, assuming that the values of RGB are between 0 and 1. The game's implementation just makes the whole screen brighter, but things are still hard to see because the contrast is low.

This mod changes the UpdateScreenGamma function to be closer to what gamma correction actually is.

Download
https://www.mediafire.com/?jy38fi0jqxmc46d
Drag this into your SCP-CB (v1.0.6) folder and run it.

Source code changes:
Main.bb
Replace UpdateScreenGamma with this:

Code: Select all

Function UpdateScreenGamma()
	Local n# = 1.0/ScreenGamma
	Local k%
	
	For k=0 To 255 
		Local c# = Min(Max(0, ((k/255.0)^n)*255), 255)
		SetGamma k,k,k,c,c,c
	Next 
	UpdateGamma 
End Function
Menu.bb
Replace line 486 with this:

Code: Select all

ScreenGamma = (SlideBar(x + 310*MenuScale, y+6*MenuScale, 150*MenuScale, ScreenGamma*50.0)/50.0)
Last edited by juanjp600 on Fri Apr 03, 2015 1:49 am, edited 1 time in total.