Substance variations on multiple meshes

Hello, I’m trying to make a blueprint for my mesh to be able to customize its material by changing values from the editor as shown here

I’m using the Substance plugin, so here is my attempt in the construction script

The Update material function simply changes the input parameters and performs Sync rendering as shwon in here

The problem here is that each time I move the actor, the engine freezes for 5 secs which are consumed by the first time rendering of the textures that are created in each call of the construction script. I attempted to make the created substance graph to be editable so that it won’t be re-created since the editor will have a reference to it and checks if the graph is valid, then I won’t re-create it but when the construction script is called again the material on the mesh gets resetted to the default material with the default parameters.

I want to have material variations on each mesh with the substance plugin without having to manually create graph instance for each mesh insance from the editor.
The question here, Am I doing this the right way ?

I may be wrong with this, because I haven’t tried creating dynamic substances myself, but since the construction script will be run for any changes done in the editor, if I recall correctly, you could specify the construction script to run whenever the changes you want to be taken into account are detected.

Like in the live twitch for splines, link here, you could create a struct with every parameter you want to change (e.g.: random seeds, colors, etc…) and update the construction script based on the presence of the struct in the instance of the actor and modifications of the values you assigned. This way changing the transforms of the object would’t regenerate the texture.

At least this is what I would try to do.

Cheers

I have just finished watching this, but it didn’t help.
The thing is the Graph instance created in the script gets recreated when doing any change, since it doesn’t exist as an asset in the content browser, it gets removed when the construction script is called. and re-plugging the textures takes a lot of time.

I think you can just skip the creation of the dynamic material and substance with a Branch by checking if the variables you’ve assigned then has a value (isn’t a null) and then not have to recreate then every frame, like this.

If you could try and tell me if it works it would be cool. I’ll check back as soon as I get back home and maybe look at this myself.

I already attempted doing this, but the thing is the construction script when called all the variables are set to their defualts, except if it’s an editable one I tried to make The instance graph and the Dynamic Material Instance as editable, I saw the changes on the material in the details panel, but it doesn’t get rendered in the viewport.

I managed to come up with a solution for this, the thing is I had to set the created dynamic material instance to my mesh, also I changed the Sync Rendering to Async Rendering since when I open the level the Insances are not created and will be created again since they are temporary assets now which greatly decreased the time cost, also both the graph instance and the dynamic instance are editable variables in order not to be removed when calling the construction script again, here is my new setup. the collapsed graph is the old construction script in the question.

Hi your use of the Substance blueprint functions is quite close to what we had in mind when designing it. You hit the same limitations as we have in terms of practicality, I’ll try to follow your progress and see what we can improve to make this use case more fluid. Congratulations on figuring out this solution. If you have some suggestions or want more direct support, please submit them to the dedicated account at allegorithmic: