From 023a7fada8b1c675d02a50bcc665c5e5b9d71b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 19 Aug 2019 20:33:17 +0200 Subject: Eevee: Use manual derivatives for better quality bump. We basically duplicate the height map branch plugged into the bump node, and tag each node in each branch as dx/dy/ref using `branch_tag`. Then we add a one pixel offset on the texture coordinates if the node is tagged as dx or dy. The dx/dy branches are plugged into (new) hidden sockets on the bump node. This match cycles bump better but have a performance impact. Also, complex nodetrees can now become instruction limited and not compile anymore. Reviewers: brecht Differential Revision: https://developer.blender.org/D5531 --- .../shaders/material/gpu_shader_material_bump.glsl | 25 +++++-- source/blender/makesdna/DNA_node_types.h | 3 +- source/blender/nodes/shader/node_shader_tree.c | 79 +++++++++++++++++++--- source/blender/nodes/shader/node_shader_util.c | 24 +++++++ source/blender/nodes/shader/node_shader_util.h | 6 ++ .../blender/nodes/shader/nodes/node_shader_bump.c | 35 +++------- .../nodes/shader/nodes/node_shader_tex_brick.c | 10 +-- .../nodes/shader/nodes/node_shader_tex_checker.c | 6 +- .../nodes/shader/nodes/node_shader_tex_coord.c | 24 ++++--- .../shader/nodes/node_shader_tex_environment.c | 1 + .../nodes/shader/nodes/node_shader_tex_gradient.c | 6 +- .../nodes/shader/nodes/node_shader_tex_image.c | 1 + .../nodes/shader/nodes/node_shader_tex_magic.c | 6 +- .../nodes/shader/nodes/node_shader_tex_musgrave.c | 6 +- .../nodes/shader/nodes/node_shader_tex_noise.c | 5 +- .../nodes/shader/nodes/node_shader_tex_voronoi.c | 6 +- .../nodes/shader/nodes/node_shader_tex_wave.c | 6 +- 17 files changed, 159 insertions(+), 90 deletions(-) (limited to 'source') diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl index 1137e5acdc6..fabc070b0bc 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl @@ -1,5 +1,22 @@ -void node_bump( - float strength, float dist, float height, vec3 N, vec3 surf_pos, float invert, out vec3 result) +void dfdx_v3(vec3 v, out vec3 dy) +{ + dy = v + abs(dFdx(v)); +} + +void dfdy_v3(vec3 v, out vec3 dy) +{ + dy = v + abs(dFdy(v)); +} + +void node_bump(float strength, + float dist, + float height, + float height_dx, + float height_dy, + vec3 N, + vec3 surf_pos, + float invert, + out vec3 result) { N = mat3(ViewMatrix) * normalize(N); dist *= gl_FrontFacing ? invert : -invert; @@ -14,8 +31,8 @@ void node_bump( /* Compute surface gradient and determinant. */ float det = dot(dPdx, Rx); - float dHdx = dFdx(height); - float dHdy = dFdy(height); + float dHdx = height_dx - height; + float dHdy = height_dy - height; vec3 surfgrad = dHdx * Rx + dHdy * Ry; strength = max(strength, 0.0); diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index ee5e9a13f66..6d2b278472f 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -276,7 +276,8 @@ typedef struct bNode { short preview_xsize, preview_ysize; /** Used at runtime when going through the tree. Initialize before use. */ short tmp_flag; - char _pad2[2]; + /** Used at runtime to tag derivatives branches. EEVEE only. */ + short branch_tag; /** Runtime during drawing. */ struct uiBlock *block; diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 41f13087f67..a21ed6aa4cc 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -713,19 +713,22 @@ static bool ntree_branch_count_and_tag_nodes(bNode *fromnode, return true; } -static void ntree_shader_copy_branch_displacement(bNodeTree *ntree, - bNode *displacement_node, - bNodeSocket *displacement_socket, - bNodeLink *displacement_link) +/* Create a copy of a branch starting from a given node. + * callback is executed once for every copied node. + * Returns input node copy. */ +static bNode *ntree_shader_copy_branch(bNodeTree *ntree, + bNode *start_node, + void (*callback)(bNode *node, int user_data), + int user_data) { /* Init tmp flag. */ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { node->tmp_flag = -1; } /* Count and tag all nodes inside the displacement branch of the tree. */ - displacement_node->tmp_flag = 0; + start_node->tmp_flag = 0; int node_count = 1; - nodeChainIter(ntree, displacement_node, ntree_branch_count_and_tag_nodes, &node_count, true); + nodeChainIter(ntree, start_node, ntree_branch_count_and_tag_nodes, &node_count, true); /* Make a full copy of the branch */ bNode **nodes_copy = MEM_mallocN(sizeof(bNode *) * node_count, __func__); LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { @@ -755,15 +758,30 @@ static void ntree_shader_copy_branch_displacement(bNodeTree *ntree, nodeAddLink(ntree, fromnode, fromsock, tonode, tosock); } } + /* Per node callback. */ + if (callback) { + for (int i = 0; i < node_count; i++) { + callback(nodes_copy[i], user_data); + } + } + bNode *start_node_copy = nodes_copy[start_node->tmp_flag]; + MEM_freeN(nodes_copy); + return start_node_copy; +} + +static void ntree_shader_copy_branch_displacement(bNodeTree *ntree, + bNode *displacement_node, + bNodeSocket *displacement_socket, + bNodeLink *displacement_link) +{ /* Replace displacement socket/node/link. */ bNode *tonode = displacement_link->tonode; bNodeSocket *tosock = displacement_link->tosock; - displacement_node = nodes_copy[displacement_node->tmp_flag]; + displacement_node = ntree_shader_copy_branch(ntree, displacement_node, NULL, 0); displacement_socket = ntree_shader_node_find_output(displacement_node, displacement_socket->identifier); nodeRemLink(ntree, displacement_link); nodeAddLink(ntree, displacement_node, displacement_socket, tonode, tosock); - MEM_freeN(nodes_copy); ntreeUpdateTree(G.main, ntree); } @@ -838,6 +856,47 @@ static void ntree_shader_relink_displacement(bNodeTree *ntree, bNode *output_nod ntreeUpdateTree(G.main, ntree); } +static void node_tag_branch_as_derivative(bNode *node, int dx) +{ + if (dx) { + node->branch_tag = 1; + } + else { + node->branch_tag = 2; + } +} + +static bool ntree_shader_bump_branches(bNode *UNUSED(fromnode), + bNode *tonode, + void *userdata, + const bool UNUSED(reversed)) +{ + bNodeTree *ntree = (bNodeTree *)userdata; + + if (tonode->type == SH_NODE_BUMP) { + bNodeSocket *height_dx_sock, *height_dy_sock, *bump_socket, *bump_dx_socket, *bump_dy_socket; + bNode *bump = tonode; + bump_socket = ntree_shader_node_find_input(bump, "Height"); + bump_dx_socket = ntree_shader_node_find_input(bump, "Height_dx"); + bump_dy_socket = ntree_shader_node_find_input(bump, "Height_dy"); + if (bump_dx_socket->link) { + /* Avoid reconnecting the same bump twice. */ + } + else if (bump_socket && bump_socket->link) { + bNodeLink *link = bump_socket->link; + bNode *height = link->fromnode; + bNode *height_dx = ntree_shader_copy_branch(ntree, height, node_tag_branch_as_derivative, 1); + bNode *height_dy = ntree_shader_copy_branch(ntree, height, node_tag_branch_as_derivative, 0); + height_dx_sock = ntree_shader_node_find_output(height_dx, link->fromsock->identifier); + height_dy_sock = ntree_shader_node_find_output(height_dy, link->fromsock->identifier); + nodeAddLink(ntree, height_dx, height_dx_sock, bump, bump_dx_socket); + nodeAddLink(ntree, height_dy, height_dy_sock, bump, bump_dy_socket); + /* We could end iter here, but other bump node could be plugged into other input sockets. */ + } + } + return true; +} + static bool ntree_tag_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *userdata, @@ -925,6 +984,10 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree, */ ntree_shader_relink_displacement(localtree, output); + /* Duplicate bump height branches for manual derivatives. + */ + nodeChainIter(localtree, output, ntree_shader_bump_branches, localtree, true); + /* TODO(fclem): consider moving this to the gpu shader tree evaluation. */ nTreeTags tags = { .ssr_id = 1.0, diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index a2b18b61480..cf58846a051 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -258,6 +258,30 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node } } +void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link) +{ + if (node->branch_tag == 1) { + /* Add one time the value fo derivative to the input vector. */ + GPU_link(mat, "dfdx_v3", *link, link); + } + else if (node->branch_tag == 2) { + /* Add one time the value fo derivative to the input vector. */ + GPU_link(mat, "dfdy_v3", *link, link); + } + else { + /* nothing to do, reference center value. */ + } +} + +void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link) +{ + if (!*link) { + *link = GPU_attribute(CD_ORCO, ""); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), *link, link); + node_shader_gpu_bump_tex_coord(mat, node, link); + } +} + void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index a3c553b983b..9719d0b36f5 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -84,6 +84,12 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns); void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, struct bNodeStack *ns); void node_data_from_gpu_stack(struct bNodeStack *ns, struct GPUNodeStack *gs); +void node_shader_gpu_bump_tex_coord(struct GPUMaterial *mat, + struct bNode *node, + struct GPUNodeLink **link); +void node_shader_gpu_default_tex_coord(struct GPUMaterial *mat, + struct bNode *node, + struct GPUNodeLink **link); void node_shader_gpu_tex_mapping(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c index d17edae35df..384701d2ddf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.c +++ b/source/blender/nodes/shader/nodes/node_shader_bump.c @@ -24,32 +24,17 @@ #include "node_shader_util.h" /* **************** BUMP ******************** */ +/* clang-format off */ static bNodeSocketTemplate sh_node_bump_in[] = { {SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, {SOCK_FLOAT, 1, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_FLOAT, - 1, - N_("Height"), - 1.0f, - 1.0f, - 1.0f, - 1.0f, - -1000.0f, - 1000.0f, - PROP_NONE, - SOCK_HIDE_VALUE}, - {SOCK_VECTOR, - 1, - N_("Normal"), - 0.0f, - 0.0f, - 0.0f, - 1.0f, - -1.0f, - 1.0f, - PROP_NONE, - SOCK_HIDE_VALUE}, - {-1, 0, ""}}; + {SOCK_FLOAT, 1, N_("Height"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE}, + {SOCK_FLOAT, 1, N_("Height_dx"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_UNAVAIL}, + {SOCK_FLOAT, 1, N_("Height_dy"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_UNAVAIL}, + {SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + {-1, 0, ""} +}; +/* clang-format on */ static bNodeSocketTemplate sh_node_bump_out[] = {{SOCK_VECTOR, 0, "Normal"}, {-1, 0, ""}}; @@ -59,8 +44,8 @@ static int gpu_shader_bump(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[3].link) { - GPU_link(mat, "world_normals_get", &in[3].link); + if (!in[5].link) { + GPU_link(mat, "world_normals_get", &in[5].link); } float invert = (node->custom1) ? -1.0 : 1.0; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c index 92ade999650..9c86e78c3cd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c @@ -157,11 +157,7 @@ static int node_shader_gpu_tex_brick(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } - + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexBrick *tex = (NodeTexBrick *)node->storage; float offset_freq = tex->offset_freq; @@ -171,9 +167,9 @@ static int node_shader_gpu_tex_brick(GPUMaterial *mat, "node_tex_brick", in, out, - GPU_constant(&tex->offset), + GPU_uniform(&tex->offset), GPU_constant(&offset_freq), - GPU_constant(&tex->squash), + GPU_uniform(&tex->squash), GPU_constant(&squash_freq)); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c index 9dcb6057589..9b9138802fa 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c @@ -70,11 +70,7 @@ static int node_shader_gpu_tex_checker(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } - + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); return GPU_stack_link(mat, node, "node_tex_checker", in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c index 0e34f2ca9b1..637aeb3c182 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -45,22 +45,24 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, GPUNodeLink *inv_obmat = (ob != NULL) ? GPU_uniform(&ob->imat[0][0]) : GPU_builtin(GPU_INVERSE_OBJECT_MATRIX); + /* TODO only request orco if needed. */ GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, ""); + GPUNodeLink *viewpos = GPU_builtin(GPU_VIEW_POSITION); + GPUNodeLink *worldnor = GPU_builtin(GPU_WORLD_NORMAL); + GPUNodeLink *texcofacs = GPU_builtin(GPU_CAMERA_TEXCO_FACTORS); GPU_link(mat, "generated_from_orco", orco, &orco); - return GPU_stack_link(mat, - node, - "node_tex_coord", - in, - out, - GPU_builtin(GPU_VIEW_POSITION), - GPU_builtin(GPU_WORLD_NORMAL), - inv_obmat, - GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), - orco, - mtface); + GPU_stack_link( + mat, node, "node_tex_coord", in, out, viewpos, worldnor, inv_obmat, texcofacs, orco, mtface); + + /* for each output. */ + for (int i = 0; sh_node_tex_coord_out[i].type != -1; i++) { + node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); + } + + return 1; } /* node type definition */ 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 a02262950a8..6c380efe0b2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -75,6 +75,7 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, if (!in[0].link) { GPU_link(mat, "node_tex_environment_texco", GPU_builtin(GPU_VIEW_POSITION), &in[0].link); + node_shader_gpu_bump_tex_coord(mat, node, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c index 9271ba72a05..7f266c06a1b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -68,11 +68,7 @@ static int node_shader_gpu_tex_gradient(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } - + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexGradient *tex = (NodeTexGradient *)node->storage; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index 5eaf09659d8..a6dfb2636fc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -118,6 +118,7 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, if (!*texco) { *texco = GPU_attribute(CD_MTFACE, ""); + node_shader_gpu_bump_tex_coord(mat, node, texco); } node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c index f5dc0435f27..d51594e549d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -73,11 +73,7 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, NodeTexMagic *tex = (NodeTexMagic *)node->storage; float depth = tex->depth; - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } - + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); return GPU_stack_link(mat, node, "node_tex_magic", in, out, GPU_constant(&depth)); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c index 250a1da3c23..1a959b8faa8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -74,11 +74,7 @@ static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } - + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexMusgrave *tex = (NodeTexMusgrave *)node->storage; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c index 8c35591d112..0b3b249c3d9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c @@ -72,10 +72,7 @@ static int node_shader_gpu_tex_noise(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexNoise *tex = (NodeTexNoise *)node->storage; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c index e0b4de985d8..7000a8a6dae 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -72,11 +72,7 @@ static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } - + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c index 65b78f2923d..b525f4897a9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -72,11 +72,7 @@ static int node_shader_gpu_tex_wave(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); - } - + node_shader_gpu_default_tex_coord(mat, node, &in[0].link); node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexWave *tex = (NodeTexWave *)node->storage; -- cgit v1.2.3