We’re developing a mobile game.
We realized the size of cooked map is huge.
While checkiing the reason, we realized there are shader codes as many as count of components.
And, although using the material instance, it seems that the result is same.
We’re optimizing the size. And the map data is the most biggest one.
Now it’s hard for us to change the landscape to the mesh.
Why does the cooked map have shader codes as many as count of components?
Can you give us advice to check the reason why material instance doesn’t work for us?
Is there a way to let the cooked map not have shader codes?
We would appreciate for your reply.
Hi sharbong -
I want to clarify a few items before I can give you a full answer. You are using the Override Material for each component of your Landscape, but in each override material you are assigning a Material Instance of a single material?
Yes. i use override material.
Hi sharbong -
Landscape in a Map are only stored within that Map file, they are not stored in the Content Browser as a separate mesh. So all associated data links needed for that Landscape are also stored in the map as well. This is why the map file containing a landscape can get particularly big. In your case, you are assigning each component a different material. This causes the landscape stored data to grow and thus the increase in Map size in cooked content. In the case of using a Material Instance over a Material you are doing the correct, most performance friendly method. Depending on the complexity of the Material and what / how much you are changing the Material Instance will only need to store a few bytes of data versus a complex material without instancing could average around 1Kb. Again going back to your case, if you were using Materials versus Instances for each component, the issue could be even less performant than what you are experiencing.
In the instance for a mobile game, I would recommend a few things.
First, See if you need as many components and as complex a subdivision as you may have currently. Reducing this number could greatly increase performance.
Make sure that you are also correctly using the Landscape LODs, this can greatly increase performance
You may finally want to consider converting your Landscape components into different Static Meshes which can be loaded and unloaded as needed in your game thus removing the stored information in your Map.