Related to bug #27004: there is now an option to disable color management for
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 2 May 2011 09:08:43 +0000 (09:08 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 2 May 2011 09:08:43 +0000 (09:08 +0000)
GLSL. I've tried to find a quicker way to do it that still looks the same, but
couldn't find a formula that didn't have major color shifts.

release/scripts/startup/bl_ui/properties_game.py
source/blender/gpu/intern/gpu_material.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c

index a151234e184c6cf3c25d61b431a1caad882d47f9..0c07451b3b2dcdde62413053dbe48b305765863c 100644 (file)
@@ -323,6 +323,7 @@ class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
             col.prop(gs, "use_glsl_lights", text="Lights")
             col.prop(gs, "use_glsl_shaders", text="Shaders")
             col.prop(gs, "use_glsl_shadows", text="Shadows")
+            col.prop(gs, "use_glsl_color_management", text="Color Management")
 
             col = split.column()
             col.prop(gs, "use_glsl_ramps", text="Ramps")
index 4155b7a8ac0cabeabfbc9701668da811631e7368..134bffc7b8cb5a0150f4d168d390237f03d3790b 100644 (file)
@@ -1011,7 +1011,8 @@ static void do_material_tex(GPUShadeInput *shi)
                                }
 
                                if(tex->type==TEX_IMAGE)
-                                       if(mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+                                       if((mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) &&
+                                          !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT)))
                                                GPU_link(mat, "srgb_to_linearrgb", tcol, &tcol);
                                
                                if(mtex->mapto & MAP_COL) {
@@ -1363,7 +1364,8 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
                GPU_link(mat, "shade_alpha_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined);
        }
 
-       if(mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+       if((mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) &&
+          !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT)))
                GPU_link(mat, "linearrgb_to_srgb", shr->combined, &shr->combined);
 }
 
index b3d66e61f3db92196f7bf4276824c171bba44a44..962fc7d46c24e887dc58b7e1c3cce05ee012cb12 100644 (file)
@@ -497,6 +497,7 @@ typedef struct GameData {
 #define GAME_IGNORE_DEPRECATION_WARNINGS       (1 << 12)
 #define GAME_ENABLE_ANIMATION_RECORD           (1 << 13)
 #define GAME_SHOW_MOUSE                                                (1 << 14)
+#define GAME_GLSL_NO_COLOR_MANAGEMENT          (1 << 15)
 
 /* GameData.matmode */
 #define GAME_MAT_TEXFACE       0
index acb0ffa3be2e853018fd81c41014533806f51389..0b4d5ccbbfc7234762fb438ca070fb4e66689080 100644 (file)
@@ -1909,6 +1909,11 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering");
        RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
+       prop= RNA_def_property(srna, "use_glsl_color_management", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_COLOR_MANAGEMENT);
+       RNA_def_property_ui_text(prop, "GLSL Color Management", "Use color management for GLSL rendering");
+       RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
+
        prop= RNA_def_property(srna, "use_glsl_extra_textures", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX);
        RNA_def_property_ui_text(prop, "GLSL Extra Textures", "Use extra textures like normal or specular maps for GLSL rendering");