Dynamic Material per Instance - Fading

Hi, I’m having an issue.

I have a spline that dynamically creates instanced meshes along its path. Everything works perfectly in terms of creating the instances, but I want each instanced mesh to have a different color. I’m trying to achieve this in my material using a Per Instance Custom Data, but my Blueprint can’t seem to update the material — no matter what I do.
Below, I’m attaching some screenshots.




1 Like

I think that’s a foliage type node. So, works with HISM.

1 Like

In the Details panel for the Instanced Static Mesh Component, under Instances, make sure you have set Num Custom Data Floats to the amount of custom data you’re using in the material. In this case set it to 1

[EDIT]

@ClockworkOcean is correct, you’re using the foliage version. Instead create a regular Scalar Parameter (Hold S and Left Click)and check the Custom Primitive Data checkbox

It should look like this

I did what you said, but it’s still the same. Am I missing something?


1 Like

I think primitive data is another thing.

Have you tried using a HISM instead of ISM?

Sorry, but what do you mean by HISM and ISM? I’m kind of a noob with these abbreviations.

1 Like

Hierarchical instanced static mesh, just change the component type :slight_smile:

Everything else is the same.

only one color again

1 Like

Hold on…

Basically, what I want is to create a pipe that fades between two colors — in this case, red and blue. Maybe I’m overcomplicating things?

This, with dynamic fade

It works here

( ignore the material statement I made )

I was also wrong about HISM, it does work with ISM too.

Yes, when I did it separately, everything worked. But what I actually need is something more like a video — I want to simulate a pipe where hot gas flows through and gradually cools down. That’s why I want it to start in red and fade into blue.

1 Like

Ah, wrong material then. You want to fade over the distance of the whole pipe?

I don’t see anything about fade in the vid…

You’re right — what I want to do is a fade along the entire pipe, between two colors that I’ll set later. It could be from red to blue, or green to yellow, either one. What I was trying to show with the video is the type of BP_Pipe I’m using.

1 Like

You could… but you would need a material that does a fade in world space.

This mat fades based on the world X coord

But it won’t work the moment you rotate the object.

You can make it happen in world space, independent of the object position and orientation, but its a bit more fiddly. This will work for object movement

but not rotation. I don’t know how many orientations your pipe will take?

This will be the path that my pipe will follow.

1 Like

Actually, I think ( think ) you can do this pretty elegantly with a material parameter collection. But I’ll need to come back later ( busy now ) :nerd_face:

1 Like


Is this what you’re trying to do?

2 Likes

yes, is this, how to make that?

Well, I used the video you’ve showed which doesn’t use an Instanced Static Mesh, so I’m not sure if it will work for you. If I find a solution for Instanced Mesh, I’ll publish it.