Applying materials to splines

Question

Hi, this is kinda a follow up question to my previous post. Does anyone know how to apply different materials to whole mesh splines from selections that are being converted from curves object? I have this setup with set material which is wrong. I tried spline parameter index but that didn't work. I'd like to just paint B/W the sphere for example and W or 1 would be red and B or 0 would be blue color for whole spline.

024-06-24 162123.png

024-06-25 202240.png

1 love
Reply
  • Martin Bergwerf replied

    Hm,

    Sounds really interesting! I don't know how to do this, but if no-one else answers before me, I will have a go at it tomorrow.

    1 love
  • Forlorn Void(ForlornVoid) replied

    Any solution would be much appreciated.

    1 love
  • Dwayne Savage(dillenbata3) replied

    You don't need to input to the selection of the first set material. That becomes the base or default. you only need to set the second one if the condition is met. Use a greater than math node set to threshold of 0 or something less than 1, and a Named Attribute node. Set it to info from a vertex Paint Attribute type color. Then just paint your sphere black or white. Use Attribute output to greater than value input and greater than value output to the selection of red material. 

    2 loves
  • Martin Bergwerf replied

    Just in case you didn't get it to work yet, here's an option:

    Curves_01.png

    With thanks to Dwayne for suggesting the direction in which to approach this!

    2 loves
  • Dwayne Savage(dillenbata3) replied

    Oh WOW! spikeyxxx I didn't know you could go from geonode to material like that. That opens up a whole new world of possibilities. 

  • Martin Bergwerf replied

    dillenbata3 ,

    I am not very good at GN yet, so it's mostly just playing around...and sometimes you stumble upon things like this 😉

    1 love
  • Forlorn Void(ForlornVoid) replied

    spikeyxxx that's cool solution and I managed to try it but it uses only one material and I need to set different, plus on curves object it does a gradient on each spline because I can't do Attribute Instancer
    024-06-26 195036.png

    dillenbata3 I'm not really fluent with just text steps to do what you suggested without seeing it, yet. I figured your approach is something like this where I'd paint it and black would be blue and white would be red material, not just color, but I don't know how to set it up.
    024-06-26 195505.png

    I'm looking to then convert the curves to mesh and I want some splines to have one or another material for further use.


    1 love
  • Martin Bergwerf replied

    Hi ForlornVoid ,

    I have no idea, why you can't set your Attribute Node to Instancer in the Shader Editor. I went back as far as 3.3LTS and you can already do that there (and you are using a later Version, as we can see from your Mix Color Node).

    The one Material argument doesn't convince me either, because you can simply use a Mix Shader instead of a Mix Color Node to mix two (or more) materials.

    1 love
  • Forlorn Void(ForlornVoid) replied

    spikeyxxx I don't use instances like you in the pic, so instancer produces this result.
    024-06-27 005106.png

    So how would I then use mix shader node to assign one material to splines on the left of the sphere and another on the right side?

    1 love
  • Martin Bergwerf replied

    Ah, I see.

    So, where do you get your Curves from? Are you just drawing the by hand?

    If you can provide a link to your .blend file, that might be helpful to figure out what we can do.

    1 love
  • Forlorn Void(ForlornVoid) replied

    It's just a sphere with empty hair, curves object. I can upload it to workupload if that's fine https://workupload.com/file/xY5RJEr7cWr . Yeah I need to change specific spline materials before going to object->convert.

    1 love
  • Martin Bergwerf replied

    Okay ForlornVoid ,

    I got it working with Random Value. I'll leave the rest to you (if you can't figure it out, you can of course always ask, but try it first):

    Hair_01.png

    Here is a Link to the file:

    https://drive.google.com/file/d/1VFFmN7xoNigy3diZnFce6r8reNJt7ck6/view?usp=sharing

    (Oh, I used a Curve Circle as profile, because its easier to see, but it still works with your setup.)

    1 love
  • Forlorn Void(ForlornVoid) replied

    I tried it, setting it like in the uploaded file and well now the color disappeared but that's not important. I thought this will do it but it didn't. When I duplicate the curves and go to Object->Convert->Mesh and try to select the tubes in edit mode, only one material selects all of them, and it's the last set material node in the goe nodes. Now it needs to take the selection. I left anotations to make it clear. https://workupload.com/file/ZTQVYFrbYRP

    1 love
  • Forlorn Void(ForlornVoid) replied

    Okay I made it work the way I want. I think there is smarter way to do it and chain more materials together from different selections.
    024-06-27 042918.png

    This makes and marks the splines/tubes right after converting to mesh. https://workupload.com/file/fWLqVsN8Nhn

    Only thing now is how to make the selections to be from black and white texture on the sphere, or colored even for multiple materials

    1 love
  • Martin Bergwerf replied

    One Material! One Store Attribute. One Set Material Node. That's all you need.

    The Color disappeared, because you plugged the (B&W) Attribute in the Principled.

    I do not really understand what your problem is, sorry; the Annotations didn't help (but it's the middle of the night for me, so that might have something to do with it 😉)



    1 love
  • Martin Bergwerf replied

    Just looked at your latest file...

    That certainly works, but it seems clumsy to me.

    1 love
  • Forlorn Void(ForlornVoid) replied

    It is clumsy, but it does what I want, multiple materials from selection on mesh splines converted from curves object. I don't know how else to do it. If you have or someone else better idea I'm open to learn. If you convert it and in edit mode it correctly selects material and spline faces.

    Edit: I forgot to delete the attribute nodes from shader before that's why it was B/W

    1 love
  • Martin Bergwerf replied

    Well, I must admit, that I still don;t understand what you actually want and why my method didn't work, but at least you got yourself a working solution 👍🏻

    1 love
  • Forlorn Void(ForlornVoid) replied

    I wanted to select either material and it's assigned geometry separately after it's converted to mesh.
    024-06-27 145912.png

    1 love
  • Martin Bergwerf replied

    Ah, I see! Thanks for clearing that up!

    When you use my method, you can, in Edit Mode (Vertex Select Mode), click on the IsRed Attribute to make it Active, and the go to Select > Select By Attribute.

    (CTRL+I to invert that Selection).

    2 loves