LightIntensity light,intensity#

Parameters

light - light handle

intensity# - how much to multiply its colour by, 0 or more; 1 is its colour as it is

Description

Sets how bright a light is.

LightColor stops at 255, so intensity takes light further: a lamp with physical falloff (LightFalloff) needs an intensity of 10 to 40 to light a room. Realtime and baked light use it alike. Classic lighting still clips each surface's light to white, so very bright lights mostly matter to bakes, Standard materials and HDR rendering.

See also: LightColor, LightFalloff, LightBakeMode, CreateLight.

Example

; LightBakeMode Example
; ---------------------

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,3,-5
RotateEntity camera,30,0,0

AmbientLight 12,12,18

; A floor and three pillars to cast shadows
ground=CreateCube()
ScaleEntity ground,4,0.1,4
For pillar_number=0 To 2
    pillar=CreateCube()
    ScaleEntity pillar,0.2,0.8,0.2
    PositionEntity pillar,pillar_number*1.2-1.2,0.8,1
Next

; A ball rolling across the front: it moves, so probes light it
ball=CreateSphere(16)
ScaleEntity ball,0.3,0.3,0.3
EntityLightmap ball,LIGHTMAP_OFF

lamp=CreateLight(2)
PositionEntity lamp,0,2.2,-0.5
LightRange lamp,6
LightColor lamp,255,230,200
; Physical falloff fades as real light does, so the lamp needs an intensity
falloff=LIGHT_FALLOFF_PHYSICAL
LightFalloff lamp,falloff
LightIntensity lamp,8

mode=LIGHT_MIXED
radius#=0.2
intensity#=8
LightBakeQuality 0
bake=BakeLighting()

While Not KeyDown(1)

    ; 1, 2 and 3 choose how the lamp bakes; [ / ] soften its baked shadows;
    ; - / = change its brightness; Space bakes with the new settings
    If KeyHit(2) Then mode=LIGHT_REALTIME
    If KeyHit(3) Then mode=LIGHT_MIXED
    If KeyHit(4) Then mode=LIGHT_BAKED
    If KeyHit(26) And radius>0 Then radius=radius-0.1
    If KeyHit(27) Then radius=radius+0.1
    If KeyDown(12) And intensity>0.2 Then intensity=intensity-0.1
    If KeyDown(13) Then intensity=intensity+0.1
    LightBakeMode lamp,mode
    LightBakeRadius lamp,radius
    LightIntensity lamp,intensity
    ; F switches between classic and physical falloff
    If KeyHit(33) Then
        falloff=1-falloff
        LightFalloff lamp,falloff
    EndIf
    If KeyHit(57) And bake=0 Then bake=BakeLighting()
    If bake<>0 Then
        If LightBakeState(bake)<>LIGHT_BAKE_RUNNING Then
            FreeLightBake bake
            bake=0
        EndIf
    EndIf

    PositionEntity ball,Sin(MilliSecs()/15.0)*2.5,0.3,-1

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    If mode=LIGHT_REALTIME Then mode_name$="realtime only"
    If mode=LIGHT_MIXED Then mode_name$="mixed"
    If mode=LIGHT_BAKED Then mode_name$="baked only"

    Text 0,0,"Arrow keys: move camera   Space: bake with the new settings   Esc: exit"
    Text 0,20,"1 / 2 / 3: mode   [ / ] : soft shadow size   - / = : intensity   F: falloff"
    Text 0,40,"LightBakeMode lamp,"+mode+" ("+mode_name+")"
    Text 0,60,"LightBakeRadius lamp,"+radius+"   LightIntensity lamp,"+intensity+"   LightFalloff lamp,"+falloff
    If bake<>0 Then Text 0,80,"Baking: "+(LightBakeProgress(bake)/10)+"%" Else Text 0,80,BakedLightingStatus()

    Flip

Wend

End

Index