Ogre light attenuation shortcut

Source: Internet
Author: User

Original article address:

Http://www.ogre3d.org/tikiwiki/tiki-index.php? Page = light + attenuation + shortcut

Common coefficient:

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 always Ally 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) ); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.