Mapping despite of Origin of object


I would like to control a Linear Gradient texture wherever the origin of the object is.

I let you a .blend file where for the 2 objects at the left, it’s the effect I want by changing Z Value of the location but the origins are at the top of the objects.

I don’t use Generated cause I don’t want the Texture to be proportional at the object : if let’s say the white part is 1 Blender unit for the Plane, it should be the same for the Cube.

So, if I can have the effect I have for the 2 left objects on the 2 right objects where the origins are at the bottom. I can’t figure it out with the mapping node.

TEST_mapping.blend (539.8 KB)

I’m not entirely what the goal is, but if you want object coordinates to ignore the origo of the object, you have to reference in a separate object. Try adding an empty and reference it in the texture coordinate node dropdown. You can probably also combine z from empty with x and y from object using separate xyz and combine xyz nodes.

I’m gonna try, thanks. The goal is to control the height of the white part with 2 contraints :

  • starting from the top for every object at the same time
  • same height for every object

I thought it was good but if the problem of origin is solved, the white part doesn’t start to go down at the same time for the 2 objects.

To have what I want, I should combine from Texture Coordinates node “Generated” to get rid of Origin location and “Object” to have the same height for all objects. What’s the way to do this please (if it makes sense to combine this 2 values) ?

The simplest solution is to move the origin of all your objects to the top of their bounding boxes, and use the object coordinates (with applied transformations)… or following CarlG sugestion (case you need the origin for something else), by using empties as an alternative origin.

Doing this with nodes alone is extremely difficult, as we don’t have so many tools to make the necessary transformations from ‘generated’ to ‘object’ coordinates (and it’s a pretty ambiguous transformation also).

Hi, I can’t move the Origin of objects and using empties works only for one object and I would like to have a single material for all objects. As you wrote, perhaps it can’t be done with existing tools in Blender.

Thanks for input.

The only problem is that you don’t have access to the object dimensions in world space, and you need those to scale the ‘generated’ coordinates.
It’s possible to pass the dimensions to the node editor using drivers, but they are locked to a specific object, and therefore you’d need one material per object. :frowning: