Working on the caves, I found a lot of small bugs…
First, something I should have noticed before, but it really becomes apparent when you have no light: explosions have a light and that light was not being computed properly:

It ended up just being a bad setup of the structures for lighting, took me a while to figure it out, though…
Then, I found out that the terrain below the bridges in the chasms supported the character in thin air:

That’s not game breaking, but it was annoying… Since I wanted to remake the whole chasm/bridge part, I started that way and fixed that in the process…
Then I added the possibility of having caves with lava instead of chasms… It’s just cosmetic, but it looks nice to have some variety:

I’m still a bit undecided on what to do next (my task list isn’t shrinking as fast as I’d like, for everything I do, there’s another one that shows up!)… I want to see a glow effect and shadows on the spotlights, but that’s not really needed, so I think I’m moving that to the wishlist (like the realtime ice reflection, and the pixelated transitions).
So, moving onwards!
Now listening to “Lindsey Stirling” by “Lindsey Stirling”
Not much to do here, to be honest… It’s an asteroid… 
First I remade the starfield… That had some issues, because I wanted to replace the points with something more pixelated:

Because of the way I had a flag defined, it conflicted with another one, so I had some weird effects while trying to make the billboards point towards the camera:

And the best one:

I like this one, it gave me the idea for a skybox for a futuristic, cyberspace game… 
Also ran into a small issue with the landing cutscene… when we’re on a dark planet, there’s no light so you can’t see the ship… First I tried using an emissive texture to make the window of the ship have some light, but even that way you couldn’t see it properly…
So I ended up adding a light to the hull of the ship…

It’s not brilliant, but it works… Cutscenes in procedural environments are hard!
Also fixed some bugs with the loader… Apparently, the SwapBuffers command on OpenGL returns immediately, even if it’s still rendering, which means that I didn’t have a fade out – it was too fast in rendering, and would miss the monitor refresh and would stutter along the way…
Next up: the cave area!
Now listening to “A Deeper Kind of Slumber” by “Tiamat”
Not much to do here, the desert was rather good looking already and there’s not much you can add to a desert without making it look less desert-like… 
Anyway, had to fix a lot of bugs related to the oasis generation (it was linked to the lake generation, which was removed when I built a decent system for that)…

Next one on the list is the asteroid… I figure there’s not much to do there as well…
Now listening to “Rocket Ride” by “Edguy”
Today was a good day, finished the ice planet polish!

It also means I managed to make the cube maps work on OpenGL (had a nasty seam on the skybox until I found that I had to do glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) to get seamless cube maps on OpenGL)…
So, we got snow, grass, and reflective ice, and I also fixed a lot of small bugs as well!
Next on my polish list is the desert planet, which I don’t think has much to do, just need to look around and see if there’s something that needs fixing/polishing…
Now listening to “Eternal Endless Infinity” by “Visions of Atlantis”
Link of the Day: So over the top, so awesome:
Today I mostly worked on the skybox, trying to get a good result, that works nicely with the ground planet (for the reflection) and for the skybox…
This is the best I could do, glueing together several textures, etc:

It’s not bad, but too sparse, because I have to guarantee a fade out so we don’t see texture at the horizon (because there’s some buildings from one of the textures I used to build this one)…
Think I’ll have to bug the artist to build me the skybox, but at least the tech part is done on the Direct3D front… Now I need to make these shaders work on OpenGL, along with (shiver) cubemap support… 
Now listening to “Mass Effect OST”
Today I’m working on the ice planet polish…
First I wanted to make an ice shader, which means a reflection… Best way to get a cheap reflection is to use a prebaked cube map, but for that I have to add support for cube maps on Cantrip… For Direct3D, that’s already done, for OpenGL maybe tomorrow…
The shader just mixes the base texture of the ice with the lookup of the cubemap, and modulate both of them based on the alpha of the base texture (so we have more reflective areas than others)… I may add some sort of perturbation to the normal map, but I think that might be overkill for the purpose…
Adding snow was pretty easy as well, as well as grass:

Now I need to finish the skybox (the reflection is an overcast sky, so it should match), add scorch marks to the ice (it currently behaves like water, with a spray), and port all of this to OpenGL… A lot of work, but it’s going nicely…
Now listening to “Ki” by “Devin Townsend”
Today was quite productive, although there’s not much outside changes…
Got the OpenGL multithreading error, and the cross-compiling support for ATI and nVidia GLSL working!
I was quite surprised with the OpenGL multithreading, it worked at first try, and it’s actually a quite big piece of code!
Anyway, also added the possibility of the player jumping to any planet he wants, provided he has fuel for it, which saves some time and frustration of going from planet to planet to reach a destination…
In one of the jumps I found this landscape, found it nice enough to share it with you guys:

