I still have lots of things to fix on the water, for example the underwater patches are rendered even if the camera is above water ( and vice versa ), which wastes some polycount/cpu. The tiling is still not fixed yet, and i still have to implement a good foam texture based on cellular procedural textures.
To have a break from the terrain engine, i started to code an A-star algorithm to handle A.I., the goal being to experiment NPC traffic in stations in the coming weeks. A-star is a graph algorithm that allows one to implement pathfinding and to associate some "costs" to each segment of the paths graph. That way the A.I. can select the shortest path to go from a point A to a point B, depending on the costs assigned to the graph. A-star is a very fast algorithm, but still too slow IMO to run on thousands of NPCs at the same time, so i'm planning to precompute for each station a 2D table that give, for a current control point and a destination control point, the ID of the "next" control point to go to. This shouldn't waste too much memory either, for example if there are 500 control points in a single station, that'd use 500 * 500 * 2 bytes ( you need 2 bytes to store a control point ID ) = 500 KB of memory to store the table. There would be one of this table per "station type", and not per instance of the station in the universe. Anyway, that's my plan, and time will tell if it works or not.
In other news i have implemented a simple form of volumetric fog / haze for the planetary engine. It is almost 95% vertex shader based, and works by generating a fog sphere of a constant thickness around the planetary sphere. The vertex shader then casts a ray from the vertex to the camera through this fog sphere and calculates the density of fog along this ray. This value is then used to LERP the diffuse color with the fog color. It is an over-simplification, and i've hit a lot of complex issues with this ( particularly with how to handle the case where the ray doesn't intersect the fog sphere at all, or of the atmosphere's fog color not matching the terrain's fog color due to altitude differences ), but the latest version is looking okay.