Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2014-01-03 01:05:07 +0400
committerDalai Felinto <dfelinto@gmail.com>2014-05-03 04:19:08 +0400
commit97641a0ec946005d9a042f075697109c6590a28d (patch)
tree7661e462d6426298453d1f5ddd6b7e2ffb74ed65 /source/blender/makesdna/DNA_scene_types.h
parent3312b20ac8c8a5e45d87c5c1f59ce0907350d398 (diff)
Bake API - bpy.ops.object.bake()
New operator that can calls a bake function to the current render engine when available. This commit provides no feature for the users, but allows external engines to be accessed by the operator and be integrated with the baking api. The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an array of floats with the result. The Blender Internal (and multires) system is still running independent, but we eventually will pipe it through the API as well. Cycles baking will come next as a separated commit Python Operator: ---------------- The operator can be called with some arguments, or a user interface can be created for it. In that case the arguments can be ommited and the interface can expose the settings from bpy.context.scene.render.bake bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_split_materials=False, use_automatic_name=False) Note: external save mode is currently disabled. Supported Features: ------------------ * Margin - Baked result is extended this many pixels beyond the border of each UV "island," to soften seams in the texture. * Selected to Active - bake shading on the surface of selected object to the active object. The rays are cast from the lowpoly object inwards towards the highpoly object. If the highpoly object is not entirely involved by the lowpoly object, you can tweak the rays start point with Cage Extrusion. For even more control of the cage you can use a Cage object. * Cage Extrusion - distance to use for the inward ray cast when using selected to active * Custom Cage - object to use as cage (instead of the lowpoly object). * Normal swizzle - change the axis that gets mapped to RGB * Normal space - save as tangent or object normal spaces Supported Passes: ----------------- Any pass that is supported by Blender renderlayer system. Though it's up to the external engine to provide a valid enum with its supported passes. Normal passes get a special treatment since we post-process them to converted and "swizzled" Development Notes for External Engines: --------------------------------------- (read them in bake_api.c) * For a complete implementation example look at the Cycles Bake commit (next). Review: D421 Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge Normal map pipeline "consulting" by Andy Davies (metalliandy) Original design by Brecht van Lommel. The entire commit history can be found on the branch: bake-cycles
Diffstat (limited to 'source/blender/makesdna/DNA_scene_types.h')
-rw-r--r--source/blender/makesdna/DNA_scene_types.h105
1 files changed, 74 insertions, 31 deletions
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 5a47e76b4f9..ceb938c3af2 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -210,37 +210,39 @@ typedef struct SceneRenderLayer {
#define SCE_LAY_NEG_ZMASK 0x80000
/* srl->passflag */
-#define SCE_PASS_COMBINED (1<<0)
-#define SCE_PASS_Z (1<<1)
-#define SCE_PASS_RGBA (1<<2)
-#define SCE_PASS_DIFFUSE (1<<3)
-#define SCE_PASS_SPEC (1<<4)
-#define SCE_PASS_SHADOW (1<<5)
-#define SCE_PASS_AO (1<<6)
-#define SCE_PASS_REFLECT (1<<7)
-#define SCE_PASS_NORMAL (1<<8)
-#define SCE_PASS_VECTOR (1<<9)
-#define SCE_PASS_REFRACT (1<<10)
-#define SCE_PASS_INDEXOB (1<<11)
-#define SCE_PASS_UV (1<<12)
-#define SCE_PASS_INDIRECT (1<<13)
-#define SCE_PASS_MIST (1<<14)
-#define SCE_PASS_RAYHITS (1<<15)
-#define SCE_PASS_EMIT (1<<16)
-#define SCE_PASS_ENVIRONMENT (1<<17)
-#define SCE_PASS_INDEXMA (1<<18)
-#define SCE_PASS_DIFFUSE_DIRECT (1<<19)
-#define SCE_PASS_DIFFUSE_INDIRECT (1<<20)
-#define SCE_PASS_DIFFUSE_COLOR (1<<21)
-#define SCE_PASS_GLOSSY_DIRECT (1<<22)
-#define SCE_PASS_GLOSSY_INDIRECT (1<<23)
-#define SCE_PASS_GLOSSY_COLOR (1<<24)
-#define SCE_PASS_TRANSM_DIRECT (1<<25)
-#define SCE_PASS_TRANSM_INDIRECT (1<<26)
-#define SCE_PASS_TRANSM_COLOR (1<<27)
-#define SCE_PASS_SUBSURFACE_DIRECT (1<<28)
-#define SCE_PASS_SUBSURFACE_INDIRECT (1<<29)
-#define SCE_PASS_SUBSURFACE_COLOR (1<<30)
+typedef enum ScenePassType {
+ SCE_PASS_COMBINED = (1 << 0),
+ SCE_PASS_Z = (1 << 1),
+ SCE_PASS_RGBA = (1 << 2),
+ SCE_PASS_DIFFUSE = (1 << 3),
+ SCE_PASS_SPEC = (1 << 4),
+ SCE_PASS_SHADOW = (1 << 5),
+ SCE_PASS_AO = (1 << 6),
+ SCE_PASS_REFLECT = (1 << 7),
+ SCE_PASS_NORMAL = (1 << 8),
+ SCE_PASS_VECTOR = (1 << 9),
+ SCE_PASS_REFRACT = (1 << 10),
+ SCE_PASS_INDEXOB = (1 << 11),
+ SCE_PASS_UV = (1 << 12),
+ SCE_PASS_INDIRECT = (1 << 13),
+ SCE_PASS_MIST = (1 << 14),
+ SCE_PASS_RAYHITS = (1 << 15),
+ SCE_PASS_EMIT = (1 << 16),
+ SCE_PASS_ENVIRONMENT = (1 << 17),
+ SCE_PASS_INDEXMA = (1 << 18),
+ SCE_PASS_DIFFUSE_DIRECT = (1 << 19),
+ SCE_PASS_DIFFUSE_INDIRECT = (1 << 20),
+ SCE_PASS_DIFFUSE_COLOR = (1 << 21),
+ SCE_PASS_GLOSSY_DIRECT = (1 << 22),
+ SCE_PASS_GLOSSY_INDIRECT = (1 << 23),
+ SCE_PASS_GLOSSY_COLOR = (1 << 24),
+ SCE_PASS_TRANSM_DIRECT = (1 << 25),
+ SCE_PASS_TRANSM_INDIRECT = (1 << 26),
+ SCE_PASS_TRANSM_COLOR = (1 << 27),
+ SCE_PASS_SUBSURFACE_DIRECT = (1 << 28),
+ SCE_PASS_SUBSURFACE_INDIRECT = (1 << 29),
+ SCE_PASS_SUBSURFACE_COLOR = (1 << 30),
+} ScenePassType;
/* note, srl->passflag is treestore element 'nr' in outliner, short still... */
@@ -358,6 +360,42 @@ typedef struct ImageFormatData {
/* ImageFormatData.cineon_flag */
#define R_IMF_CINEON_FLAG_LOG (1<<0) /* was R_CINEON_LOG */
+typedef struct BakeData {
+ struct ImageFormatData im_format;
+
+ char filepath[1024]; /* FILE_MAX */
+
+ short width, height;
+ short margin, flag;
+
+ float cage_extrusion;
+ float pad2;
+
+ char normal_swizzle[3];
+ char normal_space;
+
+ char save_mode;
+ char pad[3];
+
+ char cage[64]; /* MAX_NAME */
+} BakeData;
+
+/* (char) normal_swizzle */
+typedef enum BakeNormalSwizzle {
+ R_BAKE_POSX = 0,
+ R_BAKE_POSY = 1,
+ R_BAKE_POSZ = 2,
+ R_BAKE_NEGX = 3,
+ R_BAKE_NEGY = 4,
+ R_BAKE_NEGZ = 5,
+} BakeNormalSwizzle;
+
+/* (char) save_mode */
+typedef enum BakeSaveMode {
+ R_BAKE_SAVE_INTERNAL = 0,
+ R_BAKE_SAVE_EXTERNAL = 1,
+} BakeSaveMode;
+
/* *************************************************************** */
/* Render Data */
@@ -563,6 +601,9 @@ typedef struct RenderData {
/* render engine */
char engine[32];
+
+ /* Cycles baking */
+ struct BakeData bake;
} RenderData;
/* *************************************************************** */
@@ -1401,6 +1442,8 @@ enum {
#define R_BAKE_LORES_MESH 32
#define R_BAKE_VCOL 64
#define R_BAKE_USERSCALE 128
+#define R_BAKE_SPLIT_MAT 256
+#define R_BAKE_AUTO_NAME 512
/* bake_normal_space */
#define R_BAKE_SPACE_CAMERA 0