2
$\begingroup$

I am trying to create a material which uses a texture. That texture is used in a subgraph (I think the technical term in blender is NoedGroup, but Im not sure). The input for that subgraph is the texture name as a string, uv coordinates and some other stuff.

I have a osl script which loads the texture using the texture name and do all the operations needed. The problem is that the script node is not compatible with eevee.

Is there anyway to add the image texture as an input to the subgraph so I can replace the osl script with eevee compatible nodes?

I have check this other answer, but seems to be doing exactly what I currently have. Select Input Texture file name as parameter/node

enter image description here

$\endgroup$
4
  • $\begingroup$ You'll have to script a custom node with Python, as far as I know $\endgroup$ Commented Dec 12, 2019 at 18:00
  • $\begingroup$ How would do that with eevee compatibility? $\endgroup$
    – jjcasmar
    Commented Dec 12, 2019 at 21:09
  • 1
    $\begingroup$ Let's start by calling things by their proper term, this is a node group. It looks to me that what you have is a color (RGB) output from that script. So if you want to combine it with other RGB information (the image in question) you just need to add an RGB mix node before the output to combine the texture and image. $\endgroup$
    – user1853
    Commented Dec 15, 2019 at 20:34
  • $\begingroup$ @cegaton I think you have completely misunderstood the question. What I want is to replace the script by the ImageTexture node, but be able to modify the image using some input to the node group $\endgroup$
    – jjcasmar
    Commented Dec 17, 2019 at 9:06

1 Answer 1

3
+50
$\begingroup$

Unfortunately there isn't any way to create a NodeGroup that has a Texture selection as an input without some coding to create Custom nodes. For the Custom node, you'd have to have the image texture node in the node tree, whose value you would change via code using the custom node UI. Please read information in the link below for a much more thorough explanation of this process. Cycles Materials Math node with more than two inputs

$\endgroup$
4
  • $\begingroup$ Will this be compatible with eevee? $\endgroup$
    – jjcasmar
    Commented Dec 16, 2019 at 10:26
  • $\begingroup$ I was thinking on adding a color input to the NodeGroup. By code, I would detect if that color input is connected to an external ImageTexture and update the internal ImageTexture node to match the external one. Would this be possible? $\endgroup$
    – jjcasmar
    Commented Dec 16, 2019 at 11:06
  • $\begingroup$ I have tested it with a very simple material and the ShaderNodeCustomGroup appears to work fine in eevee $\endgroup$
    – jjcasmar
    Commented Dec 16, 2019 at 11:37
  • $\begingroup$ Hey, sorry I didn't reply. I see that you've already tested it. It's definitely a more powerful alternative to OSL shaders which are more convenient in comparison. Glad I could be of help ^^ $\endgroup$ Commented Dec 17, 2019 at 11:04

You must log in to answer this question.

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