I've posted a similar question before but I didn't really get a good solid answer.
I am using evolve's multipass lighting fx.
http://www.evolved-software.com/shaders/Shaders_Lighting.html
I'm using the normal mapping shader but i'm having trouble with the db funtions that go with the shader. The lights shut off after the camera is a certain distance from them. But if I increase the range of the lights, they get brighter. How would I increase the range without increasing the brightness?
This is the code in the lighting functions
Function GetObjectLight( O , L )
PosX#=object position x(O):PosY#=object position y(O):PosZ#=object position z(O)
col=COLBOX(LightPos#(L,0),LightPos#(L,1),LightPos#(L,2),PosX#,PosY#,PosZ#,ObjectSize#(O,0)+LightCol#(L,3),ObjectSize#(O,1)+LightCol#(L,3),ObjectSize#(O,2)+LightCol#(L,3))
if col=1
AddLight=0
for OL=0 to 5
if ObjectLight(O,OL)=L then AddLight=1
next OL
if AddLight=0
for OL=0 to 5
if ObjectLight(O,OL)=0 and AddLight=0 then ObjectLight(O,OL)=L:AddLight=1
next OL
endif
endif
if col=0
for OL=0 to 5
if ObjectLight(O,OL)=L then ObjectLight(O,OL)=0
next OL
endif
for OL=0 to 5
if ObjectLight(O,OL)=0
AddLight=0
for OL2=OL+1 to 5
if AddLight=0 and ObjectLight(O,OL2)>0 then ObjectLight(O,OL)=ObjectLight(O,OL2):AddLight=1:ObjectLight(O,OL2)=0
next OL2
endif
next OL
Endfunction
Function COLBOX(X#,Y#,Z#,pX#,pY#,pZ#,Sx#,Sy#,Sz#)
col=0
if X#<(pX#+Sx#)
if X#>(pX#-Sx#)
if Y#<(pY#+SY#)
if Y#>(pY#-SY#)
if Z#<(pZ#+SZ#)
if Z#>(pZ#-SZ#)
col=1
endif
endif
endif
endif
endif
endif
Endfunction col
Function SetObjectLight( O , Effect)
LN=0
for OL=0 to 5
if ObjectLight(O,OL)>0
set vector4 1,LightPos#(ObjectLight(O,OL),0),LightPos#(ObjectLight(O,OL),1),LightPos#(ObjectLight(O,OL),2),0
set effect constant vector Effect,"LightPosition_"+str$(OL+1),1
set vector4 1,LightCol#(ObjectLight(O,OL),0),LightCol#(ObjectLight(O,OL),1),LightCol#(ObjectLight(O,OL),2),0
set effect constant vector Effect,"LightColor_"+str$(OL+1),1
LN=LN+1
endif
set effect constant float Effect,"LightRange_"+str$(OL+1),LightCol#(ObjectLight(O,OL),3)
next OL
if LN>0 then set effect technique Effect,"Light"+str$(LN)
if LN=0 then set effect technique Effect,"Ambient"
set vector4 1,camera position x(),camera position y(),camera position z(),0
set effect constant float Effect,"BrightNess",F#
Endfunction
And I call it up like this
For L=1 to 3
For X=1 to 3
UpdateObject(Level(X))
GetObjectLight(Level(X),L)
SetObjectLight(Level(X),NMFX)
Next X
UpdateObject(Weapon(Crossbow))
GetObjectLight(Weapon(Crossbow),L)
SetObjectLight(Weapon(Crossbow),NMFX)
Next L
If it hasn't exploded yet, I haven't touched it.