|
Post by kramar on Jun 18, 2015 14:48:59 GMT
I'm just running some tests on mobile devices in DX9 mode and I have some questions about memory usage.
Both generating terrain in the sample scene or loading a grid from disk ( of HexRadius=6 ChunkRadius=1 or about 400 hexes) gives memory usage close to 400 MB. Is this normal? It's not a problem on newer devices, but on a 2012 4th gen iPad (1Gb RAM) I'm getting crashes.
I've tried doing some memory releasing and garbage cleanup when I get a memory warning, but it doesn't help much. I've also tried building the chucks (i.e. calling PrepareChunkData) asynchronously and with a delay between chunks (to try and minimize ram spikes) and neither helps.
Are there any tricks to reduce the amount of memory the grid uses without reducing the number of hexes? I think if I could get it down to below 350 Gb it would be okay.
Note: I haven't tried my older android devices yet.
|
|
|
Post by khash on Jun 18, 2015 15:20:24 GMT
Hi! You are most likely using textures 2048 for terrain. Try to use smaller texture (Settings file is in Streaming Assets, if its not there then default settings are taken from MHGameSettings and managed per quality settings.)
Most of the memory goes to the terrain textures and the only way to have big world on devices with smaller memory budget is to use either lower resolution per chunk or save generated textures to drive and then load them on demand. As you can imagine both have some advantages and disadvantages so its up to you what you need most.
Most advanced trick it to use supersimple textures for visuals (and "ok" quality for height)and when something enters views you can bake better resolution for it (but keep height as is to ensure it does not break terrain on roundng values) this way you get something what behaves "like LOD" and allows you to save a lot of memory and in the same time does not uses extra space on drive (if it have limited space or no access at all)
Cheers
|
|
|
Post by kramar on Jun 18, 2015 19:19:16 GMT
Yes reducing texture quality helps a lot. Thanks for the ideas on more advanced techniques to manage memory, but I won't need to try them on this project. I think the max grid size I will need will be about 30x30.
I am getting some other wierd artifacts though. On Android I am see splotches of water all over my terrain and the rivers appear as ridges on my terrain. On iOS, the water is not rendering at all and I'm just getting pure black hexes? Are these DX9 issues? From what I read in the forums these shaders were better now and provided a reasonable result. I'm not getting that...
[Edit] Interestingly, the black water is present only on the 4th gen iPad and NOT on the iPad Air. Is it possible that a hardware difference accounts for this?
|
|
|
Post by khash on Jun 18, 2015 23:30:35 GMT
Hmm To be honest I have never had in my hands any "i" device so I cant say what is the source of the difference there, but the issue you have described seems like you are using linear color space (PlayerSettings -> Other Settings -> Color Space) our framework was designed with gamma color space in mind and linear messes up reasonable amount of calculations for rendering. Its not impossible to play it in linear (it took me about 4 hours to adjust baking process which does not handle well this change) but the visuals I have received was not looking nice and behaving poor with any source of light. It could be mix of few other things like the fact that out terrain just before rendering is completely flat and it doesn't have normals to properly handle lighting but I was disappointed with it and put it aside until I get satisfying results.
|
|
|
Post by kramar on Jun 19, 2015 13:26:48 GMT
Hi Khash, The colour space is set to gamma, so that is not the problem. Don't forget it is fine on other iOS devices and the editor. I also noticed the moutains are rendering as 2D plains instead of in 3D. The problem has to be with how the shader is working on the older device - either the conversion from unity has a bug or some features in the shader are not supported by the hardware. I will try to find someone who knows a bit more about iPad OpenGL ES2 to ask these questions to. I'll report back if I find anything. My android test is another matter. I attached a screen shot to show the artifacts I am getting. Any idea what could be causing this? I am testing on a Nexus 7;
|
|
|
Post by kramar on Jun 22, 2015 14:25:19 GMT
Hi Khash,
Just wanted to bump this and see if you had any comments regards to the android screen shot I posted?
|
|
|
Post by khash on Jun 22, 2015 22:17:52 GMT
It seems unity is making changes to the way stuff is rendered on mobiles and as you can see it affect it quite heavily. I have tested it with Unity 5.1.1f1 and it looked even stranger than what you get. We plan to check our shaders and see what can be fixed for mobiles sometime soon but cant give you date just yet.
|
|
|
Post by kramar on Jun 23, 2015 0:58:06 GMT
Well that's interesting. I did not consider it could be the version of unity.
Looking at my commits, I did indeed only start testing on my devices after upgrading to 5.1.
thanks for taking time to look at this!
|
|