Several splines: trying to understand index

Hi!

I’m very new to Blender, so I apologize in advance for the noob question!

I made a simple GN setup. For the moment, cubes size varies with the Points index.

I’d like it to vary according to the length of the spline they’re distributed on.

Tried many things, to no avail. I can get the splines length in a viewer but how can I “feed” the instance scale with it?

Thank you very much for your input!

It’s not entirely clear to me what exactly want you see, but if you wanted to have the cubes be bigger or smaller depending on the spline they were instanced on, you could do something like this, where you store the curve length so the points will ‘remember’ it when they are instanced on:

You can integrate the index (if you want) into that scale math to vary them further if you want (though be careful, since the first index is 0, your first cube will ‘disappear’ since its scale will be 0 too, due to multiplication). If you’re confused about any of it, you can ask further questions, or clarify what you want to happen.

Wow! Brilliant, exactly what I wanted to do!

Now, I give the cube a Noise Texture Material. I’d like to have each instance to have a different noise scale. I guess I have to create an “NoiseScale” attribute in GN, but I don’t know how to pass it into the shader…

Once you capture whatever information you need, you bring that inside the shader using an Attribute node. On the left, ShaderNodes; on the right, GeoNodes:

Arrows point to things people, especially beginners, tend to forget to set and then get confused why it doesn’t work. Pay attention to:

  • Capture your information on the correct domain. Here, we are storing the noise data on cube instances so Store Named Attribute is set to Instance
  • Having the material on the object is not enough because that just tells the whole object the GeoNodes modifier lives on to hold that material, not how to use it. You need to tell GeoNodes which objects you want to use that material with.
  • In Shader Nodes with the Attribute node, take care to set the correct domain again–not the default Geometry but Instancer in this case. If you had turned your instances into mesh (with a Realize Instances node, for ex) you would use Geometry here (and a mesh domain like Point, Face etc in GeoNodes).

Thank you again, I was there, but misnamed my attribute! scaleNoise in the GN and noiseScale in the shader!!!

I found a much easier way to do it, just by using Object location in the shader, but I don’t no which way is preferable…
test02.blend (111.9 KB)

Pierre

Would depend entirely what you wanna do. You seem to grasp the fundamentals, the rest is just playing around and finding out. Only immediate thing that strikes me is that you have a lot of randomness throughout the setup so it’s not obvious what the end result you’re trying to get.

Your scale for example… Index values are integers, spline_length is a float, then you’re using them in a color math, then turn into a float again… Unless it’s a clever trick I’m not familiar with, I don’t know what the color math get you—you’re doing ((spline_length * index) + spline_length) / 2… why? Then you have the Random Value node for the noiseScale, and then the Noise Texture itself (which is kind of a fancy Random Value node)… When you have that many randomness it can get harder to be in control. But your end result might justify it… I just don’t know what that is.

Oups! Color multiply instead of math multiply, just picked the wrong one in the list!

I do (spline_length * index) *0.011, or am I wrong?

For random, I used to program shaders in glsl, where random, fbms, etc are the daily bread. There’s nothing I really try to achieve, I just started learning Blender 10 days ago, so I’m just beginning to get a bit deeper, fiddling around and trying to understand the concepts and familiarize with the UI.

I just reused this named atribute technique for a more complex project, with success!

This community is very useful!
There are many tutorials, but sometimes not that clear, or too fast, or too slow! :slightly_smiling_face:
So thanks again, one more step forward, thanks to you!