[LightSource] Direction?
-
So a system has a LightSource (taken from Li01):
[LightSource] nickname = System_LIGHT pos = 642,0,198 color = 255,255,255 range = 120000 type = DIRECTIONAL atten_curve = DYNAMIC_DIRECTION
Now this light is DIRECTIONAL, but a DX8 directional light needs… well, a direction.
Does anyone know what direction Freelancer gives to these lights?
-
As far as I know they are not really directional. Every light you encounter in FL are point lights. At least I haven’t seen any “valid” directional light in any of the game’s ini files.
In the Freelancer.exe, valid types are DIRECTIONAL, CONE, POINT and AMBIENT. How or if they are used should be experimented with.
Take a look into “igraph.ini” in the DATA directory. There those atten_curves are defined. They are nothing else than different kind of curves how the light magnitue is depending on the max range you set up in the system files.
-
They are classified as directional lights (they use D3DLIGHT_DIRECTIONAL), but they are used as point lights. Their range is the range value indicated in the INIs and they use linear falloff with distance (not quadratic as a point light would).
-
I hooked into Direct3DDevice8::SetLight while flying in the New York system, and it gave me some interesting values.
--------------- 0D81C424: Directional light set! (frame 1000) Color: 0.842580, 0.842580, 0.842580 Direction: 0.010173, -0.073497, 0.997244 Ambient: 0.000000, 0.000000, 0.000000 Specular: 0.000000, 0.000000, 0.000000, Range: 120000.000000 --------------- 0D81C424: Directional light set! (frame 1029) Color: 0.842580, 0.842580, 0.842580 Direction: -0.731640, -0.073304, 0.677739 Ambient: 0.000000, 0.000000, 0.000000 Specular: 0.000000, 0.000000, 0.000000, Range: 120000.000000
So the Direction (D3DLIGHT8.Direction) seems to change based on something? This is despite the docs saying Direction is - “Direction that the light is pointing in world space, specified by a D3DVECTOR structure. This member only has meaning for directional lights. This vector need not be normalized, but it should have a nonzero length.”
The Color is also not the same as in the INI (I think this is an implementation of falloff since I’m pretty sure D3DLIGHT_DIRECTIONAL doesn’t support attenuation).
I’d like to clarify I am looking for the direction of the light. Falloff and atten_curves I already know of
-
There is a [c]direction[/c] parameter, for example in Bw02.ini:
[LightSource] nickname = Bw02_walker_light pos = 10828, 0, -226 color = 225, 100, 6 range = 100000 type = DIRECTIONAL direction = -0.845085, 0.430582, 0.316907 ```Tested: it works, this is the direction for [c]DIRECTIONAL[/c] type lights. When not included, [c]0,0,-1[/c] seems to be used, unless some [c]atten_curve[/c] is added, in which case it behaves like a [c]POINT[/c] light (the Li01 example). EDIT: oops made typo, fixed now