I have tried 3 different techniques and puzzled and puzzled about how things are broken. This post was hard to write because I am still not 100% clear of whats what.
I now believe that there are two main bugs (for a long time I thought that there were three).
In terms of lights a FSX effect in the FSX\effects directory appears to consist of a number of emitters. This have sub options called particles and particle attributes but for lights we are interested in they are always one to one and so are really just a further collection of properties.
If an emitter has the Light property set to 1 then it shines onto the aircraft but is itself invisible. (Its like a black torch that lights things up)
- If an emitter has the Light property set to 0 then it’s a visual effect (a glowing orb!) but doesn’t illuminate anything.
Strobe lights and some of the white lights do not include a shine emitter within the effect, whereas the beacons and nav lights do.
The first bug then is that in DX10 a light that does not contain a shine emitter orientates always itself towards the cockpit. So in the VC all the strobes and white lights work perfectly – they look exactly the same as in DX9. The problem comes when you switch to spotter plane or tower view. In DX9 the lights then reorientate themselves towards the new viewpoint but in DX10 they remain pointing at the cockpit. The worst example of this is when you position the spotter plane alongside – the strobe at the end of the wing is invisible as its pointing the wrong way.
The second bug is much harder to explain or understand! It seems that there is some carry over from one light to the “next” light. I only have a sense of what is wrong but I do know some ways to change the behaviour in a positive manner.
I originally believed that there was a simple bug that if a light effect contained a Shining Emitter and some orb Emitters that DSX DX10 “forgot” to process the orbs and thus you saw as with the beacons the glow on the plane but not the light itself.
Hence my original solution which was to add additional lights which didn’t contain shine emitters. Although these only shone towards the aircraft I included displacements within the effect to move the light to the correct location. Thus FSX believed that my red nav light was attached to the end of the starboard wing and told the effect subsystem to aim the effect inwards towards the plane. The effect internally included a displacement equal to the wing span which led to the effect subsystem putting the light to appear facing out form the port wing.
This worked great with the Cessna but I had problems with the jets with the light cutoff angles . In retrospect this was because the wings are swept back – at the time I had assumed that the lights faced the centreline of the plane not the cockpit. I could now fix this by locating the light in mid air alongside the cockpit and including more complex displacement to move it back and across the plane!
This approach had problems
- Every light had to be individually hand crafted
Although I could create orange beacon lights I couldn’t synchronise them with the flash (which was in a separate effect) and were only visible through 180 degrees.
Looking at the beacon I then wondered whether if I made the beacon flash shine in a more focused way I could improve the effect. I tried a different texture by specifying fx_flash.fx rather than the default fx_2.fx and the beacon appeared! Further experimentation it only seemed to work if the effect contained at least two visual effect emitters (Light=0) using different textures.
So at this point I thought I had a per light fix! However as I converted the lights one by one and tested with the Cessna, I found some odd issues where characteristics seemed to leak from the orange beacon to the red nav light. For example the red light would flash or not appear if I switched the lights off and on. I also saw some problems with multiple strobes effecting the beacon. At the time I viewed all these as symptoms of an unconnected third issue in FSX and couldn’t understand why it effected the red light so badly. I had some kind of theory that the lights were perhaps organised in a clockwise direction from the tail. I managed to reduce the problems by adding additional fx_2.fx lights to the red nav light effect and was able to produce a fully working version with the proviso that the red nav light didn’t always work the second time it was turned on.
The final development in this saga was when I experimented changing the blend mode used for an emitter. To my astonishment I found that adding one emitter of this mode to the red nav light fixed the red and green lights. Indeed I found that adding one such emitter to the strobe and leaving the red and green nav lights in their original form resulted in all the lights working provided the beacon were turned on first.
It then occurred to me that it would make perfect sense for FSX to load the lights from the definition in the aircraft.cfg, organising them by type and sequence number and that the red light was always the first nav light in the stock models.
So my current theory runs something like this:
I think that FSX loads light effects as needed when they are turned on by function (i.e nav, beacon) which relates to the electrical bus. The visual effect emitters are stored in a sequence related to the order used in the config file. I suspect that FSX somehow messes up the first emitters if it’s a fx_2.fx light and when it reads subsequent emitters that have similar characteristics continues to carry over this error (resulting in the lights not working). Any significant change in the characteristics such as blend mode or texture arrests this process and subsequent lights are then loaded correctly.
So my current solution is to create an almost invisible light effect using a different blend mode to the standard lights and make it the first light on each bus. This seems to work reliably to me.
What I need to do now is validate this theory by going back and experimenting with texture changes. I don’t see how it explains the inheritance of flashing to the red nav light that I previously observed so I still don’t think it’s a definitive explanation of what is wrong, but I think its getting a lot closer to the truth.