constant sprites size based on camera distance ?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  09 September 2003
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
 
  09 September 2003
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 = <<locator1.tx, locator1.ty, locator1.tz>> - 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.
 
  09 September 2003
one word : PERFECT !

Thanks a lot rhankins !
__________________
Georges' biggest fan
http://www.seb4d.com
 
  09 September 2003
I just wrote what you said and made a simple equation :

vector $vectordistance = <<locator1.translateX , locator1.translateY , locator1.translateZ>> - 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
 
  09 September 2003
Quote: (1 * particleShape1.distance)/100


I guess that the multiplation of 1 does not help very much in this case.

:: Galactor ::
 
  09 September 2003
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
 
  01 January 2006
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.
 
Thread Closed share thread



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 vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:45 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.