# constant sprites size based on camera distance ?

 09 September 2003 seb4d Lord of the posts   Sebastien Gaucher 3D artist Videorama Casablanca, Morocco constant sprites size based on camera distance ? Hi, I have a huge amount of particles that represent stars. I used sprites so that I can map my own star picture on each particle. I would like to create an expression that change the size of the sprites based on the distance between them and the camera so that when rendered all sprites look the same size. Any idea ? I'm sure it is easy but I'm not good with expressions at all. Thanks in advance for your help ! __________________ Georges' biggest fan http://www.seb4d.com share quote
 09 September 2003 rhankins Veteran Create a locator and point constrain it to the camera. Now go to the particleShape node and add a custom per particle float attribute. Name it 'distance' or something. Then in both creation and runtime expressions write something like the following: vector \$vectorDistance = <> - position; distance = mag(\$vectorDistance); Then add two more per particle attributes: spriteScaleXPP and spriteScaleYPP Now you can use the distance between the camera and the particles to control the scale of the sprites to suite your needs. share quote
 09 September 2003 seb4d Lord of the posts   Sebastien Gaucher 3D artist Videorama Casablanca, Morocco one word : PERFECT ! Thanks a lot rhankins ! __________________ Georges' biggest fan http://www.seb4d.com share quote
 09 September 2003 seb4d Lord of the posts   Sebastien Gaucher 3D artist Videorama Casablanca, Morocco I just wrote what you said and made a simple equation : vector \$vectordistance = <> - particleShape1.position ; particleShape1.distance = mag(\$vectordistance) ; particleShape1.spriteScaleYPP = (1 * particleShape1.distance)/100 ; particleShape1.spriteScaleXPP = particleShape1.spriteScaleYPP ; thanks again ! __________________ Georges' biggest fan http://www.seb4d.com share quote
 09 September 2003 galactor He Biertje?   Student / Teacher Quote: (1 * particleShape1.distance)/100 I guess that the multiplation of 1 does not help very much in this case. :: Galactor :: share quote
 09 September 2003 seb4d Lord of the posts   Sebastien Gaucher 3D artist Videorama Casablanca, Morocco Oops... Why the hell did I multiply by 1 ????? I really should go to bed I'm very tired ! __________________ Georges' biggest fan http://www.seb4d.com share quote
 01 January 2006 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.