1
$\begingroup$

I'm working on a material for redistribution, and my node setup uses a single black and white mask with different vector inputs to fake a normal map for a simple embossing/debossing effect.

node setup

The change in the vector input does two things: it takes care of the different positioning of the images, and a blur effect, both required for the normal map.

I'm aiming for ease of use, so I really don't want to make users manually update the image path of every single texture node when they use the material with their own maps.

An alternative solution would be to alter my methodology, but I also want to avoid forcing them to bake true normal maps to use the material because users won't be blender-savvy to know how go from an height map to a normal one. Using the mask for displacement is off the table, since it didn't yield good results with bump alone, and using adaptive subsurf on the model can be very demanding of the users' computers. The effect isn't worth the processing cost.

I found a similar question with an interesting solution, which unfortunately doesn't help me at all because it's generates an this image OR that image output. I need an AND output, something that enables me to have all images outputs simultaneously in the same mesh.

The obvious solution for me would be drivers copying the image path from somewhere else, but no luck there. Then I tried to find a way to modify the mapping after the image texture running it through a third node containing vector and image inputs, but nothing as well.

Ideas?

$\endgroup$
1
$\begingroup$

I may have just invalidated the rest of my answer as I realised you can just edit the Source property of an image from the Node Editor's Properties Shelf (N) when you have an image node selected, which will update all image nodes that share that image:

enter image description here

This is because when you duplicate an image node the image is instanced (shared). When you edit the Source property you are editing a property on an existing image, so the other nodes that use that instanced image see the changes. When you normally browse to a new image you break the connection to the other intances so they don't update.

So, you can inform users that changing the Source property in the Properties Shelf on one image will update all the relevant images, or you can look at my original answer, below, for other solutions.



Original Answer

My suggestion would be to group the Image node within a group, with the Vector as input and the Color and Alpha of the image as output:

enter image description here

Whenever you need to use the same image you add the node group instead:

enter image description here

Obviously, this still doesn't usefully expose the image path to the user, but at least they only have to change the one image (because all other image groups will also update).

You could even place an additional one of these group nodes in a more accessible place in your node tree with instructions that this is where you can change the image (instead of the user having to dig through a particularly complex node tree):

enter image description here

(The description comes from a text file, so this may or may not be suitable for your situation).

An alternative solution is to provide a small script along with your material that has an interface for providing a new path which then updates the node's filepaths.

For example:

newFilepath = "C:\Filepath\To\Image"
bpy.data.materials['MyMaterial'].node_tree.nodes['Image Texture'].image.filepath = newFilepath 

This changes the filepath for the image on the MyMaterial material.

If you have questions about how to provide an interface for selecting a file and returning a filepath to your script you can either ask a new question (or search this site for Existing Questions).

$\endgroup$
  • $\begingroup$ Oh, that's right! I forgot about sources. Thank you! It's still not as streamlined as changing the texture at the node itself, but I think it'll do. I'll take a look into using scripts for nodes, but I'll probably not use them because it requires OSL, right? $\endgroup$ – Rhaenys Jan 19 at 16:05
  • 1
    $\begingroup$ No I don't mean using OSL, I mean writing a small add-on that you supply with your materials as a utility. In the add-on you specify the nodes you want to update and loop through them, changing the filepath to whatever the user has browsed to (in the interface to the add-on, that you would create). $\endgroup$ – Ray Mairlot Jan 19 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.