Author Topic: How to set light's intensity?  (Read 2551 times)

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
How to set light's intensity?
« on: August 03, 2014, 12:32:06 pm »
Light.setIntensity(r,g,b) is uesed to set colors,but i don't want to change color, just want to change the  intensity of the light.
how can i do?

Thanks for Ego.

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
Re: How to set light's intensity?
« Reply #1 on: August 04, 2014, 06:26:11 am »
You can do both with this function. Light always has a "color"; If you want white light (the default), set r=b=g, e.g. to 255 for maximum brightness.

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
Re: How to set light's intensity?
« Reply #2 on: August 04, 2014, 10:53:02 am »
I can't got it,255,255,255 means white.but how to adjust the degree of white?brightter or darker.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to set light's intensity?
« Reply #3 on: August 04, 2014, 05:15:52 pm »
It's doesn't whiter than white, so you can't increase the intensity above 255,255,255. You can you lower values...it's just like in any paint program if you are picking some color.

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
Re: How to set light's intensity?
« Reply #4 on: August 05, 2014, 03:39:46 am »
Thanks above everyone, i now know it,rgb not only means the color but also means the strength of light.Strong light or weak light all belong to RGB.

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
Re: How to set light's intensity?
« Reply #5 on: August 07, 2014, 02:36:13 pm »
In case you still wonder why your lights and textures are kinda dark:
You probably have, as all people, set your device to automatic brightness. This is rather dark for games.

You can try this snippet:

WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 1.0; // or whatever
getWindow().setAttributes(lp);

to override brightness settings.

Not all devices or users will like that, but it may be worth a try. In Armada, I set the brightness to 0.85 per default, but the user can deactivate the override.