Download

Changing Curve Atlas Row Selection in BP

Hey, folks
I’m using a Curve Atlas to apply colour to a couple different components in my Blueprint - a particle emitter and a mesh. Both of those components are sampling the same curve from the atlas.
The part that I’m struggling with a bit is how to switch the active curve on the components in the BP (eg. some placed instances of this BP I want to choose to sample a red curve from the atlas, others a blue curve from the atlas, etc.).

I’ve found that I can use a SetScalarParameter on a Material Instance Dynamic of the two different materials (for the particles and for the mesh) and can successfully change the curve selection that way, but it’s pretty finnicky to find the exact right spot in the range that determines a proper “selection” of one curve (if you’re off by a little you’ll get a blend of two different curves), so I’m wondering if there is a better way to select specific curves from the atlas instead of estimating with float values? Maybe there is some existing functionality that has eluded me.

I’ve tried digging around a bunch online and have found some tidbits here and there, but nothing that has lead me to where I’m trying to go. I guess because the Curve Atlas system is fairly newish.

Wasn’t sure if this would be better asked in Rendering or Blueprints…
Anyways, thanks for any help!

Edit 01 -
I suppose it’s worth pointing out that I don’t even really need this BP to have a “dynamic” material, as the colours wont change during play. I just need the ability to change the colours based on different instances of the BP (red one, blue one, etc.), but using the MID was just the way I ended up getting some results. Perhaps I can do what I need in the construction script instead.

My advice: Forget curve atlases and make your own material function that samples from a lookup texture. That’s essentially what the curve atlas is. You give it a U value that specifies the row index and then you supply a float that samples from the V. Or vice versa, however you want.

I had a similar problem, basically I stored a bunch of animation curves in a curve atlas and I wanted to select one at random for every object instance. In order for all the instances to get batched they have to use per instance custom data, but I couldn’t find any way to get that to work with curve atlases so I just made my own function (described above) that did the same thing but allowed me to choose the row by a random int generated by the construction script.

Ah, well that is unfortunate! You’d hope that this system would get rid of the need to make a custom lookup table…
In my case, because everything is essentially working if I do the math to figure out what float variable to enter into the Curve Atlas to find a specific curve (it just isn’t really the ideal way to navigate through them), I can stick with it that way for the meantime.
Thanks for the suggestion!