diff options
Diffstat (limited to 'intern/cycles/kernel/shaders/node_geometry.osl')
-rw-r--r-- | intern/cycles/kernel/shaders/node_geometry.osl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/intern/cycles/kernel/shaders/node_geometry.osl b/intern/cycles/kernel/shaders/node_geometry.osl index 7bef2051865..b0bd7692489 100644 --- a/intern/cycles/kernel/shaders/node_geometry.osl +++ b/intern/cycles/kernel/shaders/node_geometry.osl @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License + * limitations under the License. */ #include "stdosl.h" @@ -26,7 +26,8 @@ shader node_geometry( output normal TrueNormal = normal(0.0, 0.0, 0.0), output vector Incoming = vector(0.0, 0.0, 0.0), output point Parametric = point(0.0, 0.0, 0.0), - output float Backfacing = 0.0) + output float Backfacing = 0.0, + output float Pointiness = 0.0) { Position = P; Normal = NormalIn; @@ -49,7 +50,7 @@ shader node_geometry( /* try to create spherical tangent from generated coordinates */ if (getattribute("geom:generated", generated)) { - normal data = normal(-(generated[1]-0.5), (generated[0]-0.5), 0.0); + normal data = normal(-(generated[1] - 0.5), (generated[0] - 0.5), 0.0); vector T = transform("object", "world", data); Tangent = cross(Normal, normalize(cross(T, Normal))); } @@ -57,5 +58,13 @@ shader node_geometry( /* otherwise use surface derivatives */ Tangent = normalize(dPdu); } + + getattribute("geom:pointiness", Pointiness); + if (bump_offset == "dx") { + Pointiness += Dx(Pointiness); + } + else if (bump_offset == "dy") { + Pointiness += Dy(Pointiness); + } } |