I've been trying to find if it is possible to, using some sort of code in animation nodes, translate the position of a texture or the UV mapping to create a bunch of objects with different textures to cut down the amount of work I have to do (at this point I probably would've been done by doing the copy object data method, but I would've had to manually make about 70 some odd materials and cut an object into the same number).

What I was hoping to do was create a list of textures (barring that, a list of coordinate offsets) that would change the texture inside of a shader node instance.

In newnodes' Shader Node Controller I can't seem to control the mapping node (getting the data path of the x/y position of texture comes back as not existing). I also can't control what the name of the texture going into the shader is either.

Node Properties don't exist

I got silly and tried to use Texture Input node to send color to a node that had color as an input in some form, but that just got a single color rather than the whole image.

I assume I would need to make my own script node for this? Or is there anything else I may have missed. And is there any documentation about setting up a script node? I probably need to read more into coding in blender python in general to work with this.

I realize the brute force method to do this simply is to either make my 70+ materials and 70+ objects and copy object data over the instances or even use the mix shader method of setting up the texture mapping for each image in my atlas and use a boolean for all of the values. I'm just trying to find out if there is any way to make this process simpler and easier to update as needed.

As far as I've read Animation Nodes and Sverchok aren't exactly meant for working with textures specifically, but it was something I got curious about while undertaking this small side project.

  • $\begingroup$ You can use Extra-Property option (in N-panel, which gives all nodes of a material) of Shader Controller Node to access "translation" input of mapping node and same with the Image Texture Node. Another thing is, you can read/write/translate/etc UVs with UV Map Data Input/Output nodes, I have recently added new nodes for them. Do you want to assign different textures to different objects or each object has unique texture? $\endgroup$
    – 3DSinghVFX
    Sep 22, 2019 at 5:46
  • $\begingroup$ @3DSinghVFX i'm trying to figure out any solution that will work really. If I can use an individual texture that'd probably be an easier to update solution. I was getting ready to try to place everything on a single texture and cut up a large polygon but if there is a way to avoid that I'm all for it. Is there somewhere with more detailed info about these nodes? I don't seem to see any documentation on how to use them properly. I don't know how to use the Extra-Property option to access what I'm after. $\endgroup$
    – Haledire
    Sep 22, 2019 at 18:51
  • $\begingroup$ Actually... where does Extra-Property give all the nodes of a material? All I see in the N panel is the fact that it's there. Connecting a viewer node only tells me it's a shader node tree with no additional information $\endgroup$
    – Haledire
    Sep 23, 2019 at 2:57
  • $\begingroup$ I just noticed, the version of animation nodes that I had installed didn't have those UV nodes in them. After doing a manual install of the nodes from the repository, I found that this works for what I was trying to set up before with making a large texture atlas and moving the UV. I am still curious about the shader node controller situation though, as I still need to make instances of the materials per object instance to be able to change another property aside the texture (which fortunately I do have working). Ideally I'd like to use the mapping node for a way to ignore the UVs $\endgroup$
    – Haledire
    Sep 23, 2019 at 5:52
  • $\begingroup$ I think it is easier to control one texture for multiple materials just by offsetting the coordinates. You can learn more about Extra-Nodes from youtube.com/3DSinghVFX $\endgroup$
    – 3DSinghVFX
    Sep 23, 2019 at 9:17

1 Answer 1


Note: I have replaced the Shader Controller Node (no longer supported) by new Material Attribute Input/Output Nodes, so I have updated this answer.


Method-1: Offsetting the coordinate in Mapping Node of single texture for different materials: Here, I have made a simple example to use Material Attribute Input/Output Nodes. These nodes are work similar to Object Attribute Input/Output Nodes,

A simple shader Node-tree: enter image description here

AN Node-tree for one object: enter image description here

Now, for multiple objects: I have instanced a cube (with deep copy) and a material then assign them to individual objects by using Object Material Output node in a Loop Node. Then use the same setup of Material Attribute Output Node (mentioned above) to offset coordinates of Mapping Node with Random float node. However, you can use own coordinate list to offset them: enter image description here

Method-1 Blend File:


Method-2: Assigning different textures to different materials: In this method, we need a small script which loads a texture from the specified folder then assign to a material. Here is the script:

import bpy

    bpy.data.materials[material.name].node_tree.nodes['Image Texture'].image = bpy.data.images[image]
    filepath = path + image
    newImage = bpy.data.images.load(filepath)
    bpy.data.materials[material.name].node_tree.nodes['Image Texture'].image = newImage 

and in AN, I have used Script Node to use the script, enter image description here

This script needs three inputs: material, the path to the image folder, and name of the image. Because, we have multiple images, so we going to use Loop Node, here is the setup: enter image description here

Now, for multiple objects: I have instanced a cube (with deep copy) and a material then assign them to individual objects by using Object Material Output node in a Loop Node. Then use the above setup to assign different textures for different materials, enter image description here

Method-2 Blend File:


  • 1
    $\begingroup$ Thanks. This is exactly what I needed. I don't think the setup method for extra properties was in the video but I did watch it before. The image does look familiar though. Maybe I had seen another video about the node and missed the setup process. $\endgroup$
    – Haledire
    Sep 24, 2019 at 13:05
  • $\begingroup$ Actually, this node is still in development due to some changes in Blender API. I'll refine the structure of this node for easy and better usage when the Blender API (mainly for shader nodes) finalized :) $\endgroup$
    – 3DSinghVFX
    Sep 24, 2019 at 16:42
  • $\begingroup$ Update on the situation, well - the method would have worked fine but the image I need to make for an atlas of all the images I'm using is causing some sort of error where sections of the image around the corners are not being loaded (the image is around 7k in size). Not sure why it's happening. Unfortunately it renders the mapping option out. Problem 2: accessing the image name of the shader node simply renames the image rather than loading a different one, so my other option is out. Looks like I have to do this all manually. $\endgroup$
    – Haledire
    Sep 29, 2019 at 22:03
  • $\begingroup$ I have tested with 4k image, offsetting the coordinates in mapping node is working. Maybe there is some other problem. I'll update the question for your second problem soon. I want to mention that I have replaced the Shader Controller Node by Material Attribute Input/Output Nodes which are more easy to use. $\endgroup$
    – 3DSinghVFX
    Sep 30, 2019 at 5:36
  • 1
    $\begingroup$ Thanks, the script works perfectly! I can finally deal with the more data driven parts of the project. I had a feeling I was going to wind up needing a script node in the end, but I have no idea how to make such a script, so this helps me out a lot. $\endgroup$
    – Haledire
    Sep 30, 2019 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .