<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Uniform distribution of points in a 3D Tri</title>
		<link>http://www.allegro.cc/forums/view/612595</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 16 May 2013 21:23:33 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="spoiler"><p><span class="remote-thumbnail"><span class="json">{"name":"607586","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/d\/cd85544d49fcd8d2d7c2c975206427c4.png","w":400,"h":373,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/d\/cd85544d49fcd8d2d7c2c975206427c4"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/c/d/cd85544d49fcd8d2d7c2c975206427c4-240.jpg" alt="607586" width="240" height="223" /></span></p></div><p>

Given a certain Triangle in 3D (Kinda irrelevant to the problem since it can be solved in a plane with just transforming coordinates), I&#39;d like to generate a set amount of points (which is set obviously by just dividing the area of the tri by a certain value) that are equidistant between each other, while filling up as much as possible of the given area of the triangle.</p><p>There should be some separation from the edges, otherwise when I do this on the polygon right next to it I&#39;ll get some overlapping points. I&#39;d rather generate the points on the edges myself with another method.</p><p><span class="remote-thumbnail"><span class="json">{"name":"607585","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/3\/e327c180ce4f872176eb3c94121c97e1.png","w":400,"h":373,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/3\/e327c180ce4f872176eb3c94121c97e1"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/e/3/e327c180ce4f872176eb3c94121c97e1-240.jpg" alt="607585" width="240" height="223" /></span></p><p>Generating on the edges of the triangle is simple enough, covering the surface of it is my biggest problem tho. I&#39;m using this to generate a bunch of sampling points to take in reference for some colored lighting on objects (light reflected off surfaces), and having sampling points that cover all my meshes in a consistent manner would be of big help.</p><p>I&#39;ve googled a fair bit but I haven&#39;t found much of use yet that isn&#39;t for super accurate stuff. Since this is just for calculating some lighting, accuracy is not really needed and it doesn&#39;t matter if there&#39;s much holes on the shape. It should just be fairly consistent in covering the surface in most of these polies.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dario ff)</author>
		<pubDate>Wed, 15 May 2013 23:56:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Has the distribution to be tied to the linear dimensions of the triangle, or you were thinking about a predetermined density?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Thu, 16 May 2013 00:32:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You seem to choose complex way to solve some simple problem. What <i>exactly</i> are you trying to accomplish? Is it cube map? Specular light? Bump map?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Thu, 16 May 2013 00:51:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612595/982847#target">pkrcel</a> said:</div><div class="quote"><p>Has the distribution to be tied to the linear dimensions of the triangle, or you were thinking about a predetermined density?</p></div></div><p>
Predetermined density, constant for every tri this algorithm goes through. Ideally it should leave a fairly consistent set of points depending on the size of the tri.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612595/982851#target">Raidho36</a> said:</div><div class="quote"><p>You seem to choose complex way to solve some simple problem. What exactly are you trying to accomplish? Is it cube map? Specular light? Bump map?</p></div></div><p>
Global illumination for objects using an adaptive Octree that stores the irradiance map and diffuse reflection, taken from baked GI textures used in these surfaces. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> I simply need to generate these points across the surfaces of the stage to have a reference in the density of objects/reflections of each area. The rest is already coded and running as intended, but without having access to the renderer of these baked maps, the most I can do is approximation like this.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dario ff)</author>
		<pubDate>Thu, 16 May 2013 01:47:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay, how about you obtain these points from hardware rasterized triangle and perform the whole thing via shader?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Thu, 16 May 2013 08:48:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Shaders seem a way to work with it....but I ain&#39;t no expert there.</p><p>Crazy Idea: you said that putting the sampling point on the edges is already okay for you; then why not use the same algorithm for a fixed set of sub-triangles?</p><p>You can obtain the sub triangles by a &quot;scale&quot; transform, and you can predetermine the number based on the predetermined density (alas, you determine the SMALLEST inscribed tri clone and thus the total number..).</p><p>You would end up with a point distribution starting from the centre of the triangle &quot;expanding&quot; outwards.</p><p>I may later add a picture to explain better myself. <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><div class="spoiler"><p>
<span class="remote-thumbnail"><span class="json">{"name":"607587","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/1\/e15dfe504e5d618c54861aeeacc40405.png","w":415,"h":364,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/1\/e15dfe504e5d618c54861aeeacc40405"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/e/1/e15dfe504e5d618c54861aeeacc40405-240.jpg" alt="607587" width="240" height="210" /></span>
</p></div><p>



Here it is, well...looking at it seems NOT that uniform.... <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><p>But it&#39;s fairly consistent. <img src="http://www.allegro.cc/forums/smileys/angry.gif" alt="&gt;:(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Thu, 16 May 2013 11:52:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Couldn&#39;t you do this with barycentric coordinates?(or something like it?)</p><p>ie:<br />Having a triangle ABC, you might get good results when going with A + i/n*AB + j/m*AC with AB and AC being the vectors from A to B or C respectively (This is just my guess, don&#39;t know what it would look like)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (J-Gamer)</author>
		<pubDate>Thu, 16 May 2013 17:32:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Or split each triangle in two on its longest side, until all sides are smaller than what you need.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Audric)</author>
		<pubDate>Thu, 16 May 2013 21:23:33 +0000</pubDate>
	</item>
</rss>
