diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-02 12:25:40 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-02 12:25:40 +0400 |
commit | b8d822eb354a593584aa382d716cec8dd197aeb8 (patch) | |
tree | 35a3464547bd8a7dc174cc1f0e2bbea8afea6bc8 /intern/cycles | |
parent | 82fc3319599b9c03ae37f09afc826fed7188df8b (diff) |
Fix performance issue in OSL geometry node, compiler fails to optimize out the
tangent computation, tweaked the code so this works.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/shaders/node_geometry.osl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/intern/cycles/kernel/shaders/node_geometry.osl b/intern/cycles/kernel/shaders/node_geometry.osl index 3940b98eec1..5a784f951bb 100644 --- a/intern/cycles/kernel/shaders/node_geometry.osl +++ b/intern/cycles/kernel/shaders/node_geometry.osl @@ -51,7 +51,12 @@ shader node_geometry( /* try to create spherical tangent from generated coordinates */ if (getattribute("geom:generated", generated)) { - vector T = vector(-(generated[1] - 0.5), (generated[0] - 0.5), 0.0); + matrix project = matrix(0.0, 1.0, 0.0, 0.0, + -1.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.5, -0.5, 0.0, 1.0); + + vector T = transform(project, generated); T = transform("object", "world", T); Tangent = cross(Normal, normalize(cross(T, Normal))); } |