<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Better Contour Textures - new forum posts</title>
		<link>http://contourtextures.wikidot.com/forum/start</link>
		<description>Posts in forums of the site &quot;Better Contour Textures&quot; - by an anti-aliased distance transform</description>
				<copyright></copyright>
		<lastBuildDate>Sun, 14 Jun 2026 21:59:26 +0000</lastBuildDate>
		
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-1074833#post-2197679</guid>
				<title>Re: makedist.c, width / height</title>
				<link>http://contourtextures.wikidot.com/forum/t-1074833/makedist-c-width-height#post-2197679</link>
				<description></description>
				<pubDate>Tue, 06 Jan 2015 15:50:36 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>The bug is now fixed in the Github repo for &quot;OpenGL Insights&quot;.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-1074833/makedist-c-width-height">makedist.c, width / height</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-1074833#post-2197664</guid>
				<title>Re: makedist.c, width / height</title>
				<link>http://contourtextures.wikidot.com/forum/t-1074833/makedist-c-width-height#post-2197664</link>
				<description></description>
				<pubDate>Tue, 06 Jan 2015 15:37:18 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Oups. Sorry about that. Another case of confusion from my many years of using Matlab, which uses Fortran-style memory layout for 2D arrays. I probably tested this code only with square images, or tested it without taking enough care to use the parameters according to their names.<br /> I have this code posted to many different places, some of which are beyond my control or even unknown to me, but I will update it in where I can. Thanks for the bug report!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-1074833/makedist-c-width-height">makedist.c, width / height</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-1074833#post-2196144</guid>
				<title>makedist.c, width / height</title>
				<link>http://contourtextures.wikidot.com/forum/t-1074833/makedist-c-width-height#post-2196144</link>
				<description></description>
				<pubDate>Mon, 05 Jan 2015 00:38:50 +0000</pubDate>
				<wikidot:authorName>jimhad</wikidot:authorName>				<wikidot:authorUserId>2039109</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I believe that the parameters for width and height are switched around in makedist.c in the repository for OpenGL Insights? The calls to computegradient and edtaa3 should have the parameters switched. Since you recently updated the repository maybe you would like to fix it since it took me a couple of hours of head scratching :) Great work btw!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-1074833/makedist-c-width-height">makedist.c, width / height</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-984944#post-2088591</guid>
				<title>Re: Exact EDT?</title>
				<link>http://contourtextures.wikidot.com/forum/t-984944/exact-edt#post-2088591</link>
				<description></description>
				<pubDate>Thu, 14 Aug 2014 10:21:13 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>That's an interesting question, but I don't have an answer from the top of my head. I would need to look closer into it, but unfortunately I don't have much time to spend on that at the moment.</p> <p>Generally speaking, the errors generated by the anti-aliased version are different than the errors from the binary transform, and I would expect it to potentially mess things up a bit for the exact algorithms. The key issue is that you need to evaluate more pixels than the closest one on the discrete grid to be certain of finding the nearest edge in the anti-aliased sense. I have not spent any deep thought on what that would mean for the two specific algorithms you mention.</p> <p>Thanks for your comment, and your interest. I would be happy to discuss this further, but right now I have very little time to spend on actual coding and testing in this area. My focus when I did this was in getting it to work at all, because I needed the results for my research in computer graphics. The fine details about getting exact results (and even trying to figure out how &quot;exact&quot; would be interpreted in this context) were not my primary concern at the time.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82442">Support forum / Suggestions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-984944/exact-edt">Exact EDT?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-984944#post-2088578</guid>
				<title>Exact EDT?</title>
				<link>http://contourtextures.wikidot.com/forum/t-984944/exact-edt#post-2088578</link>
				<description></description>
				<pubDate>Thu, 14 Aug 2014 09:32:56 +0000</pubDate>
				<wikidot:authorName>cbrunschen</wikidot:authorName>				<wikidot:authorUserId>1951915</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>(Sorry for the lack of links; as a low-karma user I am not permitted to post those, it seems. I've tried to give clear references instead; apologies for anything I've gotten wrong.)</p> <p>The <em>Jump Flooding Algorithm</em> (JFA) as used here for calculating the distance transform is fairly quick and produces good, but not exact, results. But there also exist algorithms that produce the <em>exact</em> Euclidean Distance Transform (EDT) in linear time, such as described in <em>A General Algorithm for Computing Distance Transforms in Linear Time</em> (A. Meijster, J.B.T.M. Roerdink, W.H. Hesselink, A general algorithm for computing distance transforms in linear time, Computational Imaging and Vision 18 (8) (2000) 331–340) and <em>A Linear Time Algorithm for Computing Exact Euclidean Distance Transforms of Binary Images in Arbitrary Dimensions</em> (C.R. Maurer, R. Qi, and V. Raghavan, IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(2):265–270, February 2003). This is straightforward to parallelise on CPUs, and has been implemented on GPUs (in Cuda) as well as the <em>Parallel Banding Algorithm</em> (Thanh-Tung Cao, Ke Tang, Anis Mohamed, and Tiow-Seng Tan, Proceedings of the 2010 ACM SIGGRAPH symposium on Interactive 3D Graphics and Games (I3D '10)).</p> <p>Would some of this be applicable here and possible to adapt to generate the anti-aliased distance transform? An exact algorithm would avoid the (small) errors still present in what Jump-Flooding calculates, and a linear-time algorithm might be able to calculate them a little bit more quickly as well; and a GPU implementation would seem to fit in well to be able to generate them from rendered content in real time within a game.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82442">Support forum / Suggestions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-984944/exact-edt">Exact EDT?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-2071745</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-2071745</link>
				<description></description>
				<pubDate>Sat, 19 Jul 2014 10:33:30 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>The purpose of this code is to make accurate distance fields from images with properly anti-aliased edges instead of using an oversized binary image as input and downsampling the distance field. The potential improvement over a binary transform corresponds to at least a 16-fold increase in resolution, as argued in the article in Pattern Recognition Letters, but it absolutely requires you to have area-sampled anti-aliased edges in the input image.</p> <p>If you don't have proper anti-aliasing of edges, this method won't give you a better result than any of the traditional binary transforms. Look for &quot;jump flooding&quot; or &quot;sweep-and-update&quot; in the literature and you will find a selection of suitable and fast algorithms that are far better than the brute force algorithms I have sen game developers use.</p> <p>You can resize the output distance field to a smaller size, but it does not give you quite the right result. Some detail is lost. Instead, I would suggest resizing the input image before making the distance field. Make sure to use plain bilinear resampling, no fancy &quot;bicubic&quot; or more advanced sharpening stuff, and for best results, resize the input image only in integer steps, like 2x smaller. Avoid small changes in size or weird scaling factors, as that will mess up the anti-aliasing to the point where my distance transform falls flat on its face and gives downright silly results (wobbly, distorted edges, just plain wrong distances).</p> <p>Let me know if I can be of any further assistance. I would like to see this being used more.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-2071015</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-2071015</link>
				<description></description>
				<pubDate>Thu, 17 Jul 2014 23:59:49 +0000</pubDate>
				<wikidot:authorName>hogjonny</wikidot:authorName>				<wikidot:authorUserId>1547410</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I got this working &#8230; it's WAY faster then my brute force python dfGen.</p> <p>So I my working knowledge (from game dev) is that I could take say a 2048x2048&#8230; and gen a distance field at 512x512 (or lower).</p> <p>With this C version, I seem to get the same sized df out as the input.</p> <p>Is it appropriate to re-size it myself, or does that screw up the purpose and math?</p> <p>Or, can someone help point me in the right direction for changing the output size of the df in this code snippet?</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-920471#post-2067631</guid>
				<title>Re: Improved edtaa, aka edtaa3func</title>
				<link>http://contourtextures.wikidot.com/forum/t-920471/improved-edtaa-aka-edtaa3func#post-2067631</link>
				<description></description>
				<pubDate>Fri, 11 Jul 2014 18:58:39 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks for your interest!</p> <p>1) Yes, it is possible, and I have a GPU accelerated demo here:<br /> <a href="http://webstaff.itn.liu.se/~stegu/JFA/">http://webstaff.itn.liu.se/~stegu/JFA/</a><br /> You want the version that says &quot;validation&quot; at the end. The other ones may not be AA at all. I'm not sure, and I don't quite remember, because that is old code that I have not touched for years. Note that the code is a few years old, so it does not use anything above GLSL 1.2: no integer indexing, no integer texture formats and no multiple render targets, and it is written using an old version of OpenGL (2.1) to be compatible with MacOS X in the version that was current back then. It still works, though, and it's fast. However, I never got around to implementing the more accurate distance measures. This demo is equivalent to &quot;edtaafunc&quot;, without any directional dependency for the distance, it's just a linear function of the pixel value, according to equation (1) in the article.</p> <p>2) Perhaps I can make this more clear: The (u,v) is the position of the &quot;hit point&quot; measured from the center of the pixel. The &quot;hit point&quot; (black circle) is the position where a line from the external point running orthogonal to the edge would hit the edge if it were at that exact distance, with the edge direction estimated from local derivatives. It that point is not within the pixel in question, the measure is not entirely reasonable, but if it's within the pixel, the &quot;true&quot; distance is likely to be a more accurate estimate, and is used instead.<br /> Note that the &quot;improvement&quot; from the &quot;edtaa3func&quot; to the &quot;edtaa4func&quot; versions is somewhat questionable. The extra calculations improve the average accuracy, but there are corner cases at isolated pixels where they do more damage than good. You need to test it to see if it works for the kind of input images you have.</p> <p>3) The &quot;other&quot; hint to edge direction is the direction to the closest edge pixel, which is available for pixels that are not on the edge itself. I am sorry for any confusion here. What I meant to say was that the direction to the edge pixel is a better estimate of the edge direction if the edge is far away, less accurate if the edge is close, and not applicable if the pixel is on the edge. For pixels on the edge, the derivatives is all you have. For distant pixels, the vector to the edge is a better estimate. For pixels at a distance of a few pixels or less from the edge, the derivatives may be of use to improve the estimate, but not always. I have no hard decision rule here, I can just say &quot;it depends&quot;.</p> <p>Please let me know if you have any further question. Note, however, that I am currently on vacation and may take more time than usual to respond to e-mail.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-920471/improved-edtaa-aka-edtaa3func">Improved edtaa, aka edtaa3func</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-920471#post-2065616</guid>
				<title>Improved edtaa, aka edtaa3func</title>
				<link>http://contourtextures.wikidot.com/forum/t-920471/improved-edtaa-aka-edtaa3func#post-2065616</link>
				<description></description>
				<pubDate>Tue, 08 Jul 2014 09:54:52 +0000</pubDate>
				<wikidot:authorName>zebratov</wikidot:authorName>				<wikidot:authorUserId>1925824</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Dear Prof.Gustavson,<br /> First, I tried the jump flood, which results with no AA.<br /> Second, I have read the AA EDT in the Pattern Recognition Letters.<br /> I run some tests on the produced DT and they produce nice AA effects, with limitless resolution.<br /> My Questions :<br /> 1) Is it is possible to implement it with Jump Flooding?<br /> 2) Can you please further explain the U,V you are referring to in that paper - i.e equations (6) and its illustration Fig.4 .<br /> i.e &quot; Therefore, the local gradients were used to improve the result only at the edge and very near it, where most<br /> of the larger absolute errors were located.&quot;<br /> and in fig.4, &quot;the hit point&quot; (black circle)<br /> 3) &quot;In our experiments, using the local gradient always improved<br /> the accuracy for edge pixels, where no other edge direction information was available&quot;<br /> Can you further explain this sentence - i.e: other edge direction information .</p> <p>Thank you,<br /> Zebratov</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-920471/improved-edtaa-aka-edtaa3func">Improved edtaa, aka edtaa3func</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-605008#post-1659288</guid>
				<title>Re: License</title>
				<link>http://contourtextures.wikidot.com/forum/t-605008/license#post-1659288</link>
				<description></description>
				<pubDate>Wed, 19 Dec 2012 12:20:10 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>As a useful compromise between openness and attribution, I have now changed the license to MIT.<br /> Why not public domain? Well, I am somewhat reluctant to release significant amounts of non-trivial code as public domain. I like openness a lot, but I have had some bad experiences in the past where people have taken my code and put it into a product without giving me as much as a word of thanks. I have no illusions of earning any money from this, but as a researcher, I am very much into getting and giving credit where credit is due.<br /> The algorithm is described in detail in the scientific article, and it should not be a huge effort to re-implement it from the description and use it for any purpose if the MIT license doesn't cut it for you. Of course, if you have a specific use in mind, I would be happy to negotiate an individual license for your particular needs. (Don't worry, I'm cheap. I just want some level of control over where my code is used commercially.)</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-605008/license">License</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-605008#post-1659236</guid>
				<title>License</title>
				<link>http://contourtextures.wikidot.com/forum/t-605008/license#post-1659236</link>
				<description></description>
				<pubDate>Wed, 19 Dec 2012 11:04:07 +0000</pubDate>
				<wikidot:authorName>hronet</wikidot:authorName>				<wikidot:authorUserId>1513681</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi</p> <p>I was wondering about the use of GNUGPL - it essentially makes it impossible to use the software in any commercial product. Would it be meaningful to change it to either public domain, the MIT License, or the zlib-license?<br /> (in descending order of usefulness)</p> <p>Thanks!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-605008/license">License</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-442136#post-1374505</guid>
				<title>Re: Unity C# version</title>
				<link>http://contourtextures.wikidot.com/forum/t-442136/unity-c-version#post-1374505</link>
				<description></description>
				<pubDate>Wed, 15 Feb 2012 12:56:44 +0000</pubDate>
				<wikidot:authorName>Jasper Flick</wikidot:authorName>				<wikidot:authorUserId>1304472</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Glad you appreciate it!</p> <p>I have made a unity package for it. It contains the above code, an editor class that makes an editor window for it, and the GNU GPL. You can find it, along with documentation, over at catlikecoding.com/unity/products/distance-map-generator/</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-442136/unity-c-version">Unity C# version</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-442136#post-1372887</guid>
				<title>Re: Unity C# version</title>
				<link>http://contourtextures.wikidot.com/forum/t-442136/unity-c-version#post-1372887</link>
				<description></description>
				<pubDate>Mon, 13 Feb 2012 08:11:43 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thank you very much! It's nice to see my code being used<br /> and tweaked, and to see contour rendering catching on!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-442136/unity-c-version">Unity C# version</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-442136#post-1371186</guid>
				<title>Unity C# version</title>
				<link>http://contourtextures.wikidot.com/forum/t-442136/unity-c-version#post-1371186</link>
				<description></description>
				<pubDate>Fri, 10 Feb 2012 17:15:54 +0000</pubDate>
				<wikidot:authorName>Jasper Flick</wikidot:authorName>				<wikidot:authorUserId>1304472</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi!</p> <p>I'm working on a text tool for the Unity3D game engine and I included a C# version of the EDTAA algorithm to create nice distance maps from font atlases. The Generate method takes the alpha channel of a source texture and generates the distances from that, either outside, inside, or both. Beyond that, it's conceptually the same code as edtaa3 and the post process part, although I approached a few things differently.</p> <p>Though it's Unity3D specific, it shouldn't be too hard to integrate the C# code into a non-Unity project.</p> <div class="code"> <pre><code>using UnityEngine; /// &lt;summary&gt; /// Utility class for generating distance maps from anti-aliased alpha maps. /// &lt;/summary&gt; public static class CCDistanceMapGenerator { /// &lt;summary&gt; /// How to fill the RGB channels of the generated distance map /// &lt;/summary&gt; public enum RGBMode { /// &lt;summary&gt; /// Set the RGB channels to 1. /// &lt;/summary&gt; White, /// &lt;summary&gt; /// Set the RGB channels to 0. /// &lt;/summary&gt; Black, /// &lt;summary&gt; /// Set the RGB channels to the computed distance. /// &lt;/summary&gt; Distance, /// &lt;summary&gt; /// Copy the source texture's RGB channels. /// &lt;/summary&gt; Source } private class Pixel { public float alpha, distance; public Vector2 gradient; public int dX, dY; } private static int width, height; private static Pixel[,] pixels; /// &lt;summary&gt; /// Generates a distance texture from the alpha channel of a source texture. /// &lt;/summary&gt; /// &lt;param name=&quot;source&quot;&gt; /// The source texture. Alpha values of 1 are considered inside, values of 0 are considered outside, and any other values are considered /// to be on the edge. Make sure the texture is readable and not compressed. /// &lt;/param&gt; /// &lt;param name=&quot;destination&quot;&gt; /// The destination texture. Must be the same size as the source texture. /// &lt;/param&gt; /// &lt;param name=&quot;maxInside&quot;&gt; /// The maximum pixel distance measured inside the boundary, resulting in an alpha value of 1. /// If set to zero, everything inside will have an alpha value of 1. /// &lt;/param&gt; /// &lt;param name=&quot;maxOutside&quot;&gt; /// The maximum pixel distance measured outside the boundary, resulting in an alpha value of 0. /// If set to zero, everything outside will have an alpha value of 0. /// &lt;/param&gt; /// &lt;param name=&quot;postProcessDistance&quot;&gt; /// Pixel distance from the boundary which will be post-processed using the boundary gradient. /// &lt;/param&gt; /// &lt;param name=&quot;rgbMode&quot;&gt; /// How to fill the destination texture's RGB channels. /// &lt;/param&gt; public static void Generate (Texture2D source, Texture2D destination, float maxInside, float maxOutside, float postProcessDistance, RGBMode rgbMode) { if(source.height != destination.height || source.width != destination.width){ Debug.LogError(&quot;Source and destination textures must be the same size.&quot;); return; } try{ source.GetPixel(0, 0); } catch{ Debug.LogError(&quot;Source texture is not read/write enabled.&quot;); return; } width = source.width; height = source.height; pixels = new Pixel[width, height]; int x, y; float scale; Color c = rgbMode == RGBMode.White ? Color.white : Color.black; for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ pixels[x, y] = new Pixel(); } } if(maxInside &gt; 0f){ for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ pixels[x, y].alpha = 1f - source.GetPixel(x, y).a; } } ComputeEdgeGradients(); GenerateDistanceTransform(); if(postProcessDistance &gt; 0f){ PostProcess(postProcessDistance); } scale = 1f / maxInside; for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ c.a = Mathf.Clamp01(pixels[x, y].distance * scale); destination.SetPixel(x, y, c); } } } if(maxOutside &gt; 0f){ for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ pixels[x, y].alpha = source.GetPixel(x, y).a; } } ComputeEdgeGradients(); GenerateDistanceTransform(); if(postProcessDistance &gt; 0f){ PostProcess(postProcessDistance); } scale = 1f / maxOutside; if(maxInside &gt; 0f){ for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ c.a = 0.5f + (destination.GetPixel(x, y).a - Mathf.Clamp01(pixels[x, y].distance * scale)) * 0.5f; destination.SetPixel(x, y, c); } } } else{ for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ c.a = Mathf.Clamp01(1f - pixels[x, y].distance * scale); destination.SetPixel(x, y, c); } } } } if(rgbMode == RGBMode.Distance){ for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ c = destination.GetPixel(x, y); c.r = c.a; c.g = c.a; c.b = c.a; destination.SetPixel(x, y, c); } } } else if(rgbMode == RGBMode.Source){ for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ c = source.GetPixel(x, y); c.a = destination.GetPixel(x, y).a; destination.SetPixel(x, y, c); } } } pixels = null; } private static void ComputeEdgeGradients () { float sqrt2 = Mathf.Sqrt(2f); for(int y = 1; y &lt; height - 1; y++){ for(int x = 1; x &lt; width - 1; x++){ Pixel p = pixels[x, y]; if(p.alpha &gt; 0f &amp;&amp; p.alpha &lt; 1f){ // estimate gradient of edge pixel using surrounding pixels float g = - pixels[x - 1, y - 1].alpha - pixels[x - 1, y + 1].alpha + pixels[x + 1, y - 1].alpha + pixels[x + 1, y + 1].alpha; p.gradient.x = g + (pixels[x + 1, y].alpha - pixels[x - 1, y].alpha) * sqrt2; p.gradient.y = g + (pixels[x, y + 1].alpha - pixels[x, y - 1].alpha) * sqrt2; p.gradient.Normalize(); } } } } private static float ApproximateEdgeDelta (float gx, float gy, float a) { // (gx, gy) can be either the local pixel gradient or the direction to the pixel if(gx == 0f || gy == 0f){ // linear function is correct if both gx and gy are zero // and still fair if only one of them is zero return 0.5f - a; } // normalize (gx, gy) float length = Mathf.Sqrt(gx * gx + gy * gy); gx = gx / length; gy = gy / length; // reduce symmetrical equation to first octant only // gx &gt;= 0, gy &gt;= 0, gx &gt;= gy gx = Mathf.Abs(gx); gy = Mathf.Abs(gy); if(gx &lt; gy){ float temp = gx; gx = gy; gy = temp; } // compute delta float a1 = 0.5f * gy / gx; if(a &lt; a1){ // 0 &lt;= a &lt; a1 return 0.5f * (gx + gy) - Mathf.Sqrt(2f * gx * gy * a); } if(a &lt; (1f - a1)){ // a1 &lt;= a &lt;= 1 - a1 return (0.5f - a) * gx; } // 1-a1 &lt; a &lt;= 1 return -0.5f * (gx + gy) + Mathf.Sqrt(2f * gx * gy * (1f - a)); } private static void UpdateDistance (Pixel p, int x, int y, int oX, int oY) { Pixel neighbor = pixels[x + oX, y + oY]; Pixel closest = pixels[x + oX - neighbor.dX, y + oY - neighbor.dY]; if(closest.alpha == 0f || closest == p){ // neighbor has no closest yet // or neighbor's closest is p itself return; } int dX = neighbor.dX - oX; int dY = neighbor.dY - oY; float distance = Mathf.Sqrt(dX * dX + dY * dY) + ApproximateEdgeDelta(dX, dY, closest.alpha); if(distance &lt; p.distance){ p.distance = distance; p.dX = dX; p.dY = dY; } } private static void GenerateDistanceTransform () { // perform anti-aliased Euclidean distance transform int x, y; Pixel p; // initialize distances for(y = 0; y &lt; height; y++){ for(x = 0; x &lt; width; x++){ p = pixels[x, y]; p.dX = 0; p.dY = 0; if(p.alpha &lt;= 0f){ // outside p.distance = 1000000f; } else if (p.alpha &lt; 1f){ // on the edge p.distance = ApproximateEdgeDelta(p.gradient.x, p.gradient.y, p.alpha); } else{ // inside p.distance = 0f; } } } // perform 8SSED (eight-points signed sequential Euclidean distance transform) // scan up for(y = 1; y &lt; height; y++){ // |P. // |XX p = pixels[0, y]; if(p.distance &gt; 0f){ UpdateDistance(p, 0, y, 0, -1); UpdateDistance(p, 0, y, 1, -1); } // --&gt; // XP. // XXX for(x = 1; x &lt; width - 1; x++){ p = pixels[x, y]; if(p.distance &gt; 0f){ UpdateDistance(p, x, y, -1, 0); UpdateDistance(p, x, y, -1, -1); UpdateDistance(p, x, y, 0, -1); UpdateDistance(p, x, y, 1, -1); } } // XP| // XX| p = pixels[width - 1, y]; if(p.distance &gt; 0f){ UpdateDistance(p, width - 1, y, -1, 0); UpdateDistance(p, width - 1, y, -1, -1); UpdateDistance(p, width - 1, y, 0, -1); } // &lt;-- // .PX for(x = width - 2; x &gt;= 0; x--){ p = pixels[x, y]; if(p.distance &gt; 0f){ UpdateDistance(p, x, y, 1, 0); } } } // scan down for(y = height - 2; y &gt;= 0; y--){ // XX| // .P| p = pixels[width - 1, y]; if(p.distance &gt; 0f){ UpdateDistance(p, width - 1, y, 0, 1); UpdateDistance(p, width - 1, y, -1, 1); } // &lt;-- // XXX // .PX for(x = width - 2; x &gt; 0; x--){ p = pixels[x, y]; if(p.distance &gt; 0f){ UpdateDistance(p, x, y, 1, 0); UpdateDistance(p, x, y, 1, 1); UpdateDistance(p, x, y, 0, 1); UpdateDistance(p, x, y, -1, 1); } } // |XX // |PX p = pixels[0, y]; if(p.distance &gt; 0f){ UpdateDistance(p, 0, y, 1, 0); UpdateDistance(p, 0, y, 1, 1); UpdateDistance(p, 0, y, 0, 1); } // --&gt; // XP. for(x = 1; x &lt; width; x++){ p = pixels[x, y]; if(p.distance &gt; 0f){ UpdateDistance(p, x, y, -1, 0); } } } } private static void PostProcess (float maxDistance) { // adjust distances near edges based on the local edge gradient for(int y = 0; y &lt; height; y++){ for(int x = 0; x &lt; width; x++){ Pixel p = pixels[x, y]; if((p.dX == 0 &amp;&amp; p.dY == 0) || p.distance &gt;= maxDistance){ // ignore edge, inside, and beyond max distance continue; } float dX = p.dX, dY = p.dY; Pixel closest = pixels[x - p.dX, y - p.dY]; Vector2 g = closest.gradient; if(g.x == 0f &amp;&amp; g.y == 0f){ // ignore unknown gradients (inside) continue; } // compute hit point offset on gradient inside pixel float df = ApproximateEdgeDelta(g.x, g.y, closest.alpha); float t = dY * g.x - dX * g.y; float u = -df * g.x + t * g.y; float v = -df * g.y - t * g.x; // use hit point to compute distance if(Mathf.Abs(u) &lt;= 0.5f &amp;&amp; Mathf.Abs(v) &lt;= 0.5f){ p.distance = Mathf.Sqrt((dX + u) * (dX + u) + (dY + v) * (dY + v)); } } } } }</code></pre></div> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-442136/unity-c-version">Unity C# version</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1314890</guid>
				<title>Re: help</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1314890</link>
				<description></description>
				<pubDate>Sat, 26 Nov 2011 22:10:45 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>In a different thread in this forum you will find a C port of the texture creation program. It takes a grayscale TGA file as input. Please have a look at that. If that is not what you want, I must ask you to explain your problem in more detail. I still do not understand what you are trying to do.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1314886</guid>
				<title>help</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1314886</link>
				<description></description>
				<pubDate>Sat, 26 Nov 2011 21:44:39 +0000</pubDate>
				<wikidot:authorName>htemp</wikidot:authorName>				<wikidot:authorUserId>946731</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Bonsoir,<br /> Au départ je veux vous remercie infiniment de m'avoir aidez.<br /> Je sais que je ne devais pas me plaindre, mais je ne sais pas quoi faire, je me suis bloqué dans ce domaine : je cherche et je cherche, je lis et relis sans résultat. Je reviens vers vous tous après une longue période de vous informer que j’ai rien fait. J’ai essayé d’exécuter votre programme (texture_creation), J’ai essayé de le convertir en langage C, et je n’ai jamais arrivé.<br /> Le problème est que je n’ai pas une stratégie à suivre, je vous souhaite d’avoir me guider.<br /> Je vous remercie encore une fois.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1275055</guid>
				<title></title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1275055</link>
				<description></description>
				<pubDate>Thu, 06 Oct 2011 09:28:57 +0000</pubDate>
				<wikidot:authorName>htemp</wikidot:authorName>				<wikidot:authorUserId>946731</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Merci,<br /> Maintenant j'essaye de programmer votre algorithme pour générer l'image d'entrée, et celle de Green pour faire une comparaison entre les deux. Et dans le futur, je vais chercher ma méthode.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1274675</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1274675</link>
				<description></description>
				<pubDate>Wed, 05 Oct 2011 21:59:27 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I can read French. I am not good at writing it, but I can understand it<br /> well enough to work my way through shorter texts. An automatic translation<br /> also makes a lot more sense if you include your French original, so<br /> feel free to write me using either language, or both!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1274626</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1274626</link>
				<description></description>
				<pubDate>Wed, 05 Oct 2011 21:26:04 +0000</pubDate>
				<wikidot:authorName>htemp</wikidot:authorName>				<wikidot:authorUserId>946731</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thank you very much for your answers that have been targeted.</p> <p>I have some difficulty to form sentences because I write in French after I use a translator to translate them into English, that's why you can not follow me &#8230; Even I shot it a lot information from your answers.<br /> Now I tried your method programmed to generate the input image. And do a little comparison with Green. And then I'll look for another method suitable for me.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1271191</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1271191</link>
				<description></description>
				<pubDate>Sat, 01 Oct 2011 11:19:19 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>The bugs I saw were not with the code. Rather, it appears that<br /> the TGA files I used for testing have been corrupted. Two have<br /> noise in some scanlines (shape2 and shape3), and one refuses<br /> to parse (shape4). The code appears to work on ATI and Nvidia<br /> hardware alike. It's not fast on weak GPUs, but it's probably<br /> still faster than doing it in software.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1271170</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1271170</link>
				<description></description>
				<pubDate>Sat, 01 Oct 2011 10:29:00 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Now the AA version is there too (same address). Note that the code<br /> has not been touched for some time, and that it is probably not my<br /> proudest handiwork. It was a very fast hack, but it worked and<br /> seemed to give the correct results on my Nvidia card at work.<br /> Now the result seems to be wrong for some of the test images<br /> when trying it on my ATI card at home, but I don't have the<br /> time to find the bug.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1271169</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1271169</link>
				<description></description>
				<pubDate>Sat, 01 Oct 2011 10:15:39 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Sorry, that was the non-AA version. Still useful, but not AA.<br /> The AA version is not online yet. I'll get back to you in a few minutes on this.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1271168</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1271168</link>
				<description></description>
				<pubDate>Sat, 01 Oct 2011 10:10:41 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Sure. It's just a quick reimplementation of what I read in a fairly recent<br /> PhD dissertation by Guodong Rong (<a href="http://www.comp.nus.edu.sg/~tants/jfa.html">http://www.comp.nus.edu.sg/~tants/jfa.html</a>),<br /> an algorithm he calls &quot;jump flooding&quot;, with an added linear AA evaluation<br /> of the distance. The source code is here, and it's public domain:</p> <p><a href="http://www.itn.liu.se/~stegu/JFA/">http://www.itn.liu.se/~stegu/JFA/</a></p> <p>The PDF in that folder is a 1979 article by a former colleague of mine<br /> (now retired, but still very much alive) where a brief mention is made<br /> of the possibility to compute &quot;jump flooding&quot; algorithm. He never actually<br /> implemented it in parallel hardware at the time, though. He pursued<br /> sequential algorithms instead, which performed better back then.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-396481#post-1271163</guid>
				<title>Re: Sharp Corners</title>
				<link>http://contourtextures.wikidot.com/forum/t-396481/sharp-corners#post-1271163</link>
				<description></description>
				<pubDate>Sat, 01 Oct 2011 09:49:07 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>No, my method is just an improvement of the computation of the distance field.<br /> It's the same algorithm for rendering, hence it has the same problems with corners.<br /> It's not the optimal representation for font glyphs, but it most definitely gives you<br /> more detail per byte than what you would get with an ordinary bitmap.<br /> This is not a method to store and render scalable vector fonts for general use,<br /> but a real time method for getting rid of pixeled and/or blurry edges in contour<br /> textures.</p> <p>I did a version with different interpolation with explicit gradients, but that<br /> rounds off corners even more, and adds some wobbliness near them.<br /> The advantage is a smooth outline (C2 continuous), but it comes at<br /> the cost of wobbling near corners and when features get too thin, and a<br /> larger requirement on storage (local gradients need to be stored as well).<br /> A link to that alternate demo is here:<br /> <a href="http://contourtextures.wikidot.com/forum/t-188436/artefacts-in-the-demo">http://contourtextures.wikidot.com/forum/t-188436/artefacts-in-the-demo</a><br /> I don't recommend that method. I think it's better to double the resolution<br /> of the plain distance field instead - it gives better looking results using the<br /> same amount of texture storage.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-396481/sharp-corners">Sharp Corners</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-396481#post-1270620</guid>
				<title>Sharp Corners</title>
				<link>http://contourtextures.wikidot.com/forum/t-396481/sharp-corners#post-1270620</link>
				<description></description>
				<pubDate>Fri, 30 Sep 2011 13:08:14 +0000</pubDate>
				<wikidot:authorName>MeepMeep</wikidot:authorName>				<wikidot:authorUserId>220256</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Does your algorithm handle sharp corners better than Valve's method?</p> <p>With Valve's method sharp corners turn into rounded corners as mentioned in their paper. Their solution for this, a channel for each edge, doesn't really seem like a good fit for something like a text glyph.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-396481/sharp-corners">Sharp Corners</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1270617</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1270617</link>
				<description></description>
				<pubDate>Fri, 30 Sep 2011 13:03:37 +0000</pubDate>
				<wikidot:authorName>MeepMeep</wikidot:authorName>				<wikidot:authorUserId>220256</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Can you post your &quot;simple, linear approximation of my AA EDT algorithm in GLSL&quot;?<br /> I would like to take a look at it.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-388164#post-1251234</guid>
				<title>Trying to contact author Stefan Gustavson</title>
				<link>http://contourtextures.wikidot.com/forum/t-388164/trying-to-contact-author-stefan-gustavson#post-1251234</link>
				<description></description>
				<pubDate>Mon, 05 Sep 2011 21:54:03 +0000</pubDate>
				<wikidot:authorName>garyo</wikidot:authorName>				<wikidot:authorUserId>1190791</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I have some questions about some of your older work, on Perlin's simplex noise. I'm implementing it and my version has subtle artifacts; I'd like to see your paper and possibly ask you about the distance function and size of the simplexes. But there is no access to your papers right now, so I can't even find your email! If you read this and don't mind contacting me, I am <span class="wiki-email">moc.straneg|oyrag#moc.straneg|oyrag</span>. Perhaps you could just send me a PDF copy directly?</p> <p>Thanks,</p> <p>&#8212; Gary Oberbrunner</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82439">Hidden / Deleted threads</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-388164/trying-to-contact-author-stefan-gustavson">Trying to contact author Stefan Gustavson</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1216088</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1216088</link>
				<description></description>
				<pubDate>Sat, 30 Jul 2011 13:05:47 +0000</pubDate>
				<wikidot:authorName>Nicolas Rougier</wikidot:authorName>				<wikidot:authorUserId>1034415</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I sent you an email (hope I did go through your spam filter).</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1215237</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1215237</link>
				<description></description>
				<pubDate>Fri, 29 Jul 2011 10:34:26 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I have now had a closer look at freetype-gl. I like it a lot!<br /> It is very much along the same lines as I had plans to do,<br /> only you made it better. :)</p> <p>I also like the fact that you are using plain C, which is<br /> still my favorite language for many tasks. If there is<br /> anything I can do to help, let me know. I'd be happy to<br /> do some actual work here. My work email address, as<br /> you probably know, is &quot;stegu -at- itn.liu.se&quot;.</p> <p>Apart from the GPL version on Google Code, you could<br /> consider licensing this on commercial terms to game developers<br /> and VR software creators. They sure need it, they just don't<br /> know it.</p> <p>I would also like to suggest this to the &quot;news&quot; headlines on<br /> opengl.org, but I am not sure what state the code is in right<br /> now, or how prepared you are for a larger audience to try<br /> it out and comment on it. It is clearly a library that many<br /> people should find very useful, but I'll wait for your input.</p> <p>Please drop me an email! I think we should talk more.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1215225</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1215225</link>
				<description></description>
				<pubDate>Fri, 29 Jul 2011 10:03:39 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Minification needs a &quot;guard zone&quot; around the glyph to work well, i.e. you need to extend the distance field image to a few pixels beyond a snug fit to the glyph outline. You might want to try that if minification is really ugly. In any case, it will not create as legible type at sizes typically used for body text as if you do it the traditional way, with hinting and/or pre-computed bitmaps for low resolution glyphs. The distance field method is more suitable for large type. Minification should not alias, but it will probably blur too much to maintain good readability. Type scaling for small sizes is, as you probably know, something of a black art.</p> <p>Note that the GLSL shader based distance field generation is not anti-aliased, it is a classic binary transform. I have the simple, linear approximation of my AA EDT algorithm in GLSL if you want it - just let me know and I'll put in on the web and post a link. It is really a no-brainer, just using the grayscale value to adjust the distance, but it still improves the precision considerably over a binary transform if you have an AA input image.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1215176</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1215176</link>
				<description></description>
				<pubDate>Fri, 29 Jul 2011 08:49:08 +0000</pubDate>
				<wikidot:authorName>Nicolas Rougier</wikidot:authorName>				<wikidot:authorUserId>1034415</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks for the explanation.</p> <p>For freetype-gl, it's exactly what I did, using the Freetype library for generating aa-glyphs and using your code to build the distance field. It works great for magnification but is not so good at minification.</p> <p>The shader/distance generation works flawlessly on my machine (mac). Very, very fast by the way.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1212388</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1212388</link>
				<description></description>
				<pubDate>Tue, 26 Jul 2011 14:01:58 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Sorry for being unclear. What I meant by &quot;ripping&quot; was the process of creating distance field glyph descriptions from scalable contour descriptions, in my case a PostScript font. One way would be to use GhostScript for anti-aliased rendering of individual glyphs and then apply my anti-aliased distance transform to the result. I have not put this into a common framework, but I have working code for most of the steps that are needed. That's where I think I would have skills to contribute.</p> <p>I also have a working OpenGL (GLSL) implementation of a distance transform that could speed up the distance field generation greatly if the contours can be drawn with OpenGL. It's not AA yet, but it can be extended to include that:<br /> <a href="http://www.itn.liu.se/~stegu/JFA">http://www.itn.liu.se/~stegu/JFA</a></p> <p>I realize I used the word &quot;ripping&quot; in a very nerdy double meaning. &quot;RIP&quot; was originally used in the graphic arts as an acronym for &quot;raster image processing&quot;, meaning the rendering of a high level page description (e.g. in PostScript) into a pixel-based high resolution image suitable for exposure by a laser typesetter. More recently, &quot;ripping&quot; has taken on a meaning of converting digital media (e.g. music or video files) into a different format which is more suitable for a certain task. Both of these meanings apply to what I had in mind here.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1212211</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1212211</link>
				<description></description>
				<pubDate>Tue, 26 Jul 2011 09:04:09 +0000</pubDate>
				<wikidot:authorName>Nicolas Rougier</wikidot:authorName>				<wikidot:authorUserId>1034415</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>What do you mean by &quot;ripping&quot; the contour ?</p> <p>By the way, I've added some code to handle outline and glow, see website and source code for corresponding fragment shader.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1207318</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1207318</link>
				<description></description>
				<pubDate>Thu, 21 Jul 2011 21:27:20 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Now, THAT is great news!</p> <p>I have had dreams of making a text/glyph rendering API with this method for a good while, but I have never found the time to put any serious amount of work into it. I have some scraps of paper with bits and pieces of a possible solution, and I wrote a PostScript glyph rendering snippet to create high-resolution AA images of all glyphs in a font using GhostScript, but I never got around to wrapping it up. It's rather more work than I could manage on my own, I think, but I would still be interested in contributing to an OpenGL text rendering API, including the bit that &quot;rips&quot; the contours, i.e. converts contour graphics glyphs to distance field sprites. I have a fairly strong background in PostScript and digital typography, and I would love to see an API that would put a stop to the ubiquitous pixelated text in games and other real time content.</p> <p>Thanks for your contributions! It makes me want to do more myself.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1206776</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1206776</link>
				<description></description>
				<pubDate>Thu, 21 Jul 2011 07:56:05 +0000</pubDate>
				<wikidot:authorName>Nicolas Rougier</wikidot:authorName>				<wikidot:authorUserId>1034415</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I've also integrated it into freetype-gl (<a href="http://code.google.com/p/freetype-gl/">http://code.google.com/p/freetype-gl/</a>) using shaders from <a href="http://ofps.oreilly.com/titles/9780596804824/ch2d.html#ch07_id36000844">http://ofps.oreilly.com/titles/9780596804824/ch2d.html#ch07_id36000844</a> (iPhone 3D programming).</p> <p>Results:</p> <p><a href="http://freetype-gl.googlecode.com/svn/wiki/images/distance-field-1.png">http://freetype-gl.googlecode.com/svn/wiki/images/distance-field-1.png</a></p> <p><a href="http://freetype-gl.googlecode.com/svn/wiki/images/distance-field-2.png">http://freetype-gl.googlecode.com/svn/wiki/images/distance-field-2.png</a></p> <p>vertex shader source:</p> <div class="code"> <pre><code>void main(void) { gl_TexCoord[0].xy = gl_MultiTexCoord0.xy; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }</code></pre></div> <p>fragment shader source:</p> <div class="code"> <pre><code>uniform sampler2D texture; const float outline_center = 0.10; const float smooth_center = 0.50; void main(void) { vec4 color = texture2D( texture, gl_TexCoord[0].st ); float dist = color.a; vec3 rgb = color.xyz; float width = fwidth(dist); float alpha = smoothstep(smooth_center - width, smooth_center + width, dist); gl_FragColor = vec4(rgb, alpha); }</code></pre></div> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1206309</guid>
				<title>Re: C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1206309</link>
				<description></description>
				<pubDate>Wed, 20 Jul 2011 19:02:13 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks! This is probably quite useful to people who want to put this to actual use. Octave solves my problems, but being dependent on a huge package like Octave just to read and write images and link to some C code is pretty stupid, I can definitely agree on that. :)</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-374611#post-1205391</guid>
				<title>C version only</title>
				<link>http://contourtextures.wikidot.com/forum/t-374611/c-version-only#post-1205391</link>
				<description></description>
				<pubDate>Tue, 19 Jul 2011 17:38:06 +0000</pubDate>
				<wikidot:authorName>Nicolas Rougier</wikidot:authorName>				<wikidot:authorUserId>1034415</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi,</p> <p>Here is a C only version of the matlab/octave code. It only needs edtaa3func.c.<br /> Hope this is useful.</p> <p>Nicolas</p> <div class="code"> <pre><code>#include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;stdio.h&gt; #include &lt;math.h&gt; #include &quot;edtaa3func.c&quot; // Define some fixed size types. typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; // TGA Header struct to make it simple to dump a TGA to disc. #if defined(_MSC_VER) || defined(__GNUC__) #pragma pack(push, 1) #pragma pack(1) // Dont pad the following struct. #endif typedef struct _TGA_header { uint8 idLength, // Length of optional identification sequence. paletteType, // Is a palette present? (1=yes) imageType; // Image data type (0=none, 1=indexed, 2=rgb, // 3=grey, +8=rle packed). uint16 firstPaletteEntry, // First palette index, if present. numPaletteEntries; // Number of palette entries, if present. uint8 paletteBits; // Number of bits per palette entry. uint16 x, // Horiz. pixel coord. of lower left of image. y, // Vert. pixel coord. of lower left of image. width, // Image width in pixels. height; // Image height in pixels. uint8 depth, // Image color depth (bits per pixel). descriptor; // Image attribute flags. } TGA_header; #if defined(_MSC_VER) || defined(__GNUC__) #pragma pack(pop) #endif int TGA_write( char * filename, unsigned int width, unsigned int height, unsigned char *data ) { TGA_header header; memset( &amp;header, 0, sizeof(TGA_header) ); header.imageType = 3; header.width = width; header.height = height; header.depth = 8; header.descriptor = 0x20; FILE *file; file = fopen(filename, &quot;wb&quot;); if( !file ) { fprintf(stderr, &quot;Failed to write file\n&quot;); return 0; } fwrite( (const char *) &amp;header, sizeof(TGA_header), 1, file ); fwrite( data, sizeof(unsigned char), width * height, file); fclose(file); return 1; } unsigned char *TGA_read( char *filename, unsigned int * width, unsigned int * height, unsigned int * depth ) { FILE *file; unsigned char type[4]; unsigned char info[6]; file = fopen( filename, &quot;rb&quot; ); if( !file ) { return 0; } fread( &amp;type, sizeof (char), 3, file ); fseek( file, 12, SEEK_SET ); fread( &amp;info, sizeof (char), 6, file ); /* Only image type (color) or 3 (greyscale) */ if( type[1] != 0 || (type[2] != 2 &amp;&amp; type[2] != 3) ) { fclose( file ); return 0; } *width = info[0] + info[1] * 256; *height = info[2] + info[3] * 256; *depth = info[4] / 8; if( *depth != 1 &amp;&amp; *depth != 3 &amp;&amp; *depth != 4 ) { fclose(file); return 0; } // Allocate memory for image data unsigned long size = *height * *width * *depth; unsigned char *data = (unsigned char *) malloc( size * sizeof(unsigned char) ); // Read in image data fread( data, sizeof(unsigned char), size, file ); fclose( file ); return data; } unsigned char * make_distance_map( unsigned char *img, unsigned int width, unsigned int height ) { short * xdist = (short *) malloc( width * height * sizeof(short) ); short * ydist = (short *) malloc( width * height * sizeof(short) ); double * gx = (double *) calloc( width * height, sizeof(double) ); double * gy = (double *) calloc( width * height, sizeof(double) ); double * data = (double *) calloc( width * height, sizeof(double) ); double * outside = (double *) calloc( width * height, sizeof(double) ); double * inside = (double *) calloc( width * height, sizeof(double) ); int i; // Convert img into double (data) double img_min = 255, img_max = -255; for( i=0; i&lt;width*height; ++i) { double v = img[i]; data[i] = v; if (v &gt; img_max) img_max = v; if (v &lt; img_min) img_min = v; } // Rescale image levels between 0 and 1 for( i=0; i&lt;width*height; ++i) { data[i] = (img[i]-img_min)/img_max; } // Compute outside = edtaa3(bitmap); % Transform background (0's) computegradient( data, height, width, gx, gy); edtaa3(data, gx, gy, height, width, xdist, ydist, outside); for( i=0; i&lt;width*height; ++i) if( outside[i] &lt; 0 ) outside[i] = 0.0; // Compute inside = edtaa3(1-bitmap); % Transform foreground (1's) memset(gx, 0, sizeof(double)*width*height ); memset(gy, 0, sizeof(double)*width*height ); for( i=0; i&lt;width*height; ++i) data[i] = 1 - data[i]; computegradient( data, height, width, gx, gy); edtaa3(data, gx, gy, height, width, xdist, ydist, inside); for( i=0; i&lt;width*height; ++i) if( inside[i] &lt; 0 ) inside[i] = 0.0; // distmap = outside - inside; % Bipolar distance field unsigned char *out = (unsigned char *) malloc( width * height * sizeof(unsigned char) ); for( i=0; i&lt;width*height; ++i) { outside[i] -= inside[i]; outside[i] = 128+outside[i]*16; if( outside[i] &lt; 0 ) outside[i] = 0; if( outside[i] &gt; 255 ) outside[i] = 255; out[i] = 255 - (unsigned char) outside[i]; } free( xdist ); free( ydist ); free( gx ); free( gy ); free( data ); free( outside ); free( inside ); return out; } int main( int argc, char **argv ) { unsigned int width=0, height=0, depth=0; unsigned char *img = TGA_read(&quot;texture.tga&quot;, &amp;width, &amp;height, &amp;depth); if (!img) { fprintf( stderr, &quot;Failed to read image !\n&quot; ); return EXIT_FAILURE; } printf(&quot;Image dimension: %d x %d x %d\n&quot;, width, height, depth); if (depth != 1) { fprintf( stderr, &quot;Image has to be grayscale !\n&quot; ); free(img); return EXIT_FAILURE; } unsigned char *out = make_distance_map(img, width, height); TGA_write(&quot;texture-distance.tga&quot;, width, height, out); free(img); free(out); return EXIT_SUCCESS; }</code></pre></div> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-374611/c-version-only">C version only</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1203027</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1203027</link>
				<description></description>
				<pubDate>Sat, 16 Jul 2011 09:51:40 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Rainy vacation day, lots of time to think.</p> <p>Just to clarify: Pradeep Sen's &quot;silhouette maps&quot; is an early, pioneering<br /> attempt to render contours. It still works, but I would really recommend<br /> you to look at more recent methods that can also render curved<br /> contours. Lots of authors have looked at this since Sen's paper.<br /> Sen's method (and similar ones) also requires you to encode the contours<br /> explicitly, which requires rather a lot of computations on 2D curves.<br /> Distance field based methods like mine will do everything for yo<br /> - just compute a distance field from a bitmap and you're set.<br /> Antialiasing on minification is also handled better by a distance field.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1199332</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1199332</link>
				<description></description>
				<pubDate>Mon, 11 Jul 2011 23:14:39 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I am sorry, but I do not understand what you are asking.<br /> Please clarify your question if you can.</p> <p>I find no question in your message except for the phrase<br /> &quot;how can we read the vector graphics in C++&quot;.<br /> This is shader programming, in GLSL, and I do not<br /> understand where or how C++ would be needed.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1190401</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1190401</link>
				<description></description>
				<pubDate>Thu, 30 Jun 2011 10:13:31 +0000</pubDate>
				<wikidot:authorName>htemp</wikidot:authorName>				<wikidot:authorUserId>946731</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hello,<br /> I’m delighted to find you another time in this show.<br /> Bah, I looked over your work and I found nothing, I diverted to the work of Sen Parade above the silhouette map. This stocks in the alpha the coordinates of contours and when rendering, it has a formula to generate the pixel color.<br /> I do not know what I quoted is correct or not?<br /> Also I have questions and I will be very grateful if you answer me, How can we read the vector graphics with C + +.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-367798#post-1183549</guid>
				<title>Re: Bug Fix</title>
				<link>http://contourtextures.wikidot.com/forum/t-367798/bug-fix#post-1183549</link>
				<description></description>
				<pubDate>Tue, 21 Jun 2011 18:46:29 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks! You hit a corner case I never encountered,<br /> and I am still puzzled why it occurs. Both the stored<br /> distance and the newly computed distance are doubles,<br /> and the stored value is computed by exactly the same<br /> code as the new value.</p> <p>I would expect an error like this if I had compared a<br /> float and a double, or relied on two different computations<br /> of a complicated expression where e.g. the terms were<br /> summed in different order to return exactly the same<br /> result, but this puzzles me. Anyway, thanks for the fix!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-367798/bug-fix">Bug Fix</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-367798#post-1183364</guid>
				<title>Bug Fix</title>
				<link>http://contourtextures.wikidot.com/forum/t-367798/bug-fix#post-1183364</link>
				<description></description>
				<pubDate>Tue, 21 Jun 2011 14:20:28 +0000</pubDate>
				<wikidot:authorName>trigrou</wikidot:authorName>				<wikidot:authorUserId>993936</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi,<br /> I tried the code but on my hardware it runs infinitely. Looking and debugging with printf inside edtaa3func.c it seems that it does not converge maybe because of floating point error.<br /> So I introduced a threshold to let the do while a chance to quit the function.</p> <p>I put the code on github<br /> <a href="https://github.com/cedricpinson/DistanceMapGenerator">https://github.com/cedricpinson/DistanceMapGenerator</a></p> <p>Cedric</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-367798/bug-fix">Bug Fix</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1167341</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1167341</link>
				<description></description>
				<pubDate>Wed, 01 Jun 2011 09:29:49 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>OK, good luck! Please let me know if you create<br /> anything fun with my code and this method.</p> <p>/Stefan G</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1166609</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1166609</link>
				<description></description>
				<pubDate>Tue, 31 May 2011 15:05:42 +0000</pubDate>
				<wikidot:authorName>htemp</wikidot:authorName>				<wikidot:authorUserId>946731</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>First, I want to thank you for your reply which was clear and focused.</p> <p>I started reading the document and your code, if I find any problems I will contact you.<br /> and thank you again.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1165013</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1165013</link>
				<description></description>
				<pubDate>Sun, 29 May 2011 15:57:22 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>You can see the code for both the distance field generation and the real time rendering in the downloads and the demo I have posted on this site. Neither is a big problem, and both are useful. I encourage you to read the code. It is the best source of detailed information, and I published it so that people should be able to read it and make use of it, instead of having to re-implement everything in their own code.</p> <p>Green used pixel images and a distance transform, just like I do. Neither Green's work nor my work is limited to any particular class of images, except that we both assume that the image is a strictly binary contour (i.e. only two colors, foreground and background), and that the contour can be represented reasonably well by a bitmap of limited resolution.</p> <p>The difference is that I take better care to do the distance transform with good accuracy using an anti-aliased input image. That is my scientific contribution. Green used very high resolution binary images as input, which is a problem in production. He also used a very crude (but good enough) algorithm for the distance transform. My method is a lot faster and can be performed on the fly if needed. It can even be implemented on the GPU. I have a GPU version of the distance transform without the antialiasing done, and I started doing the anti-aliased version but never got around to finishing it. The demo without AA is here:</p> <p><a href="http://www.itn.liu.se/~stegu/JFA/">Jump flooding algorithm in GLSL</a></p> <p>I can't offer any support for that code, but the method is explained in the article by Danielsson (a PDF is on the link above), and the GLSL details are presented in a fairly recent PhD dissertation by Guodong Rong. Google for &quot;Jump Flooding Algorithm&quot; and you will find it. As I said, I did a preliminary GPU implementation of my anti-aliased version. I did not finish it well enough to release it, but I can find the code and put it online if you are interested. It's just the simple version of the AA EDT, the one with the linear approximation to the distance function d_f, but at least it's more accurate than using a binary image as input.</p> <p>The real time rendering is basically the same in Green's work and mine, but I use a better (and more standard) method for finding the gradient vectors in the shader. An alternative is also to store the gradient explicitly with the distance image. Green used an explicit finite difference instead of the dFdx() and dFdy() functions in GLSL. His method is slower, and has accuracy problems on ATI hardware where texture interpolation is performed in a fixed point texture coordinate system.</p> <p>I hope that answered your questions. If not, ask again!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1164377</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1164377</link>
				<description></description>
				<pubDate>Sat, 28 May 2011 10:40:56 +0000</pubDate>
				<wikidot:authorName>htemp</wikidot:authorName>				<wikidot:authorUserId>946731</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>SEN and Qin worked with vector images, Green with glyphs. And you, you used bitmaps. I have a question that intrigues me, the problem is in the calculated the distance or rendering the image?.<br /> And thank you again</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1163476</guid>
				<title>Re: help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1163476</link>
				<description></description>
				<pubDate>Fri, 27 May 2011 10:43:03 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I do not understand what you are asking. What is it you do not understand, and what<br /> kind of help do you need? If you ask a specific question, I will try to help you, but I cannot respond in any useful manner to just a general request for assistance.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-363559#post-1163462</guid>
				<title>help for a new programmer in this area</title>
				<link>http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area#post-1163462</link>
				<description></description>
				<pubDate>Fri, 27 May 2011 09:59:08 +0000</pubDate>
				<wikidot:authorName>htemp</wikidot:authorName>				<wikidot:authorUserId>946731</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Firstly I want to thank you for your time and great effort you provide in this website.<br /> I am a new researcher in this field, and I try to evolve my knowledge. I have read several articles and yourself, I learn some concepts and it is not quite sure though.<br /> I took you to direct me,<br /> I am grateful for your attention to my letter.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-363559/help-for-a-new-programmer-in-this-area">help for a new programmer in this area</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-301472#post-980902</guid>
				<title>Re: Level Set Contour Textures</title>
				<link>http://contourtextures.wikidot.com/forum/t-301472/level-set-contour-textures#post-980902</link>
				<description></description>
				<pubDate>Sat, 22 Jan 2011 00:17:43 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks for the comment. An explanation is in order.</p> <p>That other article is formally unpublished work, originally submitted<br /> to a graphics journal but later retracted because it did not add<br /> enough substance to motivate an article. Compared to Green's<br /> rendering method, it adds little more than a variation, and it is<br /> not really any better, just slightly different when compared fairly<br /> to Green's method with the same amount of texture memory.<br /> (Storing the gradients explicitly to improve the quality requires<br /> memory that is just as well spent on increasing the resolution<br /> for Green's more straightforward method.)</p> <p>I do not recommend using that other method of mine.<br /> My advice is to use Green's method, possibly with 16-bit distance<br /> data instead of 8-bit to improve the rendering at larger distances,<br /> but use my better AA distance transform.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-301472/level-set-contour-textures">Level Set Contour Textures</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-301472#post-980488</guid>
				<title>Level Set Contour Textures</title>
				<link>http://contourtextures.wikidot.com/forum/t-301472/level-set-contour-textures#post-980488</link>
				<description></description>
				<pubDate>Fri, 21 Jan 2011 15:25:06 +0000</pubDate>
				<wikidot:authorName>Florian Oeser</wikidot:authorName>				<wikidot:authorUserId>684659</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hello,</p> <p>first off all i like to say thank you for the great paper you're providing here. I also found your paper &quot;Level Set Contour Textures&quot; <a href="http://webstaff.itn.liu.se/~stegu/contourtextures/">here</a>. Now i ask my self why this paper isn't also linked on this website because it wasn't easy to find it. Is it still under work and you haven't submit this? Or did i simple overseen something? :)</p> <p>I'm currently writing my bachelor thesis related to Chris Green's approach and i like to mention your papers (aaedt and lsctex). Is it possible to provide me a bibtex for lsctex?<br /> And furthermore i like to ask if i''m allowed to use some figures from maybe both of the papers. Actually i don't know exactly which ones but i thought it's a good idea to ask before in general.</p> <p>Thanks and regards,</p> <p>Florian Oeser</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-301472/level-set-contour-textures">Level Set Contour Textures</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-287422#post-936496</guid>
				<title>Re: Compiling demo on Mac OS X</title>
				<link>http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x#post-936496</link>
				<description></description>
				<pubDate>Sun, 28 Nov 2010 21:45:08 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Good to hear that someone is putting this to good use!<br /> If the GPL license for the SDF generation code is a problem<br /> for your particular application, let me know. I'm reasonable.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x">Compiling demo on Mac OS X</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-287422#post-936398</guid>
				<title>Re: Compiling demo on Mac OS X</title>
				<link>http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x#post-936398</link>
				<description></description>
				<pubDate>Sun, 28 Nov 2010 19:19:02 +0000</pubDate>
				<wikidot:authorName>Daniel Brauer</wikidot:authorName>				<wikidot:authorUserId>633061</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Great, that worked like a charm! Thanks very much.</p> <p>I'm working with the Unity game engine, and while writing shaders to display signed distance fields is fun and easy, I was disappointed that all the SDF generation tools seemed to be simplistic brute force approaches. I'm glad someone with a signal processing background has gotten involved. When I've got some time I'll put together a command line tool we can use in our pipeline. I'll drop by here again once I've done that.</p> <p>Thanks again!</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x">Compiling demo on Mac OS X</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-287422#post-936290</guid>
				<title>Re: Compiling demo on Mac OS X</title>
				<link>http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x#post-936290</link>
				<description></description>
				<pubDate>Sun, 28 Nov 2010 15:05:03 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>The Makefile is for OS X 10.5 and GLFW 2.6. Sorry about that.<br /> However, the solution is very simple. To make the demo<br /> compile under OS X 10.6 with GLFW 2.7, all you need to do<br /> is change &quot;-framework Carbon&quot; to &quot;-framework Cocoa&quot;.<br /> I think. That seemed to do the trick for me, at least.</p> <p>GLFW removed its dependency on the dated Carbon API<br /> in 2.7 and now uses the recommended Cocoa API instead.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x">Compiling demo on Mac OS X</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-287422#post-935914</guid>
				<title>Compiling demo on Mac OS X</title>
				<link>http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x#post-935914</link>
				<description></description>
				<pubDate>Sat, 27 Nov 2010 20:33:09 +0000</pubDate>
				<wikidot:authorName>Daniel Brauer</wikidot:authorName>				<wikidot:authorUserId>633061</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>First, I'd just like to say that this looks like an excellent idea. It always bothered me that other contour texture generators used only binary data, because that's not usually what you have. The easiest format to find for both vector images and fonts is anti-aliased bitmaps.</p> <p>I'm only just starting with this, but I can't get the demo to compile on my Mac. I've installed GLFW 2.7. It's been a while since I've compiled anything from the command line, so forgive me if I'm missing something obvious. Here's the output from gcc:</p> <div class="code"> <pre><code>/bin/sh bundle.sh GLSL-contourtextures gcc -o GLSL-contourtextures.app/Contents/MacOS/GLSL-contourtextures GLSL-contourtextures.c -lglfw -framework Carbon -framework AGL -framework OpenGL Undefined symbols: &quot;.objc_class_name_NSAutoreleasePool&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSAutoreleasePool in libglfw.a(cocoa_window.o) literal-pointer@__OBJC@__cls_refs@NSAutoreleasePool in libglfw.a(cocoa_init.o) &quot;_objc_msgSend_fpret&quot;, referenced from: -[GLFWContentView mouseMoved:] in libglfw.a(cocoa_window.o) -[GLFWContentView mouseMoved:] in libglfw.a(cocoa_window.o) -[GLFWContentView scrollWheel:] in libglfw.a(cocoa_window.o) __glfwPlatformSetTime in libglfw.a(cocoa_time.o) __glfwPlatformGetTime in libglfw.a(cocoa_time.o) &quot;.objc_class_name_NSBundle&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSBundle in libglfw.a(cocoa_init.o) &quot;.objc_class_name_NSOpenGLPixelFormat&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSOpenGLPixelFormat in libglfw.a(cocoa_window.o) &quot;.objc_class_name_NSOpenGLContext&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSOpenGLContext in libglfw.a(cocoa_window.o) &quot;.objc_class_name_NSString&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSString in libglfw.a(cocoa_window.o) literal-pointer@__OBJC@__cls_refs@NSString in libglfw.a(cocoa_init.o) &quot;.objc_class_name_NSScreen&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSScreen in libglfw.a(cocoa_window.o) &quot;.objc_class_name_NSMenu&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSMenu in libglfw.a(cocoa_init.o) &quot;_objc_msgSend_stret&quot;, referenced from: -[GLFWWindowDelegate windowDidResize:] in libglfw.a(cocoa_window.o) -[GLFWWindowDelegate windowDidResize:] in libglfw.a(cocoa_window.o) -[GLFWContentView mouseMoved:] in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowPos in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowPos in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowPos in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowPos in libglfw.a(cocoa_window.o) &quot;.objc_class_name_NSCursor&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSCursor in libglfw.a(cocoa_window.o) &quot;_objc_msgSendSuper&quot;, referenced from: -[GLFWContentView keyDown:] in libglfw.a(cocoa_window.o) -[GLFWApplication sendEvent:] in libglfw.a(cocoa_init.o) &quot;.objc_class_name_NSApplication&quot;, referenced from: .objc_class_name_GLFWApplication in libglfw.a(cocoa_init.o) &quot;_objc_msgSend&quot;, referenced from: __glfwPlatformPollEvents in libglfw.a(cocoa_window.o) __glfwPlatformPollEvents in libglfw.a(cocoa_window.o) __glfwPlatformPollEvents in libglfw.a(cocoa_window.o) __glfwPlatformPollEvents in libglfw.a(cocoa_window.o) __glfwPlatformPollEvents in libglfw.a(cocoa_window.o) __glfwPlatformPollEvents in libglfw.a(cocoa_window.o) __glfwPlatformWaitEvents in libglfw.a(cocoa_window.o) __glfwPlatformWaitEvents in libglfw.a(cocoa_window.o) __glfwPlatformWaitEvents in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformRefreshWindowParams in libglfw.a(cocoa_window.o) __glfwPlatformSwapInterval in libglfw.a(cocoa_window.o) __glfwPlatformSwapBuffers in libglfw.a(cocoa_window.o) __glfwPlatformRestoreWindow in libglfw.a(cocoa_window.o) __glfwPlatformIconifyWindow in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowSize in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowTitle in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowTitle in libglfw.a(cocoa_window.o) -[GLFWContentView otherMouseDragged:] in libglfw.a(cocoa_window.o) -[GLFWContentView rightMouseDragged:] in libglfw.a(cocoa_window.o) -[GLFWContentView mouseDragged:] in libglfw.a(cocoa_window.o) -[GLFWWindowDelegate windowDidResize:] in libglfw.a(cocoa_window.o) -[GLFWContentView otherMouseUp:] in libglfw.a(cocoa_window.o) -[GLFWContentView otherMouseDown:] in libglfw.a(cocoa_window.o) -[GLFWContentView mouseMoved:] in libglfw.a(cocoa_window.o) -[GLFWContentView mouseMoved:] in libglfw.a(cocoa_window.o) -[GLFWContentView flagsChanged:] in libglfw.a(cocoa_window.o) -[GLFWContentView flagsChanged:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyUp:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyUp:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyUp:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyUp:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyDown:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyDown:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyDown:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyDown:] in libglfw.a(cocoa_window.o) -[GLFWContentView keyDown:] in libglfw.a(cocoa_window.o) __glfwPlatformSetMouseCursorPos in libglfw.a(cocoa_window.o) __glfwPlatformShowMouseCursor in libglfw.a(cocoa_window.o) __glfwPlatformHideMouseCursor in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformCloseWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformOpenWindow in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowPos in libglfw.a(cocoa_window.o) __glfwPlatformSetWindowPos in libglfw.a(cocoa_window.o) -[GLFWApplication sendEvent:] in libglfw.a(cocoa_init.o) -[GLFWApplication sendEvent:] in libglfw.a(cocoa_init.o) -[GLFWApplication sendEvent:] in libglfw.a(cocoa_init.o) -[GLFWApplication sendEvent:] in libglfw.a(cocoa_init.o) __glfwPlatformTerminate in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) __glfwPlatformInit in libglfw.a(cocoa_init.o) &quot;.objc_class_name_NSWindow&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSWindow in libglfw.a(cocoa_window.o) &quot;.objc_class_name_NSMenuItem&quot;, referenced from: literal-pointer@__OBJC@__cls_refs@NSMenuItem in libglfw.a(cocoa_init.o) &quot;.objc_class_name_NSView&quot;, referenced from: .objc_class_name_GLFWContentView in libglfw.a(cocoa_window.o) &quot;_NSApp&quot;, referenced from: _NSApp$non_lazy_ptr in libglfw.a(cocoa_window.o) _NSApp$non_lazy_ptr in libglfw.a(cocoa_init.o) (maybe you meant: _NSApp$non_lazy_ptr) ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [GLSL-contourtextures] Error 1</code></pre></div> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-287422/compiling-demo-on-mac-os-x">Compiling demo on Mac OS X</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-245467#post-799288</guid>
				<title>Re: creating textures</title>
				<link>http://contourtextures.wikidot.com/forum/t-245467/creating-textures#post-799288</link>
				<description></description>
				<pubDate>Wed, 02 Jun 2010 22:16:44 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks for your interest! I have also been toying around with plans for doing a GL font API using this method, including a way to easily create a font from any PostScript font, but I have no idea when (or eve if) I will find the time to do it. My daytime job takes most of my programming focus right now, so I can't promise anything.</p> <p>The software you need to create textures from your own anti-aliased images is on the front page. Here's the link for clarity:</p> <p><a href="http://www.itn.liu.se/~stegu/aadist/texture_creation.zip">http://www.itn.liu.se/~stegu/aadist/texture_creation.zip</a></p> <p>I would say that 12 pixels is too small to make nice letters, but the exact size you need depends on how detailed the glyphs are (serif or sans-serif, hairlines or thick strokes) and how accurately you want them rendered. You could try a few sizes. Quality can be traded against texture size. Corners will be rounded off somewhat, and very thin features will disappear or render incorrectly. As I said, it is probably best to just try it out. 32 pixels would probably be OK for a fonts with simple shapes. An italic serif typeface would require more.</p> <p>Note that my texture creation software is a script for Octave or Matlab, i.e. this is &quot;research grade&quot; software, and it is not very user friendly. You need some Matlab-fu to use it. Most of my colleagues in image processing and computer graphics research are very familiar with Matlab, and this is how we usually share code to test new algorithms. When (if) I find the time to do that font system I mentioned above, the texture creation might be written as a standalone binary or at least a more self-contained Octave script, but for now, you will have to either use Matlab (expensive but good) or Octave (a free, GPL alternative that does the job but is less polished), or use my C code in the file &quot;edtaa2func.c&quot; and roll your own stand-alone program.</p> <p>Sorry I can't be of any more help here, but have a look at the archive in the link above and see whether you can make anything out of it. If that code does not help you, I am sorry to say that I can't really help you much more. There's definitely a high threshold to doing this, and there is still a long way to go before it becomes easy. Green's texture method is still not used in most games, even though he presented it in 2007 and it was implemented in Team Fortress Classic by Valve Software.</p> <p>Good luck, and please let me know if you have further questions! I don't have the time to help you with the big picture, but I would be glad to help with smaller things like understanding details of my code and clarifying my documentation somewhat.</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-245467/creating-textures">creating textures</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-245467#post-799126</guid>
				<title>creating textures</title>
				<link>http://contourtextures.wikidot.com/forum/t-245467/creating-textures#post-799126</link>
				<description></description>
				<pubDate>Wed, 02 Jun 2010 18:29:52 +0000</pubDate>
				<wikidot:authorName>pswin</wikidot:authorName>				<wikidot:authorUserId>491625</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>hi<br /> i want to use it for my game engine font system but i have some problems:</p> <p>1. how can i create textures?, any tool or source code<br /> 2. wich size for fonts is best? (for example 12)</p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-245467/creating-textures">creating textures</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://contourtextures.wikidot.com/forum/t-188436#post-607685</guid>
				<title>Artefacts in the demo</title>
				<link>http://contourtextures.wikidot.com/forum/t-188436/artefacts-in-the-demo#post-607685</link>
				<description></description>
				<pubDate>Tue, 13 Oct 2009 11:34:06 +0000</pubDate>
				<wikidot:authorName>stegu</wikidot:authorName>				<wikidot:authorUserId>30391</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>There are some unwanted artefacts in the demo that people have commented on:</p> <p><strong>On extreme minification, the texture becomes gray.</strong></p> <p>This is due to the 8-bit texture precision. The same limitation is seen in Chris Green's original implementation of the method. Distances more than 8 pixels from the edge are clamped, which yields incorrect antialiasing on extreme minification. The remedy is to either generate a stack of traditional mipmaps (mipmapping is not used in the current demo) and switch to conventional texturing under minification, or to use 16-bit precision for the distance map to store a correct distance value for all pixels. The 8-bit encoding was chosen for maximum compatibility with old versions of OpenGL. A 16-bit encoding could be done either by using a native 16-bit texture format, or by using two 8-bit pixels per distance value and compositing them to a higher precision value in the shader. I have used both with good results.</p> <p><strong>Tilting the polygon out of the screen plane gives nasty artefacts with an Nvidia GPU.</strong></p> <p>This is a strange bug related to the automatic derivative functions dFdx() and dFdy() and the related function fwidth() in GLSL. I have not yet been able to isolate the cause of this, but it is a problem specific to Nvidia GPUs. I tested this only on my ATI card, and there it works OK.<br /> (BTW, I should have written aastep=length(vec2(dFdx(D), dFdy(D))), not aastep=0.5*length(fwidth(uv)) in the demo, but that is unrelated to the bug. I have now changed that in the archives. The antialiasing is now anisotropic and analytically correct on an ATI GPU.)</p> <p>In another demo I store the gradients explicitly in the texture <em>and</em> use 16 bits for the distance value. That gives better minification, and no antialiasing problems with Nvidia GPUs because the distance field is not differentiated using dFdx() and dFdy(). The pattern is also smoother because I use a different interpolation scheme that turned out not to be such a great idea after all (it wasn't bad, but more trouble than it was worth):</p> <p><a href="http://www.itn.liu.se/~stegu/contourtextures/">A nicer, but slightly different demo</a></p> <br/>Forum category: <a href="http://contourtextures.wikidot.com/forum/c-82441">Support forum / Questions</a><br/>Forum thread: <a href="http://contourtextures.wikidot.com/forum/t-188436/artefacts-in-the-demo">Artefacts in the demo</a>
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>