View Single Post
# 26 13-09-2003 , 09:58 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
I just figured out that controlling things based on the distance from camera is really usefull. For example HW particles (mainly points and streaks) are sized in pixels. So no matter how far they are, they will be (HW) rendered the same size -> not exactly realistic looking. If you add a runtime expression which scales the opacityPP based on the distance from the current camera it will look a lot better.

Example:
Code:
vector $vPPos = lpos; // last position of the particle
vector $vCPos = << persp.tx, persp.ty, persp.tz >>; // current camera position
float $fDistance = mag($vPPos - $vCPos) / 20; // particle's distance from camera (scaled to be in range of 0 - 1)
opacityPP = 1.2 - $fDistance; // the opacity will be at least 0.2 but degrades when the distance increases from the cam
Again you need to play with the divider (20) to scale the opacity reduction to fit the size of your scene. The "1.2" on the last line determines the overall opacity level of all particles (you want to keep this greater than 1.0)...


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!

Last edited by kbrown; 13-09-2003 at 10:06 PM.