<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Retina Images (with Mapbox)]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=992&amp;type=atom" />
	<updated>2018-12-14T13:31:27Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=992</id>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4411#p4411" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>Places like Texture2D texture = new Texture2D work correctly because the size of the texture does not matter when you load it from a file later. You can create a texture with 1 pixel, and then load a 4096x4096 image. And it will work.</p></blockquote></div><p>Thats good to know, thanks <img src="https://forum.infinity-code.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-14T13:31:27Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4411#p4411</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4410#p4410" />
			<content type="html"><![CDATA[<p>Thanks for the screenshots. I see what you are talking about.</p><p>Actually, I tested it a bit and you do not need to modify anything at all.<br />Tileset works well with 512 tiles out of the box.<br />You only need to register a new provider.</p><p>Why it works:<br />Tileset draws tiles based on UV for which the actual size of the texture is does not matter.</p><p>Places like Texture2D texture = new Texture2D work correctly because the size of the texture does not matter when you load it from a file later. You can create a texture with 1 pixel, and then load a 4096x4096 image. And it will work.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-12-14T13:05:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4410#p4410</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4409#p4409" />
			<content type="html"><![CDATA[<p>CreateCustomStylesExample.cs:</p><p>If you switch between these two:<br /></p><div class="codebox"><pre><code>private string style1 = &quot;https://a.tiles.mapbox.com/v4/mapbox.streets/{zoom}/{x}/{y}.png?access_token=&quot;;
private string style2 = &quot;https://a.tiles.mapbox.com/v4/mapbox.streets/{zoom}/{x}/{y}@2x.png?access_token=&quot;;</code></pre></div><p>Via the button, you can toggle between non retina and retina.</p><p>For us and for now, I think our case is solved!</p><p>Thanks for pointing me in the right direction <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><br /><p>PS: Maybe you could still elaborate, why I didn&#039;t have to change anything else.</p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-14T08:36:52Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4409#p4409</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4408#p4408" />
			<content type="html"><![CDATA[<p>I think I don&#039;t understand.</p><p>If I just change <br /></p><div class="codebox"><pre><code>urlWithLabels = &quot;https://api.mapbox.com/styles/v1/{userid}/{mapid}/tiles/256/{z}/{x}/{y}@2x?events=true&amp;access_token={accesstoken}&quot;,</code></pre></div><p>(see the @2x), it&#039;s enough and it works!</p><p>Why mustn&#039;t I change the texture dimensions in e.g. OnlineMapsCache.LoadTile?<br />I haven&#039;t debugged into it, but is this not called?</p><p>I assumed the cache textures have to be stored and imported as 512, not 256.<br />Or does it remain the downloaded size?</p><br /><p>Next test: Custom provider like you suggested.</p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-14T08:12:27Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4408#p4408</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4407#p4407" />
			<content type="html"><![CDATA[<p>Just so you see what I am talking about, this is a screenshot of the difference in the editor.<br />It gets worse, when you zoom around on a mobile device.</p><p>Side note: You must not forget to clear the cache after each session <img src="https://forum.infinity-code.com/img/smilies/wink.png" width="15" height="15" alt="wink" /> </p><p><span class="postimg"><img src="https://modalog.at/projects/onlinemaps/online-maps-2x.png" alt="https://modalog.at/projects/onlinemaps/online-maps-2x.png" /></span></p><p>In order for both Maps to have the same &quot;viewport rect&quot; you must change:<br />In the Online Maps component @Inspector I set width and height (pixels) to 1024.<br />In @2x Online Maps Tileset Control Script &quot;Size in Scene&quot; is 512.<br />In @1x Online Maps Tileset Control Script &quot;Size in Scene&quot; is 1024.</p><p>I will contine researching ...</p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-14T07:44:00Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4407#p4407</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4406#p4406" />
			<content type="html"><![CDATA[<p>Hi!</p><p>Thanks for the reply!</p><p>I will take a look at the custom map provider.</p><p>The map actually should look the same like 256. I will do a comparison project and provide screenshots (and code for you).</p><p>If you change 256 to 512 via mapbox api, the map texture looks different (more content visible).</p><p>If you change 256 to 256@2x, it just gets rendered with more details, meaning e.g. the fonts are more crisp on newer devices.</p><p>So in that case, I think you also have to change the texture resolutions like I did?</p><p>I will do some more testing and get back to you.</p><p>I also can imagine, that e.g. Google Maps offers something like this and possibly others aswell?</p><br /><p>Thanks for now!</p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-14T06:58:12Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4406#p4406</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4402#p4402" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Online Maps is built around 256x256 raster tiles.<br />Mapbox support was added a MUCH later.<br />I have not tested 512 tiles, so I don’t know if something’s broken or not.</p><p>When using 512 tiles, did the map look different or not?<br />When using “@2x”, downloading tiles is counted as a map view or as monthly active users?</p><p>In fact, you only need to change OnlineMapsUtils.tileSize.<br />All other places do not matter.</p><p>In order not to modify existing providers, you can register a new one:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/CreateCustomStylesExample.html">http://infinity-code.com/atlas/online-m … ample.html</a></p><p>Yes, I will try to add this feature.<br />I hope it will be useful to someone.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-12-13T20:04:49Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4402#p4402</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4396#p4396" />
			<content type="html"><![CDATA[<p>Hi again,</p><p>I made changes:</p><div class="codebox"><pre><code>OnlineMapsEditor:
    private int textureHeight = 512;
    private int textureWidth = 512;

    
OnlineMapsCache:
    private void LoadTile(OnlineMapsTile tile, byte[] bytes)
    {
        Texture2D texture = new Texture2D(512, 512, TextureFormat.ARGB32, map.control.mipmapForTiles);

OnlineMapsUtils
    public const short tileSize = 512;
    
    
OnlineMapsProvider:
    urlWithLabels = &quot;[url]https://api.mapbox.com/styles/v1/{userid}/{mapid}/tiles/256/{z}/{x}/{y}@2x?events=true&amp;access_token={accesstoken}[/url]&quot;,
    
    
CustomDownloadTileExample
    Texture2D tileTexture = new Texture2D(512, 512);
    
    
OnlineMapsRasterTile
    Texture2D tileTexture = new Texture2D(512, 512, TextureFormat.RGB24, map.control.mipmapForTiles)</code></pre></div><p>&nbsp; &nbsp; <br />&nbsp; &nbsp; <br />And it seems to work.<br />Not sure about yet what I broke.</p><p>My question is: Is there any chance, you are gonna implement something like a &quot;isRetina&quot; setting?</p><p>That would be awesome!</p><p>Thanks<br />Christian</p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-13T15:28:43Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4396#p4396</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4395#p4395" />
			<content type="html"><![CDATA[<p>I am certain, the correct url is<br /></p><div class="codebox"><pre><code>https://api.mapbox.com/styles/v1/{userid}/{mapid}/tiles/256/{z}/{x}/{y}@2x?events=true&amp;access_token={accesstoken}</code></pre></div><p> (OnlineMapsProvider.cs)<br />Tested it with my IDs in the browser (with and without @2x).</p><p>But I am not yet sure, what I must else do to make it visible ingame (the textures themselves mustn&#039;t be 256 but 512).</p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-13T13:58:53Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4395#p4395</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4394#p4394" />
			<content type="html"><![CDATA[<p>Update! I found this: <a href="https://www.mapbox.com/api-documentation/#rate-limits">https://www.mapbox.com/api-documentation/#rate-limits</a><br />Investigating ... it&#039;s not 256 or 512, it&#039;s a different flag it seems (@2x).<br />Also, I never deleted the cache ...</p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-13T13:49:28Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4394#p4394</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Retina Images (with Mapbox)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4393#p4393" />
			<content type="html"><![CDATA[<p><strong>EDIT: See solution further below!</strong></p><p>Hi!</p><p>I am using Online Maps 3.0.0.30 in combination with Mapbox.<br />We have played around with the official mapbox SDK for Unity aswell.</p><p>I must say, features and handling of your plugin are really great!</p><p>What I am currently struggling with though is, that the map itself doesn&#039;t look as crisp as with the Mapbox plugin. I think it&#039;s because in mapbox, you can enable &quot;use retina&quot; and it then uses high resolution images.</p><p>Is there a way to get that into your plugin?</p><p>I tried a custom provider with the url<br /><a href="https://api.mapbox.com/styles/v1/">https://api.mapbox.com/styles/v1/</a>[USERID]/[MAPID]/draft/tiles/512/{zoom}/{x}/{y}?access_token=[TOKEN]<br />But that didn&#039;t help.</p><p>I&#039;d be grateful for any guidance!</p><p>Thanks!<br />Christian</p><p>PS: It doesnt have to be Mapbox, we&#039;d use any service for crisp maps <img src="https://forum.infinity-code.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></content>
			<author>
				<name><![CDATA[office]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=865</uri>
			</author>
			<updated>2018-12-13T13:25:34Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4393#p4393</id>
		</entry>
</feed>
