diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-21 20:19:31 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-27 11:36:30 +0300 |
commit | df07a25d2811c43648af3e9bf4cc44d255218d65 (patch) | |
tree | 9d2aa5889b536f3e5c706b57f4fd2b551e3bb66d /intern/cycles/kernel/shaders/node_texture_coordinate.osl | |
parent | ddc0d280311a442bb90790e7421d64ed60136d0d (diff) |
Cycles: Support texture coordinate from another object
This is the same as blender internal's texture mapping from another object,
so this way it's possible to control texture space of one object by another.
Quite straightforward change apart from the workaround for the stupidness of
the dependency graph. Now shader has flag telling that it depends on object
transform. This is the simplest way to know which shaders needs to be tagged
for update when object changes. This might give some false-positive tags now
but reducing them should not be priority for Cycles and rather be a priority
to bring new dependency graph.
Also GLSL preview does not support using other object for mapping.
This is actually correct for BI shading as well and to be addressed as
a part of general GLSL viewport improvements since it's not really clear
how to support this in GLSL.
Reviewers: brecht, juicyfruit
Subscribers: eyecandy, venomgfx
Differential Revision: https://developer.blender.org/D1021
Diffstat (limited to 'intern/cycles/kernel/shaders/node_texture_coordinate.osl')
-rw-r--r-- | intern/cycles/kernel/shaders/node_texture_coordinate.osl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/intern/cycles/kernel/shaders/node_texture_coordinate.osl b/intern/cycles/kernel/shaders/node_texture_coordinate.osl index f8a6f787288..9e2109fa082 100644 --- a/intern/cycles/kernel/shaders/node_texture_coordinate.osl +++ b/intern/cycles/kernel/shaders/node_texture_coordinate.osl @@ -21,7 +21,9 @@ shader node_texture_coordinate( int is_background = 0, int is_volume = 0, int from_dupli = 0, + int use_transform = 0, string bump_offset = "center", + matrix object_itfm = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), output point Generated = point(0.0, 0.0, 0.0), output point UV = point(0.0, 0.0, 0.0), @@ -60,7 +62,12 @@ shader node_texture_coordinate( getattribute("geom:uv", UV); } - Object = transform("object", P); + if (use_transform) { + Object = transform(object_itfm, P); + } + else { + Object = transform("object", P); + } Camera = transform("camera", P); Window = transform("NDC", P); Normal = transform("world", "object", NormalIn); |