Re: [Algorithms] Scroll direction algorithm
Brought to you by:
vexxed72
|
From: Osman, B. <BO...@vv...> - 2009-09-28 18:16:33
|
I think it's worth pointing out that unless you've planned ahead (or are happy with some visual strangeness), this isn't going to work very well for arbitrary meshes. Without constraints on the UV mapping, you're going to get really crazy behavior along UV seams of the mesh. Even with constraints, I don't see any general case where you're going to be able to keep the mapped texture continuous across the mesh. -Brian From: Sim Dietrich [mailto:si...@gm...] Sent: Monday, September 28, 2009 1:44 PM To: Game Development Algorithms Subject: Re: [Algorithms] Scroll direction algorithm If you have a tangent space basis for the mesh then this gives you the information you need. You can use this to convert from left/right in world, view or model space, and convert into UV space. You can look up tangent space lighting tutorials, then interpret the scroll direction as a light direction. Put the scroll direction vector in model space, then through the per-vertex or per-pixel tangent space matrix ( which will account for the texture direction flips ), then scale the resulting vector based on the scroll speed and time, then add this to the initial model UVs. That should work... On Mon, Sep 28, 2009 at 9:22 AM, Zafar Qamar <zaf...@co...> wrote: Hi, I have a question about an algorithm in a shader. I hope this is the right place to post. I basically have a mesh that has a texture on. In my shader I want the effect to generally look like it is moving across the mesh from left to right. Imagine it is a simple scrolling texture with some spots on, for the case of this question. However, the mesh has been UV mapped such that generally the texture looks like it is scrolling in the right direction, but some areas have the texture scrolling in completely the wrong direction. Is there some maths algorithm I can use to possibly get around this? I apologise if my question is not clear. Cheers Zafar Qamar ************************************************************************ ********** Disclaimer The information and attached documentation in this e-mail is intended for the use of the addressee only and is confidential. If you are not the intended recipient please delete it and notify us immediately by telephoning or e-mailing the sender. Please note that without Codemasters' prior written consent any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. Attachments to this e-mail may contain software viruses. You are advised to take all reasonable precautions to minimise this risk and to carry out a virus check on any documents before they are opened. Any offer contained in this communication is subject to Codemasters' standard terms & conditions and must be signed by both parties. Except as expressly provided otherwise all information and attached documentation in this e-mail is subject to contract and Codemasters' board approval. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Codemasters. This footnote also confirms that this email message has been swept by SurfControl for the presence of computer viruses. ************************************************************************ ********** ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-lis t |