There's been plenty happening since the last update, even though we haven’t been sharing a lot of it here.
On the code side there’s been a lot of debugging and fixing. It’s crazy how many little things need to be done before a release.
I’ve recently added the scanning mechanics which brings more depth to the exploration part of DSS.The detection is based on how much radiation is emitted from the pulse scanner and how much of it is reflected by any given object. Then, if the amount reflected to the source ship is greater than a certain threshold, the object gets revealed.Distance is factored in using the inverse square law meaning that the further an object is from the source, the less it will reflect back and the harder it is to be detected.
Once again, the feature has been done completely through the mod API :), meaning any modder could have implemented this feature just as well.
I’ve also been working with Mathias on the lighting pipeline, the shaders are getting quite complex now and and lighting has been improved considerably.There are a lot of factors to take into account: multiple lights, self illumination, specular lighting, normal map, oversaturation, bloom, fog, etc. The result is pretty rad I think. Read on for a more detailed breakdown and the motivations behind the shader improvements.
For a long time DSS was lit in a simple way using a single main directional light source and ambient light. The main light is used to render and bring out the forms of an asset while the ambient light is used to lighten the shadows and so help to integrate an asset into the environment.For instance, with an orange skybox an orange ambient light is chosen. It's essentially a cheap way to approximate environment lighting.
This setup is effective, but far from perfect. Its limitations are amplified by us being in a full 3d environment without a ground plane, which would block out many viewing angles.With only a single directional light, but the ability to view assets from all sides, you will inevitably see the shadow sides, which are light only by ambient light, a lot of the time.All that ambient light does however is brighten the textures evenly, it doesn't shade forms, and so tends to flatten out forms. This decreases readability and generally just doesn't look very impressive.
The solution to this is is introducing multiple directional lights and lessen the reliance on ambient light.
I knew I wanted multiple light sources for a long time and so when I did our first set of sky boxes almost a year ago, I planned ahead and included about 3 bigger background stars in most backgrounds.Now, with the shader update to support multiple light sources, I can set up their locations to match the skyboxes properly.
The result is assets, seemingly lit by the environment, without doing actual environment lighting and with the added bonus of more fine control, as I can tweak all lights individually.
Notice how this shipyard is lit from a cool light source coming from the top right and an orange light source coming from the bottom left. This was impossible to do before.
Those asteroids are lit in a similar way, although the cool light is coming from above and the warm light is coming from below.
Also check out this light setup in the ship designer.
On left side the corvette body is lit by a single light coming from above and some ambient light, while on the right, it's lit from 3 lights + ambient.
Multiple lights are fantastic, but there’s more.There was a problem with the previous shaders and it's pretty obvious in sectors with a very bright skybox, such as this:
Notice how the stations look very dull and in fact even greenish(which is an illusion)Also note how flat the bottom parts - lit only by ambient light - seem.If I don't want to use a 1,1,1 white light source, but instead use one that is orange, I'd have to do something like 1,0.75,0.5(rgb), which would dull things even further because it will be less bright than a white 1,1,1 light source.
The way the shaders/lights used to work was like this: If the surface of an asset is perfectly facing a 1,1,1 light source(rgb, full white) it will render the very color of the texture. For instance, if you have a mid gray texture on a surface facing the 1,1,1 light source, it will render as precisely that mid gray color.In reality light sources are not capped light this, light doesn't have a limited brightness specified in r,g,b values.The brightness of the orange skybox suggests a light source that is far brighter than what we can do with our 1,1,1 light on a dark grey texture. So we introduced a light intensity multiplier.
In addition there's a specular light multiplier to be used alongside the intensity multiplier.Furthermore there's a new specular multiplier on the material level, for some extra kick to more closely resemble metal. The specular color used to be determined on the material level only, but now it's a mix of material spec color and color of the light source, allowing us to properly use colored light sources(which produces white speculars before).
Notice in the image above how the lit sides and the highlights blow out, this is expected and in our case wanted from a very bright light source. Also notice the redish light coming from below, giving more depth to the form.
Some more examples:
All of these changes allow us to integrate assets into their environment much better and more believably.
We don't usually share things like this, but one of the downsides of working far apart is communication. Considerable time is spend to just share ideas and concepts and explain to each other what needs to be done. Mockups help doing this and here's an example that I made to explain the shader changes.The actual implementation ended up different and much more elegant than what I did here of course :)
In short, things take a lot of time, often more than you can imagine and more than oneself estimates.