原文地址:

http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Light+Attenuation+Shortcut 


常用系数:

Range Constant Linear Quadratic

3250, 1.0, 0.0014, 0.000007

600, 1.0, 0.007, 0.0002

325, 1.0, 0.014, 0.0007

200, 1.0, 0.022, 0.0019

160, 1.0, 0.027, 0.0028

100, 1.0, 0.045, 0.0075

65, 1.0, 0.07, 0.017

50, 1.0, 0.09, 0.032

32, 1.0, 0.14, 0.07

20, 1.0, 0.22, 0.20

13, 1.0, 0.35, 0.44

7, 1.0, 0.7, 1.8 

 

You can determine the linear and quadratic values (or what is visually close enough) for any range you wish to use:

  • Linear = 4.5 / LightRange
  • Quadratic = 75.0 / LightRange^2

  
Here is a function to calculate attenuation based on the Light Range:

void setLightRange( Ogre::Light *L, Ogre::Real Range ) { 	L->setAttenuation( Range, 1.0f, 4.5/Range, 75.0f/(Range*Range) ); }
posted on 2012-06-08 14:17  jackdesk  阅读(276)  评论(0编辑  收藏  举报