Scripting a new type of cycles material node, how to start ?


(uriel) #1

Hi everyone,
i was wondering how to start coding new material node, i need actually to do some coding for our work to simplify the on-going process.

my first need is a cycle material node (type image texture) that include several images inputs and mixing factors…

Well, i can do this using a group but i would love to learn to code a specific node for that purpose that serve our team ! :evilgrin:
i´m used to script python for blender but i have never looked at the node tree and its caracteristics…

can you help here to look at the correct doc pages and tutorials ?
i have been looking over youtube and others sources but not finding the correct answers… thanks
uriel


(uriel) #2

Recieving some help from friends, i came up only with a nodegroup system, quick to setup.
I found the solution adapted at our challenge, using the so called UDIMS uvmap (multiple uv images/object), to be able to unwrap a large scale model with small textures formats.


using a 5x5 grid, with color tester and images ready
Here is the file if you want to look at the various tests :slight_smile: (2.79)
UDIM_5x5.blend (1.25 MB)

But still… is there an other way to get this result with a script ?


(donnydarko) #3

take a look at this blender branch. Udims are already working with image textures there in a way simpler way. just plug the first udim in the imagetexture nodes and it will automatically work and in uv image editor you can choose the tiles under display for unwrapping. the only real thing missing now is a good glass shader with caustics.


(uriel) #4

That´s a good news ! in some cases, it is really needed…
I do understand that the feature will come soon , but somewhere, i suppose there is also a way to get it with python or osl script ?
and that is what i was looking for :slight_smile:

I anyone can show me where to look closer, i would be happy !

first, Python or Osl ?
Sec. python, i know how to do it, but it may take some times to adapt to this situation, and osl, i don´t know where to look to learn how to do this task, i found basic shader samples, but nothing really clear on textures and uvs… thanks a lot if you have some information for me…


(Secrop) #5

If what you want can be created with nodegroups, you can use Python nodes for adding more functionality to it. All you need is to encapsulate the node_tree into a NodeCustomGroup…

You can check some examples in my github.