-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Implement color management option. (#777)
Previously the color management was always of sRGB and the user had no control over it. To fill this gap the user should have the ability to define the final color space, linear or sRGB. First of all an option named "Color Management" in a new tab under Render panel is added, it can be "Linear" or "sRGB", the default is "sRGB", When game engine is selected changing this option will force the recompilation of all shaders and they will add or remove color space conversion at the end of the shader. In game the color space is not managed at the shader level, but at the final copy of the offscreen to the screen. Firstly the material in game must disable the color management, this is done by a new set of flags passed to GPU_material_from_blender or GPU_material_world and the flag GPU_MATERIAL_NO_COLOR_MANAGEMENT. Secondly the three shaders used to copy the offscreen to screen (normal, stipple stereo, anaglyph stereo) now have a sRGB version including a call to linearrgb_to_srgb enabled by the macro COLOR_MANAGEMENT. The color space used is stored in the rasterizer in enum variable m_colorManagement for linear and sRGB, this variable is used to select the correct shader to bind before flushing to screen. Because the linear to sRGB conversion is not anymore using a float value with the highest precision at the output of the fragment shader, the texture format GL_RGBA8 is introducing bands because of its poor resolution. Replacing it by GL_RGBA12 prevents the bands. In the same time the color management used in KX_FontObject or KX_WorldInfo is now obsolete and removed, also KX_WorldInfo is getting GPUMaterial only in new function ReloadMaterial called by the FinalizeSceneData such as material shaders and by setMaterialGLSL.
- Loading branch information
1 parent
08b0874
commit 552bf8e
Showing
29 changed files
with
327 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.