Fix cycles crash with normal map node, issue with tangent sign attribute.
This commit is contained in:
@@ -302,11 +302,11 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
|
|||||||
|
|
||||||
/* UV tangent */
|
/* UV tangent */
|
||||||
std = (active_render)? ATTR_STD_UV_TANGENT: ATTR_STD_NONE;
|
std = (active_render)? ATTR_STD_UV_TANGENT: ATTR_STD_NONE;
|
||||||
name = ustring((string(name.c_str()) + ".tangent").c_str());
|
name = ustring((string(l->name().c_str()) + ".tangent").c_str());
|
||||||
|
|
||||||
if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
|
if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
|
||||||
std = (active_render)? ATTR_STD_UV_TANGENT_SIGN: ATTR_STD_NONE;
|
std = (active_render)? ATTR_STD_UV_TANGENT_SIGN: ATTR_STD_NONE;
|
||||||
name = ustring((string(name.c_str()) + ".tangent_sign").c_str());
|
name = ustring((string(l->name().c_str()) + ".tangent_sign").c_str());
|
||||||
bool need_sign = (mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std));
|
bool need_sign = (mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std));
|
||||||
|
|
||||||
mikk_compute_tangents(b_mesh, *l, mesh, nverts, need_sign, active_render);
|
mikk_compute_tangents(b_mesh, *l, mesh, nverts, need_sign, active_render);
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ __device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *stac
|
|||||||
int attr_offset = find_attribute(kg, sd, node.z);
|
int attr_offset = find_attribute(kg, sd, node.z);
|
||||||
int attr_sign_offset = find_attribute(kg, sd, node.w);
|
int attr_sign_offset = find_attribute(kg, sd, node.w);
|
||||||
|
|
||||||
if(attr_offset == ATTR_STD_NOT_FOUND || attr_offset == ATTR_STD_NOT_FOUND) {
|
if(attr_offset == ATTR_STD_NOT_FOUND || attr_sign_offset == ATTR_STD_NOT_FOUND) {
|
||||||
stack_store_float3(stack, normal_offset, make_float3(0.0f, 0.0f, 0.0f));
|
stack_store_float3(stack, normal_offset, make_float3(0.0f, 0.0f, 0.0f));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user