Next stop is polishing the ice planets (which is much more fun than optimization and bug-fixing)…
Now listening to “Crack the Skye” by “Mastodon”
Started the day nicely by fixing the bug with the planetary landing… the issue was that now we have two dropship objects (one in the ship, the other one in the planet), since we now preload the planet data, and the game decided that when it was the time to have the landing cutscene, it should point to the one in the ship, hence the weird angles…
That was fixed by adding a “priority” to the objects in the current area and having the name matching included only the initial characters when this is the case…
Then I found a big problem… I knew the backend of the GLSL compilers were different from vendor to vendor, but I didn’t expect the actual interpretation of the syntax to be different…
So now, all my GLSL shaders fail with this video card, because they don’t like certain stuff… Some I can understand:
float xpto=1;
This succeeds in nVidia cards, but fails in ATI cards, because “1” is an integer, not a float… I usually use:
float xpto=1.0;
So this isn’t a problem, except some places where I didn’t use that for some reason, and those are easy to track…
A much worse problem is that I use extensively the #line keyword, to provide me with a better way to debug shaders, especially since my shaders are spread throughout a lot of files… The normal (C-like) syntax is:
#line line_number “source_file”
But guess what?! ATI cards don’t support this… They want:
#line line_number source_file_index
So I had to add indexing of the source files, which made me waste most of my evening… 
A friend of fine kindly sent me a link with some other pitfalls I have to watch out for, so I’ll have to review that in some depth before carrying on the work on this…
Now listening to “Follow the Leader” by “Korn”
Link of the Day: Some interesting info on correct usage of GLSL and shaders in general in OpenGL: https://www.opengl.org/wiki/GLSL_:_common_mistakes
So I worked today on the queuing of the planet generation, and a lot of problems came to light…
First, I found out that this new video card I have throws a lot of errors that the previous one didn’t… Mostly they’re warnings, but it took me a while to figure out exactly what the problems were if they were just warnings or things that could bite me later…
Then I built the planet generation queuing, and with that I found a small problem in the way I designed this whole multithreading thing…
As I think I mentioned before, the graphics APIs I’m using don’t like multithreading very much, which means that I have to go to some length to guarantee that all API calls are done from the main thread. What I do is that everytime I swap buffers (so show the rendered scene), I process a command queue that might have been generated by the other thread (the generation thread), creating meshes, textures, getting locks, etc… This works fine and has very little impact in the code I already made, since on the other end, the code that generates these commands waits patiently for the result of the processing before continuing, so I have little synchronization happening, even if it takes a bit more in generating the area…
The problem (that I didn’t see, but I should have) is that due to this way of doing things, commands are only processed once per frame, and because of the waiting on the other end, it means that each command issued on the generation part of the code only actually runs on the swap buffer, so that effectively means that I run a command every 30 ms! I’m doing hundreds (if not thousands) of these in all generations, which means that what used to take about 15-20 seconds now would take minutes, rendering the whole thing useless!
After some soul searching and beating myself up, I decided for a silly hack: now commands are processed in all draw calls. In theory, this could make the game extremely slow, but because of the waiting on the other end, I only ever have one command waiting on the queue, and that’s fast enough!
So now I have the area generation fully multithreaded, and it generates the whole planet in about 20 seconds, which makes the whole game experience almost seamless…
I have an “abort” system as well, so if we decide to go to another planet, the generation of the current one doesn’t finish, and the game moves to the new generation… This required some ugly calls in the middle of the generation code, and there is the (very) slight possibility of a memory leak on the system (which I might still get rid off, since I like my code as clean as possible)…
In the process I found some ugly bugs: ice planet generation is crashing (that’s probably easy enough to figure out, I haven’t looked into the ice planet generation since I started this whole polish phase), the landing cutscene when you come from the Skydancer isn’t working properly (weird camera angles for some reason) and the cave generation is completely screwed up:

I don’t know where the blue comes from, to be honest, the chasms aren’t abrupt anymore (because of the smoothing algorithm I use, since the chasm end in invisible lava) and there’s no light being emitted by the crystals anymore…
And I still have the OpenGL multithreading code to do, and the new static lava shader… So a lot of work to keep me busy this week, before I can get back to making things prettier!
Now listening to “Beyond the Red Mirror” by “Blind Guardian”
So I got an old video card (a ATI Radeon 5850) to replace the one that went kaput yesterday, and I’m up and running again…
Today I started by fixing the stuff I broke on the Skydancer with the latest polish changes in the game… I actually forgot to take screenshots, but basically the windows were flowing (since they were made with the water tile), the engines were also flowing (lava material there), the system was trying to put some height around the water (this was particularly terrible), and I had crashes when I moved to a place where the preloader would kick in…
So, all of those things got fixed, and I started working on the preload of planets, which demands I write some code for “early out”… Since the planet generation takes about 30-40 seconds, if I skip a lot of planets at once, the game will still be computing the first planet by the time I get to the third one, so it will have to wait for a while to be able to go down to it… This is a nasty piece of code, to be honest, because I didn’t think about it when I designed it, so the code is not exactly clean (it’s really a succession of things, with lots of temporary stuff that needs to be cleared up)…
So, now this is how it looks… The new shader for the engines looks sweet, but it will be used in all the lava that doesn’t have anywhere to go!

Now listening to “The Diary” by “The Gentle Storm”