This is my last resort. Asking a question that’s been asked a million times, and never answered.
Why can I not use material instance dynamics on a landscape?
For context: I have a runtime virtual texture going on a landscape, and on that landscape, I want to change the color of a particular layer (grass) dependent on a season enumeration. That part’s easy. What’s rough is that Material Parameter Collections don’t seem to play nice with landscapes. So the next solution was to use Material Instances; change the landscape material to each of those dependent on the season. But it wouldn’t even take that for an answer. As such, a dynamic material instance was the remaining route (and I realized, better anyway).
I tried doing this so many different ways. In theory, landscapes are divided into multiple “landscape components”. I tried changing the parameters on the entire landscape material via blueprints, AS WELL as tried changing the parameters on the material of each and every landscape component using a foreachloop. And before I’m asked, yes, I checked the “Use Dynamic Material Instance” boolean parameter on the landscape actor.
Even still, nothing changes.
I really hope I can solve this. I’ve lost a lot of sleep over this one. I’m surprised as it is that it hasn’t ever been answered by this point.
I’m assuming that the reason MPC’s wouldn’t work is due to the nature of RVT’s. But there seems to be no reason why MID’s shouldn’t work.
Material instances should work – typically, I’ll have a base landscape material, and assign a material instance to my landscape, with the “look” tweaked.
I do this in the editor, though – I haven’t tried doing it at runtime.
Hey, did you manage to resolve this issue? i´m handling with that also, and i couldn’t make it work on sequencer on runtime! appreciated any help! thanks!
I remember I figured out a workaround. But a workaround is just that. So for context, my intention was never to really be able to change the appearance truly midgame, so much as it just logically had to be able to change at runtime, as I needed the season of the landscape to change when the level began to match with the time of year in my game which was determined by a value. I wanted it this way so that I wouldn’t have to make 4 different levels for each season nor 4 different landscape meshes with different materials for each season, as that would bog down performance.
With that in mind, my workaround was simply making a separate material function that calculated the color output for my grass based on the value of a Material Parameter Collection (if 1, then spring, if >2, then summer, if >3, then fall, if >3, then winter). The MPC seemed to play nicer when it was used in a self-contained function. I brought that function into my landscape material and used its outputs as the color I needed for my landscape.
What that leaves you with is a landscape material that evaluates what color output to choose based on a predetermined value at runtime, but at the beginning of the game. I hope this helps, but my concern for your case is that I actually tested this workaround to see if it would still work during runtime at a point after the initialization process and although the color changed, it seemed to have trouble updating objects that used my Runtime Virtual Texture. So just be aware that depending on your situation and how you’ve set up your scene, not everything in your scene may be updated. And especially for you, that may be a problem if you’re trying to produce a realtime sequence.
Anyway, I think that’s all I’ve got. Still looking for a concrete answer!
I have the same issue. I tried it with material instances, dynamic material instances and MPCs and nothing seem to work at runtime when it comes to the landscape material. Outside runtime it behaves as it should but through my level blueprint it simply doesnt change the scalar parameter when it should. Is this simply not possible with the engine or what am i doing wrong?
in5.4.4 created a dynamic material and assigned every component then set a texture parameter. When I pause the game and select the landscape, I can see the material is now dynamic and my texture is properly named and assigned, but no effect. Also useDynamicMaterialInstance is enabled on my landscape. I wonder does it have something to do with nanite?