realbasic-games
[Top] [All Lists]

Re: trimesh particles demo, version 2

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: trimesh particles demo, version 2
From: Jeff Quan <jquan at mindspring dot com>
Date: Sat, 7 Oct 2006 18:40:11 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-games at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=mindspring.com; b=SDt/lHzwFDhTxTDv1Yn86APE/XzzEtJtlDmiZMF4sHEquZa9jUvhXCJFkqfrkrw5; h=Received:Mime-Version:In-Reply-To:References:Content-Type:Message-Id:From:Subject:Date:To:X-Mailer:X-ELNK-Trace:X-Originating-IP;
References: <33cbfa100610071045q4934211q824fcccd9cfc127b at mail dot gmail dot com>

On Oct 7, 2006, at 10:45 AM, Lars Jensen wrote:
Note that creating a texture that fits this triangle is not at all
trivial to produce. Once the proportions for the texture is found,
the texture's size would need to be basically doubled in order to get
the equivalent resolution of a square particle.

>SNIP< but consider this picture:
It shows your texture with a triangle that encloses most of the good
stuff. The triangle probably has even less area than the original
square. But the texture that encloses the triangle has roughly twice
the area of the original square. Is that what you mean by "basically
doubled"?

Hmm. Now that I see my own response, I may have confused things a bit. Bear with me while I talk out loud a bit:

I simplified my assumptions even further than what you've drawn. First treat the particle image as a round circle rather than an odd shape (that's what I did to build that spark texture). Next, draw a triangle around it which will fit that shape, making sure that triangle is vertically symmetrical. This will guarantee you a good fit for any round-shaped particle texture.

For a more concrete example: in Meshwork (Joe Strout's 3DMF modeling app at <http://www.codenautics.com/meshwork/>), create a sphere centered at the origin (use the default 100-unit diameter). Now create a triangle shape around that area which encompasses the entire sphere. That triangle will probably be close to an equilateral triangle that is symmetrical around the Y-axis, the bonus part of which that its vertex coordinates will allow the particle to spin perfectly about the center. You'll probably find that the width of the triangle's base to be about 200 units.

Now if you take that 200 units and draw a box around that with a width and height of 200 units, visually the triangle is roughly half the size in area of the square. This is what I used to say that your texture size must be doubled to match the equivalent square. See diagram at <http://www.jcquan.com/RB/TriangleParticles.png>

My mistake in the UV coordinates I sent out earlier is not burning them in with the square. That would allow the dimensions of the particle texture to remain a ratio of 1:1.

In other words: In Meshwork, select everything (sphere, triangle, box) and in whichever material you choose, click planar mapping and click the Set button to lock in the planar UV coordinates. Close that material's window and re-open it, setting the mapping to pinned. If you now delete the sphere and box, you now have the UV coordinates for the triangle which you can use in the demo app. Oh, and you might want to reduce the dimensions of that triangle to unit size before dropping it in the demo app.

The above example works for a round texture, but as soon as you want to do a texture that's wider than tall (or vice versa), you'll need to bump up that texture resolution. This is where the square particle does better damage control (so to speak), allowing more freedom for oddly-shaped textures.

I'm running entirely by visual examples here. Feel free to let me know if there's something flawed with my reasoning -- I'd like to learn along with everyone else!

==
Jeff Quan
jquan at mindspring dot com
http://www.jcquan.com/JQportfolio


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>