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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-03-08 23:52:58 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-03-08 23:52:58 +0400
commit9b8dae71a5e0f5cccb4031dbe5f07aae01744c82 (patch)
tree8a575ab4a9e6835eef2175209ee323df883fd0ac /source
parent0f3e1821eae40c7cebfcf199b58370971b57fa35 (diff)
Cycles: support for environment texture "Mirror Ball" projection mode, next to
existing "Equirectangular". This projection is useful to create light probes from a chrome ball placed in a real scene. It expects as input a photograph of the chrome ball, cropped so the ball just fits inside the image boundaries. Example setup with panorama camera and mixing two (poor quality) photographs from different viewpoints to avoid stretching and hide the photographer: http://www.pasteall.org/pic/28036
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_node/drawnode.c10
-rw-r--r--source/blender/makesdna/DNA_node_types.h6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c13
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c1
4 files changed, 27 insertions, 3 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index bc22e668b5a..64af846a79b 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1093,6 +1093,14 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
}
+
+static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
+ uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
+ uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
+}
+
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "sun_direction", 0, "", ICON_NONE);
@@ -1225,7 +1233,7 @@ static void node_shader_set_butfunc(bNodeType *ntype)
ntype->uifunc= node_shader_buts_tex_image;
break;
case SH_NODE_TEX_ENVIRONMENT:
- ntype->uifunc= node_shader_buts_tex_image;
+ ntype->uifunc= node_shader_buts_tex_environment;
break;
case SH_NODE_TEX_GRADIENT:
ntype->uifunc= node_shader_buts_tex_gradient;
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 0d309aad36c..dbb3f6bfc66 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -475,7 +475,7 @@ typedef struct NodeTexChecker {
typedef struct NodeTexEnvironment {
NodeTexBase base;
- int color_space, pad;
+ int color_space, projection;
} NodeTexEnvironment;
typedef struct NodeTexGradient {
@@ -585,6 +585,10 @@ typedef struct TexNodeOutput {
#define SHD_COLORSPACE_NONE 0
#define SHD_COLORSPACE_COLOR 1
+/* environment texture */
+#define SHD_PROJ_EQUIRECTANGULAR 0
+#define SHD_PROJ_MIRROR_BALL 1
+
/* blur node */
#define CMP_NODE_BLUR_ASPECT_NONE 0
#define CMP_NODE_BLUR_ASPECT_Y 1
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 2caf1f06585..d3a2e406992 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1268,6 +1268,11 @@ static void def_sh_tex_environment(StructRNA *srna)
{SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data", "Image contains non-color data, for example a displacement or normal map, and will not be converted"},
{0, NULL, 0, NULL, NULL}};
+ static const EnumPropertyItem prop_projection_items[] = {
+ {SHD_PROJ_EQUIRECTANGULAR, "EQUIRECTANGULAR", 0, "Equirectangular", "Equirectangular or latitude-longitude projection"},
+ {SHD_PROJ_MIRROR_BALL, "MIRROR_BALL", 0, "Mirror Ball", "Projection from an orthographic photo of a mirror ball"},
+ {0, NULL, 0, NULL, NULL}};
+
PropertyRNA *prop;
prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
@@ -1277,13 +1282,19 @@ static void def_sh_tex_environment(StructRNA *srna)
RNA_def_property_ui_text(prop, "Image", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_update");
- RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
def_sh_tex(srna);
prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_color_space_items);
RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_projection_items);
+ RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
}
static void def_sh_tex_image(StructRNA *srna)
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
index d6957e53f10..8ecff6e3767 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -45,6 +45,7 @@ static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode* no
default_tex_mapping(&tex->base.tex_mapping);
default_color_mapping(&tex->base.color_mapping);
tex->color_space = SHD_COLORSPACE_COLOR;
+ tex->projection = SHD_PROJ_EQUIRECTANGULAR;
node->storage = tex;
}