Download

Change Material Parameter Value in Character Blueprint

I’m creating a weather system (working on snow right now) and right now I’ve achieved snow falling from the sky and I’ve set up a material where I can add snow to the top of the model using parameters. The next and final step is to set it up in blueprints so that when it is snowing, I can gradually increase the parameter which will increase the snow on the model. The problem is, I’m creating a survival game and there will be a lot of objects in the game all at once, so I can’t use Timelines, otherwise I would have a ton of Timelines. My question is basically, how do I gradually increase a parameter float value in a character blueprint without using Timelines? If someone could help me out, I would really appreciate it. Thanks!

Hope this video helps you. What you probably are searching for is a material collection. You only have to plug the parameter into the parameters you use for measuring the snow amount. It is a global parameter and can be changed with just one timeline in a master blueprint. This will update every material, which uses the global parameter and will get rid of you adding a bunch of timelines in different actors.

https://vid.me/KG40

Hope it helps.

Hi DarkGodsLair,

Thank you for replying and helping out! I followed your video almost exactly (my snow material is different). Everything works except for one thing, I followed a snow material tutorial that made it so only the top part of the mesh would get covered in snow (also known as tessellation), so that’s why my material is different. Anyway, my problem is that when it’s snowing, the snow is applied to the mesh, but the material turns to grey scale for some reason. Here is my material set up and some pictures of the mesh to help you out.

Pic1.JPG

Pic2.JPG

This is my material set up.

GreyTree.JPG

This is what I meant by “grey scale”.

735a0ea51ac05b207782079ebfcffa4c45ac4f4d.jpeg

This is what the tree is supposed to look like.

This is weird. I get this result:

https://vid.me/Vc9H

But it seems like something is wrong with your UV’s, because they cut out so weirdly. Seems either it is a normals problem of the model itself or the lightmap is somehow defective. Did it happen, when you manually applied the parameters (not a parameter collection)? Try to duplicate the material, then use your old parameters (how you did it before) and create a material instance out of the material. Then apply the material instance to your tree and then you should be able to tick some checkboxes in your material instance. Do that and then change the values of your parameters. It might lead to the problem.

It was working fine before with the material instance. The only issue I was having was what I said in the original post. It is weird that your tree works and mine doesn’t. I don’t know much about textures, materials, UV’s, etc.

Can you maybe send me the model + texture itself? It is hard to judge, what exactly is causing this weird behaviour. You can send it under darkgodslairgames@gmail.com .

@IcyFlames

I imported the mesh and applied the exact material you posted and it strangely works for me without a problem. This is the result:

ae43b2e8f9594d8ab0805d6fdb40de8d.png

When I change the timeline on the 5 second mark from “1” to “-1” I get this result. It comes close to your issue, but is still different:

a139b38736ed4576b9d70748ca5cf071.png

Also another note: You don’t have a lightmap channel baked into your uv’s. I would always recommend doing it, because the lightmap unreal produces is never as good as the one you made in your modeling program :).
I also tried different normal modes like Mikk T space and Built in. I also used your normals of the model itself and tried using the computed normals from Unreal. Your normals are much smoother, but nothing of it comes close to your problem.
I’m sorry, but I can’t really help any further. My only advice is to restart your project and maybe add your tree with a different name and apply the material to it and see, if it does the same weird things you expierience with your current model. All I can say is that your model is fine despite not having a baked lightmap. You could also create a blank project and recreate your stuff with the timeline and stuff, so you can be sure that your project is not producing this kind of bug.

You are probably hooking up things the wrong way. For example you’re using a lerp with a texture in A, a scalar in B and the snow thing in alpha. What this means is if alpha is 0 you will get the texture as base color, if alpha is 1 you will get either 0 (black) or 1 (white) or something in between. Which is probably not what you want if you want the trees to still have their color.

I thought this was the problem too, but I tested it myself and it just doesn’t matter at all. That’s why it is puzzling. But just try it anyways. Maybe it will work with your project somehow :).

Edit: Tried to change the alpha and B. Now I get a greyscale thing, but his setup is different. I honestly don’t know, what is going on.

All I had to do was reimport the model. It’s always the most simple things that end up being your problem haha. Thanks for all the input!

Glad that you worked it out :). I am reimporting stuff constantly, so I guess I wouldn’t stumble over this kind of thing :D.