When you say a zoomable 2D map. I’m guessing you want a 2D texture as a map. Well the formula to do it would be very simple. You’d simply have a standard camera, set it to orthographic, set the map in front of the camera, then change the orthographicSize of the camera, to zoom Unity - Scripting API: Camera.orthographicSize. As for mobile, the quality will be depend on the exact device. Mobile devices generally will allow a maximum of either 2048x2048 or 4096x4096. Either way they’re able to be reasonably detailed. It depends what level of details you’re planning to show on this map. You’d need to test the quality of the image depending on the amount of zoom you want. If the quality doesn’t suit the max zoom you’re after you’d need to find a different method of approaching this.
On IOS you are limited to 2048x2048. I don’t know why you want a map so huge. You can scale it down (mobile devices have a small screen so you can reduce the quality) or you can use a system like in candy crush level select (break your map in sprites and reuse them). If you really need that resolution just break it in parts that are less or equal to 2048x2048, but this might be slow on mobile. If you want more advice post a picture of the map (scaled down). Personalty, taking in account my experience with mobile, I would say that a 32k x 32k map is a no no. You have to do some trickery.
I didn’t explain well my problem, I have a 32k map, and i want a close result on both phone an tablet. The original texture is large because of the level of details needed. I want to zoom on the map really far, to switch between global view (the entire map) and really close view (discern houses).
But i don’t want to really render the 32k, just want the same result, i didn’t explain myself clearly.
Dunno if the best way to do that is using LOD, or if i’ll just kill my phone
And if LOD will to the trick, i can’t imagine if i have to cut the map in like 128x128 parts or less …
On smartphone, i can put a loading screen at the app’s launch, but after, i don’t want the navigation on the map to be slow. That’s maybe a little overestimated, but who knows, i want to try
I can’t put the map here, because it’s not my property. If you need something to refer, you can open google map, i think i want something between the 5km scale for the farthest and the 100m scale for the closest (dunno if it’s understandable, my english skills are quite questionable :p)
Yep, I understand, but it is one of this things that seems simple but is quite hard (on mobile). I will suggest looking around in games and see how they implement it. Even in google maps they use reusable graphics or a lot of pictures (for the terrain version). You could try and switch between versions of the map that have less quality (and are smaller) depending of the resolution (like google maps), and the biggest one brake it and construct it like you are working with unity terrain.
For me I’d just do testing on some devices and the profiler to see what the actual cost of the image is. Adjust your method of rendering this according to the cost. You don’t want to start looking at your savings in the bank till you know how much something will cost lol. Also, by making the texture a sprite, you’ll be able to make use of mip-mapping (Unity’s built in Texture LOD system). You can get up to 11 mip-map version of textures I believe. Setting the sprite’s image to trilinear in the import settings will allow a smooth transition between mip-maps when zooming.
It’d be worth cutting the image up into sizeable chunks like @CloudKid suggested. Simply see how it plays on devices.and go from there.
LOD will be your friend here. Like everyone is saying you’re not asking for a simple solution. When you’re zoomed out and viewing the entire map you should just be seeing a 2048 image. Zooming in you’ll load in a equal resolution of smaller section of the map. Almost exactly like google maps. If this causes too much “hitching” then you’re best off loading in a bunch of 2048 images and tiling them, though keep in mind that a 4k x 4k png is like 10Mb, so you’re looking at some hardcore memory usage.
I just started, is there a good way to load images for the LOD ? For now i put all the textures in an asset bundle and i load it.
But i’m quite in trouble, i don’t really know how to display the right texture at the right time (and only load the parts I need).
I saw the LOD Group functionality, but i can’t figure if i can use it in my case.
For now, i just have the full size map in 2048 and i can zoom on it, not really brillant …
Compute the different position of each part (considering the lod and the number of parts) and get the bundle at the same time
When we get the bundle, load all the textures to get them ready to be display
/or - Load only the texture that are visible, display them and stock them (ready to be displayed again)
But that’s just thought, i don’t know if it’s the good way and i really don"t know how to do that…
More precisely :
For loading a texture : i saw the LoadAssetAsync function, i catch the request but i don’t know what to do after… just put the asset into a list ?
And after that i don’t know how to display it when i need …
What is the best way to get the parts that are on the camera view ?