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:
authorTon Roosendaal <ton@blender.org>2009-05-26 17:46:08 +0400
committerTon Roosendaal <ton@blender.org>2009-05-26 17:46:08 +0400
commit33304d022d7f43eb1319fe7e9db33ec6559c275d (patch)
treeb348b506905458c142ebd4a27cb9d681fb96ecdb /source
parent137b3e1dc519bef99bad4201e9374346877bbe40 (diff)
Bugfix #18801
Third transparent shadow bug... this time it's a Material Node, which has mirror + transp-shadow on, and when it traces its own material it enters an eternal loop... Raytracing + shading + materialnode combo really needs work!
Diffstat (limited to 'source')
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_material.c2
-rw-r--r--source/blender/render/extern/include/RE_shader_ext.h1
-rw-r--r--source/blender/render/intern/source/rayshade.c4
3 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/intern/SHD_nodes/SHD_material.c
index c0a2534ac4a..69c2c0a345c 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_material.c
@@ -130,7 +130,9 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
nodestack_get_vec(&shi->translucency, SOCK_VALUE, in[MAT_IN_TRANSLUCENCY]);
}
+ shi->nodes= 1; /* temp hack to prevent trashadow recursion */
node_shader_lamp_loop(shi, &shrnode); /* clears shrnode */
+ shi->nodes= 0;
/* write to outputs */
if(node->custom1 & SH_NODE_MAT_DIFF) {
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index 2cee2673a26..0ad48fe97a9 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -171,6 +171,7 @@ typedef struct ShadeInput
/* from initialize, part or renderlayer */
short do_preview; /* for nodes, in previewrender */
short thread, sample; /* sample: ShadeSample array index */
+ short nodes; /* indicate node shading, temp hack to prevent recursion */
unsigned int lay;
int layflag, passflag, combinedflag;
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index f4dcbe9e186..75b9557f337 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -263,7 +263,8 @@ static void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
shade_input_set_shade_texco(shi);
if(is->mode==RE_RAY_SHADOW_TRA) {
- if(shi->mat->nodetree && shi->mat->use_nodes) {
+ /* temp hack to prevent recursion */
+ if(shi->nodes==0 && shi->mat->nodetree && shi->mat->use_nodes) {
ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
shi->mat= vlr->mat; /* shi->mat is being set in nodetree */
}
@@ -1299,6 +1300,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int
shi.xs= origshi->xs;
shi.ys= origshi->ys;
shi.lay= origshi->lay;
+ shi.nodes= origshi->nodes;
shade_ray(is, &shi, &shr);
if (traflag & RAY_TRA)