During my last post I had hinted at moving between projects while working on the train so that I could keep motivated during the modelling. This would prove to be quite beneficial as I decided to do some more simple models but I could concentrate on getting better acquainted with some areas of the modelling pipeline that I was either avoiding or hadn't much knowledge of.
I cant remember the exact epiphany but I came up with the idea of implementing dynamic lighting. The premise was that I would create a set of lights which would automatically turn on and off based on the time of day. I know this has been done in some game to varying degrees the one coming to mind being Oblivions use of torches and window lights but its not really a widely used feature.Certain fire sources would be always lit even during the daytime even though they weren't needed. I thought that getting this to work would be a neat background feature giving nice atmospherics but in a non-obtrusive way. The player wouldn't be aware of it but they would notice something changing everything cycle. This would make the world feel dynamic.
I decided on doing a set of street lamps that could be incorporated into the mod as reusable props should the concept not work. Modelling the lamp was one thing but the initial idea came about as part of a brain wave I had whereby I wanted to implement dynamic lighting. As part of this proof of concept I would do all parts of this from making the models, UV wrapping, texturing, materials and exportation to in-game.
The way that I had planned on getting this working I though was going to be quite simple. I would animate the model so that the light turned on and off, however because I thought it would be simple it of course turned out not to be. My initial idea was to have the emissive value of texture of the light bulb alternate between fully emissive to none. That way the light bulb would alternate from being on a off and I could tie in a script in-game that would play the animation forward to light the bulb up and play backwards when I want it to turn off. This worked in theory but not in practice.
After exportation and getting it in-game I found couple of anomalies/bugs. The animation was not being exported. Excluding the animation from the equation I got the emissive part working but only sometimes. It appeared that depending on the angle at which the player was looking would make the emissive effect appear or disappear. Doing alot of testing and some consultation from Shinrasoldier3 we isolated it to the alpha values of the glass material that I was using. The engine didn't like rendering emissive and transparent materials overlapping each other.
Not one to give up I decided that this could be solved using alpha valued textures as we have already a could of models with window which contained objects with emissive properties. I decided to concentrate on figuring out why the animation wasn't working either as I thought that I could also try working around the problem by making parts of the object render or not so that the parts don't conflict.
The export scripts were able to export both by using embedded animations or as a separateÂ file containing the animation. In both cases I checked the the animation files and didn't find the necessary animation nodes. This was unfortunate but looking back now it was very good as I had to make contact with the guys who developed the export scripts - nifscripts over on Niftools. I contacted Amorilia and he was a major help as the feature was meant to be working but had stopped working in some prior versions. So as he worked on the scripts I alternated between this and the other projects I was working on but I still worked on it from time to time trying to find alternative solutions.
This was definitely a worthwhile project not only from implementing an idea and working around the limitations of the engine but also the wide community that is out there in terms of modding for this game and modding in general, but the knowledge I gained in each of the areas needed to do all the individual components. I'm hoping update this and include it in some upcoming work once current events equalise but I will go through those in subsequent blog. For now I think th t this is long enough and that I have covered enough of this topic so I will end here for now.