2

I have a problem animating a Toon object. I generated the material with a "Texture Coordinate" - "Dot Product" - "ColorRamp" and "Emission". (https://blender.stackexchange.com/a/86182/48525) If you animate the object with the toon material, light and shadow move along like a texture. (see below) http://g-stalterei.de/blender/B100CS_problem.gif

The Blend File: http://g-stalterei.de/blender/B100CS_problem.blend

Can I prevent this by animating the object from the "Texture Coordinate"? Or is there an easier way to generate a toon material in this look (just with lights and shadows)?

Thanks for your help!

Vegism
  • 21
  • 1

2 Answers2

1

The 'Normal' output of the Texture Coordinate node is in the Object Space of the shaded object. The 'Object' output defaults to the space of the shaded object, but can be overridden to another object's space, using the 'Object' field at the bottom of the node.

We need the dot-product of the direction of the normal at the shading point in World Space, and the vector from the lamp-object to the shading point, also in World Space (which is the normalized position of the shading point in the lamp-object's space, if the lamp-object is not rotated or scaled non-uniformly).

It's also nice to map the full range of the possible dot-product results from (-1,1) to (0,1) to feed the color ramp.

So this is a possible setup, with the rotations and scales of whatever object you are using as a lamp locked off to (0,0,0).

enter image description here

..with this sort of result:

enter image description here

Robin Betts
  • 76,260
  • 8
  • 77
  • 190
0

I don't know if this is an ideal solution, but in the answer that you linked he mentions parenting the light to the object so that it will rotate with the object. This will stop the shadow from moving.

-snaok

eh-five
  • 115
  • 9