additional bake modes
authorM.G. Kishalmi <lmg@kishalmi.net>
Wed, 18 May 2011 07:46:54 +0000 (07:46 +0000)
committerM.G. Kishalmi <lmg@kishalmi.net>
Wed, 18 May 2011 07:46:54 +0000 (07:46 +0000)
 (refined patch #23430)

+ specular color
+ specular intensity
+ mirror color
+ mirror intensity
+ alpha (tranparency)
+ emission (glow)

source/blender/makesrna/intern/rna_scene.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/rendercore.c

index 3a23f649d4864c04796a027586fcd23a5694688d..44dcabe40f956eac3f7ffe3dbf9ac7cc049b1650 100644 (file)
@@ -2005,6 +2005,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
                {RE_BAKE_NORMALS, "NORMALS", 0, "Normals", "Bake normals"},
                {RE_BAKE_TEXTURE, "TEXTURE", 0, "Textures", "Bake textures"},
                {RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Bake displacement"},
+               {RE_BAKE_EMIT, "EMIT", 0, "Emission", "Bake Emit values (glow)"},
+               {RE_BAKE_ALPHA, "ALPHA", 0, "Alpha", "Bake Alpha values (transparency)"},
+               {RE_BAKE_MIRROR_INTENSITY, "MIRROR_INTENSITY", 0, "Mirror Intensity", "Bake Mirror values"},
+               {RE_BAKE_MIRROR_COLOR, "MIRROR_COLOR", 0, "Mirror Colors", "Bake Mirror colors"},
+               {RE_BAKE_SPEC_INTENSITY, "SPEC_INTENSITY", 0, "Specular Intensity", "Bake Specular values"},
+               {RE_BAKE_SPEC_COLOR, "SPEC_COLOR", 0, "Specular Colors", "Bake Specular colors"},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem bake_normal_space_items[] ={
index 145d86575d0dc4ad20dfae4fdd9261e7b6041a0f..47230ab30899ed942a81bcd30c77c0bc7805bfb8 100644 (file)
@@ -250,13 +250,19 @@ float RE_filter_value(int type, float x);
 void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect);
 
 /* shaded view or baking options */
-#define RE_BAKE_LIGHT                  0
-#define RE_BAKE_ALL                            1
-#define RE_BAKE_AO                             2
-#define RE_BAKE_NORMALS                        3
-#define RE_BAKE_TEXTURE                        4
-#define RE_BAKE_DISPLACEMENT   5
-#define RE_BAKE_SHADOW                 6
+#define RE_BAKE_LIGHT                          0       /* not listed in rna_scene.c -> can't be enabled! */
+#define RE_BAKE_ALL                                    1
+#define RE_BAKE_AO                                     2
+#define RE_BAKE_NORMALS                                3
+#define RE_BAKE_TEXTURE                                4
+#define RE_BAKE_DISPLACEMENT           5
+#define RE_BAKE_SHADOW                         6
+#define RE_BAKE_SPEC_COLOR                     7
+#define RE_BAKE_SPEC_INTENSITY         8
+#define RE_BAKE_MIRROR_COLOR           9
+#define RE_BAKE_MIRROR_INTENSITY       10
+#define RE_BAKE_ALPHA                          11
+#define RE_BAKE_EMIT                           12
 
 void RE_Database_Baking(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int type, struct Object *actob);
 
index 7a34fc0af50b8357158d7f12be01e9aac658e17b..bc6c4795f5c02f72fd10b6c275bbb2d68d5602ca 100644 (file)
@@ -2143,7 +2143,9 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int
        
                shade_input_set_shade_texco(shi);
                
-               if(!ELEM3(bs->type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_SHADOW))
+               /* only do AO for a full bake (and obviously AO bakes)
+                       AO for light bakes is a leftover and might not be needed */
+               if( ELEM3(bs->type, RE_BAKE_ALL, RE_BAKE_AO, RE_BAKE_LIGHT))
                        shade_samples_do_AO(ssamp);
                
                if(shi->mat->nodetree && shi->mat->use_nodes) {
@@ -2206,6 +2208,42 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int
                        VECCOPY(shr.combined, shr.shad);
                        shr.alpha = shi->alpha;
                }
+               else if(bs->type==RE_BAKE_SPEC_COLOR) {
+                       shr.combined[0]= shi->specr;
+                       shr.combined[1]= shi->specg;
+                       shr.combined[2]= shi->specb;
+                       shr.alpha = 1.0f;
+               }
+               else if(bs->type==RE_BAKE_SPEC_INTENSITY) {
+                       shr.combined[0]=
+                       shr.combined[1]=
+                       shr.combined[2]= shi->spec;
+                       shr.alpha = 1.0f;
+               }
+               else if(bs->type==RE_BAKE_MIRROR_COLOR) {
+                       shr.combined[0]= shi->mirr;
+                       shr.combined[1]= shi->mirg;
+                       shr.combined[2]= shi->mirb;
+                       shr.alpha = 1.0f;
+               }
+               else if(bs->type==RE_BAKE_MIRROR_INTENSITY) {
+                       shr.combined[0]=
+                       shr.combined[1]=
+                       shr.combined[2]= shi->ray_mirror;
+                       shr.alpha = 1.0f;
+               }
+               else if(bs->type==RE_BAKE_ALPHA) {
+                       shr.combined[0]=
+                       shr.combined[1]=
+                       shr.combined[2]= shi->alpha;
+                       shr.alpha = 1.0f;
+               }
+               else if(bs->type==RE_BAKE_EMIT) {
+                       shr.combined[0]=
+                       shr.combined[1]=
+                       shr.combined[2]= shi->emit;
+                       shr.alpha = 1.0f;
+               }
        }
        
        if(bs->rect_float) {