[Bf-blender-cvs] [c39555c] cycles-ptex-49: Fix Ptex bump coordinates in Cycles
Nicholas Bishop
noreply at git.blender.org
Tue Feb 10 15:33:44 CET 2015
Commit: c39555c01fbc8d31c38fc5177ca1202b71371e88
Author: Nicholas Bishop
Date: Tue Feb 10 15:24:53 2015 +0100
Branches: cycles-ptex-49
https://developer.blender.org/rBc39555c01fbc8d31c38fc5177ca1202b71371e88
Fix Ptex bump coordinates in Cycles
===================================================================
M intern/cycles/kernel/svm/svm_image.h
M intern/cycles/render/nodes.cpp
===================================================================
diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h
index a3c33ae..f168f69 100644
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@ -400,9 +400,6 @@ ccl_device void svm_node_tex_image(KernelGlobals *kg, ShaderData *sd, float *sta
f = make_float4(1.0f, 0.0f, 1.0f, 1.0f);
}
else if (srgb & 2) {
- kernel_assert(co.x >= 0 && co.x <= 1);
- kernel_assert(co.y >= 0 && co.y <= 1);
-
// TODO: test hacks for Ptex
uint face_id = (uint)(co.z + 0.5f);
uint offset = kernel_tex_fetch(__ptex_table, id - /* TODO */ 1024);
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index b74cb87..c572cdd 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -437,6 +437,19 @@ void PtexTextureNode::attributes(Shader *shader, AttributeRequestSet *attributes
ShaderNode::attributes(shader, attributes);
}
+static NodeType node_attr_from_bump(const ShaderBump bump)
+{
+ if(bump == SHADER_BUMP_DX) {
+ return NODE_ATTR_BUMP_DX;
+ }
+ else if(bump == SHADER_BUMP_DY) {
+ return NODE_ATTR_BUMP_DY;
+ }
+ else {
+ return NODE_ATTR;
+ }
+}
+
void PtexTextureNode::compile(SVMCompiler& compiler)
{
ShaderInput *layer_in = input("Layer");
@@ -449,8 +462,9 @@ void PtexTextureNode::compile(SVMCompiler& compiler)
{
int attr = compiler.attribute(ATTR_STD_PTEX_UV);
compiler.stack_assign(vector_in);
- compiler.add_node(NODE_ATTR, attr, vector_in->stack_offset,
- NODE_ATTR_FLOAT3);
+
+ compiler.add_node(node_attr_from_bump(bump), attr,
+ vector_in->stack_offset, NODE_ATTR_FLOAT3);
}
image_manager = compiler.image_manager;
More information about the Bf-blender-cvs
mailing list