Thread: [Algorithms] Flipping/Rotating through all possible combinations
Brought to you by:
vexxed72
From: Zafar Q. <zaf...@co...> - 2009-12-18 11:16:22
|
Hi, I have done a water-shader but it looks like some of the values I'm refracting to may be wrong, hence picking up wrong sides of an environment map. So, I want to try all possible iterations of swapping or negating x,y and z axes eg. 1) x = -x 2) x= y 3) x = y y = z 4) x= -z y = x etc etc etc Does anyone know of an algorithm for going through all possible iterations? 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. ********************************************************************************** |
From: Richard F. <ra...@gm...> - 2009-12-18 12:44:11
|
That's a combinatorics "picking" problem where you have three picks. Six choices for the first, four for the second, and two for the third. that gives you 6 * 4 * 2 choices to run through... thats a lot. You'd be better off figuring out what's wrong as you might not even recognise the correct case as there may be other errors. 2009/12/18 Zafar Qamar <zaf...@co...> > Hi, > I have done a water-shader but it looks like some of the values I'm > refracting to may be wrong, hence picking up wrong sides of an environment > map. > > So, I want to try *all possible iterations* of swapping or negating x,y > and z axes > > eg. > 1) x = -x > > 2) x= y > > 3) x = y > y = z > 4) x= -z > y = x > > etc > etc > etc > > Does anyone know of an algorithm for going through all possible iterations? > > 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. > > ********************************************************************************** > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > -- fabs(); Just because the world is full of people that think just like you, doesn't mean the other ones can't be right. |
From: James R. <ja...@fu...> - 2009-12-18 12:44:30
|
If you can assign values to your axes and index them through those values, something like this should do it: src[ 0 ] = x; src[ 1 ] = y; src[ 2 ] = z; for( dx = -2; dx <= 2; dx++ ) { for( dy = -2; dy <= 2; dy++ ) { if( dx != dy ) { for( dz = -2; dz <= 2; dz++ ) { if(( dx != dz ) && ( dy != dz )) { x = src[ abs( dx )] * sign( dx ); y = src[ abs( dy )] * sign( dy ); z = src[ abs( dz )] * sign( dz ); } } } } } Zafar Qamar wrote: > Hi, > I have done a water-shader but it looks like some of the values I'm > refracting to may be wrong, hence picking up wrong sides of an > environment map. > > So, I want to try _all possible iterations_ of swapping or negating > x,y and z axes > > eg. > 1) x = -x > > 2) x= y > > 3) x = y > y = z > 4) x= -z > y = x > > etc > etc > etc > > Does anyone know of an algorithm for going through all possible > iterations? > > 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. > ********************************************************************************** > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > ------------------------------------------------------------------------ > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list |
From: Zafar Q. <zaf...@co...> - 2009-12-18 15:42:02
|
Hi James, This looks very interesting. Thanks to all of those who responded. Very much appreciated. Cheers Zaf -----Original Message----- From: James Robertson [mailto:ja...@fu...] Sent: 18 December 2009 11:32 To: Game Development Algorithms Subject: Re: [Algorithms] Flipping/Rotating through all possible combinations If you can assign values to your axes and index them through those values, something like this should do it: src[ 0 ] = x; src[ 1 ] = y; src[ 2 ] = z; for( dx = -2; dx <= 2; dx++ ) { for( dy = -2; dy <= 2; dy++ ) { if( dx != dy ) { for( dz = -2; dz <= 2; dz++ ) { if(( dx != dz ) && ( dy != dz )) { x = src[ abs( dx )] * sign( dx ); y = src[ abs( dy )] * sign( dy ); z = src[ abs( dz )] * sign( dz ); } } } } } Zafar Qamar wrote: > Hi, > I have done a water-shader but it looks like some of the values I'm > refracting to may be wrong, hence picking up wrong sides of an > environment map. > > So, I want to try _all possible iterations_ of swapping or negating > x,y and z axes > > eg. > 1) x = -x > > 2) x= y > > 3) x = y > y = z > 4) x= -z > y = x > > etc > etc > etc > > Does anyone know of an algorithm for going through all possible > iterations? > > 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. > ********************************************************************** > ************ > > ---------------------------------------------------------------------- > -- > > ---------------------------------------------------------------------- > -------- This SF.Net email is sponsored by the Verizon Developer > Community Take advantage of Verizon's best-in-class app development > support A streamlined, 14 day to market process makes app distribution > fast and easy Join now and get one step closer to millions of Verizon > customers http://p.sf.net/sfu/verizon-dev2dev > ---------------------------------------------------------------------- > -- > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-l > ist ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list ********************************************************************************** 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. ********************************************************************************** |
From: Jeff R. <je...@8m...> - 2009-12-18 17:09:02
|
As I recall, If you're doing environment mapping using a normal map, sometimes depending on your normal map content and your view angle you can get normals that point away from the camera (i.e. N dot V < 0), and this can sometimes end up looking into "wrong", or at least unexpected, sections of the cube map. Don't know if this is your problem, but if it is it can probably be fixed with modified art content (easy), or limiting the normal to at most be 90 degress off the view vector (a little shader work, a little harder). -- Jeff Russell Engineer, 8monkey Labs www.8monkeylabs.com |