A skybox texture from the add_skies hak of the Community Expansion Project (CEP)
What has made skyboxes better?
I'm not the only person to work on skyboxes, of course, and a lot of the issues above have been avoided, corrected, or negated by efforts amongst the community since the skybox feature was introduced in 2003's Hordes of the Underdark.
- Cubes have been replaced with lots of shapes, including domes, semispheres, and cylinders. These shapes usually do not come with "lids", to the regret of camera-hak users.
- Textures have been replaced with higher resolution textures. Since the viewing range from horizon to top of screen with the Bioware textures as mapped by default is often only a few hundred pixels, using new shapes focusing on "above the horizon" texturing, with higher resolution textures, has often provided much denser pixel quality for skies.
- Many skies have been converted to
.ddsallowing even higher resolutions to be possible with much faster processing and much smaller file size.
- Some "alternative skies" have been introduced to provide non-sky backdrops for scenes, such as cavern interiors and forests.
In attempt to address some of the issues with default skyboxes (beyond lack of variety), some of these skyboxes have unfortunately worsened some of the other issues. The higher resolutions often impacted the game more heavily, and instances of extra geometry either distorted textures more, or proved to be more difficult to make than the default box shapes. Additionally, a lot of these textures were "lifted" from other sources on the internet, which has been accepted by much of the community, but frowned upon by others.
A skybox model from the Prisoners of the Mist PW server, made by Soren / Zarathustra217: Shown in a 3d render in Blender
High resolution source panorama, downloaded from https://shinesmiley.files.wordpress.com/ around April 2017 for work on custom skybox
End result of first skybox attempt, as seen in-game in the Arelith Fixed Level Server
Close-up of color banding issues stemming from original image and poor in-game resolution
Skyboxes were one of the first things I worked with in NWN. A lot of my inspiration for finding content to make comes from looking around in the game and noticing ugly colors, noticeable pixelation, or poor performance. The skyboxes had all of these things for me.
Copy / Paste
In the beginning, my approach was to replace the textures, they seemed like the biggest culprit, and being new to the game's assets, I hadn't yet noticed a lot of the issues detailed above. The first "re-skin" I made was with a texture I found of a phone panorama taken on top of a mountain. There were several things I liked about this image: the lack of a clearly defined circular sun, the crisp color contrast, the depth of the blue sky, and even the shape of the clouds. I used some filters on the image to make it look a little more "hand-painted", and threw it into the game with pleasant results.
However, there were of course problems. I still didn't have the resolution I wanted, the pixels were a bit blurry, and in the emptiest sections of the sky I noticed a lot of greens and purples that didn't enhance the color blending, but detract from it.
Meanwhile, Bioware's 1024x1024 texture stack wasn't nearly capable of showing this texture, so I raised the resolution to 2048, and then eventually to 4096x4096, 16x the original size of the skybox textures that were already slowing down most computers. It was around this time I set out to figure out what
.dds was, how it worked, and if it was worth using for skyboxes. After my research, I switched formats, and found the results much more playable.
Feeling a little guilty about having stolen an entire photograph, I set out to make the night sky have more original elements. The sky was made busier to cover the color banding, and source images were only taken in small samples and heavily modified. Contrary to the day sky, and in accordance with the Bioware sky, I wanted to make the moon both locatable and well defined. Since no one would see the texture below the horizon, however, I used the original sky as a template and worked on top of it.
With both a day and a night texture for the skyboxes, I passed out some copies to willing testers, who either loved everything about them without constructive input, or were able to point out the various glaring issues with my maiden voyage work.
Unhappy with either, admittedly, and less interested in finishing with dusk/dawn textures to round out the set, I shelved the work for a few months.
It seemed with the skybox textures fixed to the model so that half of the detail was below the horizon, it wouldn't be possible to get the resolutions I wanted for skyboxes with the level of detail found in the other games objects.
Night sky painted over day-sky texture, with copy pasted "milkyway" textures, stars, moon (made out of photo of Mercury), shuffled around to be properly continuous.
Night sky as seen in-game in the Arelith Fixed Level Server
Designing the 8 panel octagon cylinder, one panel at a time
The final 8 panel sky-ring, one panel selected (in orange)
I didn't quite find what I wanted in the community created shapes. Some of them had good coverage and pixel concentration, but they were too pinched or stretched from the curves in the geometry. Others seemed easy to map a texture too, but spread too high and low, putting wasted texture pixels outside of viewing angles, and wasting resolution.
By comparing my gameplay resolution to how of the game view was taken up by the sky with the test texture, I decided I could come up with a good system to fill in sky-space with high resolution imagery and keep them as flat as possible.
I started with an octagon cylinder, aimed at making 8 individual textures, separated each of the 8 sides from each other, and divided each side into 16 sections. Then I used proportional editing to rescale the upper vertices more than the lower vertices, to curve the octagon in, and used proportional scaling again to puff out each panel's interior vertices to equally distribute them into a rounded shape more like a 32-gon than an octagon.
The ring came out pretty well, for a first project, and I was comfortable that it had a good equal distance curve from the center (like part of a sphere), and covered enough sky to go both below the horizon and above the max camera angle. All that was needed at that point was exporting the 8 individual continuous textures to fill each of the panels.
This time I started with night, and while I first imported the night sky I had made above, the new format (8 panels, starting at 2048 x 2048 each) did allow me much more resolution than the finished product of my original night sky (one 4096x4096 texture at its best, with ground/sky/ground/sky in any vertical line, 1024 total height of the sky), so I decided to start fresh.
The sky I ended up making was mostly featureless, to test the performance of the model and the resolution. I was half hoping the game wouldn't try to draw panels not currently in the view frame, which seemed to be the way the game worked for players.
Often times people with lower performing machines would experience a severe framerate drop when looking sideways enough to see any part of a skybox (if skyboxes were on). However, after testing, It didn't seem like my plan of having the game only drawing the half of the sky you could see worked, but I finished the separated system anyways.
I started with a very dark blue background, then randomly generated small random dots of white and bright blue, faded them slightly, generated more, faded them and blurred them slightly, and then generated a third pass.
I did the same using a "clouds" generator filter, to achieve a mix of galactic clouds and atmospheric clouds. I took some creative control of different cloud colors, nothing too elaborate, and sliced up my final 16384 x 2048 texture into it's 8 individual
.tga squares, and threw them and the new skybox
.mdl file into the
/override folder, and launched the game.
One of the eight panels used for the new 16384x2048 sky-ring
New night sky override as seen in the Arelith Cordor PW server
Here's how that went
- The quality was superb. 2048px tall is more than the resolution of the game, so there was absolutely no blurring or pixelation at any section of the sky I was looking at.
- Between the camera pointing at the ground, and pointing at the sky, my framerate dropped from about 40 frames per second to 2.5! That's not good.
- I could see each individual panel, unfortunately. The seams I had noticed in the default skies, and in my first pass at HD skies was still there, despite the brand new model. But now there was 8 of them!
I double checked the texture mapping tverts in the
.mdl ascii, all looked precise. The seams were an annoyance, but still not as grievous of an issue as the unplayable framerate, granted I had not compressed them to
.dds yet. After doing so, I noticed dramatic increase in my performance (frames per second ~ 22) but, still something that would be extremely limiting come combat time. It's somewhat to be expected that a switch from 1024x1024 to 16384 x 2048 would slow down the game a bit, but I was determined to find a workable solution.
So, after thinking about it for a while, I turned off the filtering. I had recently discovered that the game allows the use of
.txi files to outline extra properties of included textures of the same name. This allows you to control how the game presents them. This is how animations are accomplished, and by adding a new command to a
.txi for each of the 8 textures, I was able to turn off the part of the game that tries to fill in the space between texture pixels with smooth color transition. After all, if the skies were already 2048 tall, and you couldn't see them from top to bottom at any single viewing angle, I didn't need the game to fill in intermediate colors, I already had more pixels than would fit on my monitor!
.txi commands for each sky texture in the 8 panel model
It turned out that for a texture of this size, filling in the color between all of those... 33,554,432 pixels was quite a costly default background process for the game to tackle, and turning the feature off for just these textures brought the framerate back up to normal playing levels. For my eyes, at least, there was no noticeable drop in quality of the resolution, though it did seem that the stars seemed to "twinkle" while I was moving around in the game, as the pixels slid around between different pixels on my monitor. It could be the case that this occurred with the filtering on, but with a framerate of two, I wasn't able to observe it, and I kind of liked the twinkling.
Having accomplished one impossible task, I switched targets to rid the skies of the "seams" between the panels. Since the edges met perfectly, I didn't understand where the color was coming from.
The colors in the seams seemed to be random, and were neither one solid color, like one would expect the "behind the sky" color to be, or something having to do with either of the adjacent panels. Eventually I remembered something from my earlier work with reverse engineering the
.dds format, when I noticed a texture "wrapping around" in the game.
So, it appears that there is a small margin of error on the eventual placement of texture pixels. Depending on the viewing angle, perhaps which tverts end up on which screenspace pixel influences which number of colored pixels from the texture file get grabbed to fill in any given [triangular] surface.
Now, on the edge of each of my panels, when more pixels were needed, the game's behavior defaults to grabbing pixels from other other side of the texture. This means that at the right edge of one of the panels, sometimes, there would be a little sliver of the beginning of the left side, where the panel begins to repeat the texture.
.txi to the rescue again, I discovered (with a lot of searching, I think of the Knights of the Old Republic modding community forums, at this point), that there was a property called "clamp", that under-no-circumstances allows a surface to "repeat" a texture after going "off the edge" of a texture. Adding the command to the
.txi immediately, and finally (perhaps for the first time in NWN history?) provided me with an in game sky texture with no seams what-so-ever. I did a test case with the much more obvious seams in my original, lighter, night sky texture, and the seams were completely gone.
Seam visible caused by texture-repetition at the end of a face/texture
Seam removed using the clamp 3 command in each texture's