realbasic-games
[Top] [All Lists]

Re: Transforming Vertices and Normals (Was: Doing your own vertex lighti

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Transforming Vertices and Normals (Was: Doing your own vertex lighting)
From: Frank Condello <developer at chaoticbox dot com>
Date: Mon, 22 Aug 2005 16:09:20 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <8DF2BB08-78E5-4A06-B484-895B5868CC47 at miensoftware dot com> <98D5C6A8-4D28-4AAC-9D45-664AA46DD36E at chaoticbox dot com> <D962D06D-00DB-4899-A24F-5553090F959B at miensoftware dot com> <CAE9040D-2C53-47E2-81EC-3B54FA9F6C50 at chaoticbox dot com> <C67E7CE8-E64B-4C39-A825-14CD0A88C271 at miensoftware dot com> <75099C14-B525-45F5-B96A-6FF18C435514 at chaoticbox dot com> <D1B36A2F-97EE-4B71-BC3B-BD3A5548541A at miensoftware dot com> <049C1457-8F68-4A08-A591-E874CF0EC7B7 at chaoticbox dot com> <034341D7-ECC5-4072-8B76-7E9F1DC660DD at miensoftware dot com> <668F9E8B-AD29-4B01-B08E-67F41622722E at miensoftware dot com> <C9ED2AF5-4F2C-4D9C-BC0C-D19340F96E96 at chaoticbox dot com> <58EAA4E1-3CA9-492C-960C-ABC9888DF34E at miensoftware dot com> <A51DFE3F-D7EF-4FF3-B43C-DA2A5E1AD865 at chaoticbox dot com> <0A9E1806-F631-4B64-A6D6-C0268979E08A at miensoftware dot com>
On 22-Aug-05, at 12:14 PM, Lo Saeteurn wrote:

Using the Quaternion.Transform seems to give the same results as using the rotation matrix from your code. The problem with the lighting was because I didn't recalculate/transform the vertex normals.

Regenerating the vertex normals like you did in 3DMF Workshop seems expensive and destructive. It seems destructive because it does not use the original normals instead it generates new ones. So if I have objects that had normals generated for hard edges, wouldn't they be lost? Or does the limiting angle fix this?

Ya, that's what the angle limit does but of course you'll need to know the original angle limit for this to be useful, and not all normal generating algorithms are equal, so the depending on how the originals were made you may see differences. Also keep in mind that the transforms in 3DMF Workshop always work around an origin of 0,0,0 (hmmm, just like Quaternion.Transform) so you'll need to translate the vertexes back to their proper location. Depending on how you're data is setup, you may need to translate to 0,0,0 first as well. So on second thought, Quaternion.Transform might work just fine, combined with one or two translations as needed... sorry for the confusion!

I read an article (http://www.gignews.com/realtime020100.htm) saying that transforming vertex normals using the same approach as the vertex points was okay as long as the transformation was "a series of rotations, translations, and uniform scalings, the normal can be safely transformed by this same matrix".

Can anyone confirm this or am I reading it wrong?

That's correct - the only time you need to recalculate normals from scratch is when the relative angles of the faces change, as they would for a non-uniform scale or deformations that involve vertex animation. I suppose I could do this for certain operations in 3DMF workshop as well, but it just feels "safer" to recreate them from scratch (plus I don't have to keep the original normals around). In a real-time app I'd definitely avoid recalculating normals whenever possible however...

Frank.
–––––––––––––––––––––––––––––––––
Open Source RB Goodies and Shareware
<http://developer.chaoticbox.com/>
<http://www.chaoticbox.com/>
–––––––––––––––––––––––––––––––––

_______________________________________________
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>