[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]
I’ve realized I haven’t posted any update about the Flight Sim Project for a long time; quite a few things have changed though …
Shaders :
I’ve always thought shaders didn’t like me, every time I tried to code something that used shaders, it turned out to be a big mess and I always ended up either rolling back or pulling my hair because of some useless “System Error” exception from the shader implementation of Managed DirectX … (I know it was aallll my fault :-P)
I decided to give myself another try with this shader thing that everyone is talking about … and this time it worked.
What I wanted to do was to rewrite the fog implementation for my terrain. The basic one is cool, but I wanted to add some kind of low altitude fog, like the one you see in those San Francisco bay pictures. It turned out that the only way to this easily was via a vertex shader that would take the distance between the vertex and the camera and set its fog value according to some calculation …
I started with this and added a special thing to this algorithm to add more fog at low altitudes. I wouldn’t say the result is awesome, but it looks… well… different from the default fog implementation. Apparently, the blog galleries are down today, so I can only point to a gallery on my website.
While on my shader spree, I decided to rewrite my sky plane with a vertex shader as well. It now works with a simple linear interpolation between the haze and sky color along with an offset to make the haze look denser.
Before this, the sky colors were rendered using simple vertex colors, I don’t really know if this new technique is faster, but it sure is kewl ! :)
One other thing about this is that i can update the colors and some other parameters quite easily.
Flight Model:
On the flight model part, not much has changed, I’ve implemented a trim function. This feature is going to be handy when I’ll tweak the flight parameters. The current set of flight parameters are still a little unrealistic sometimes, especially the stall speed.
Happy landings