Author Topic: Visual improvements  (Read 4884 times)

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Visual improvements
« Reply #10 on: November 28, 2010, 09:04:17 pm »
I've been noticing trouble with the shadows when in fog for a while, but wasn't sure how much of it was caused by Ex. Especially lately ever since the extension that pushes back the sky (equals more fog) came to be.

Anyway, it turns out fog is not factored into Som's shadows. Kinda nuts really. While trying to sort out what exactly was going on I disabled the alphafog extension a few times. It's amazing just how much better that extension makes things. Anyway, plan on adding a do_shadowfog extension next thing. Should make a huge diff if you're into those little round shadows.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Visual improvements
« Reply #11 on: November 29, 2010, 06:01:27 pm »
There was a kind of interesting development while making provisions for the shadows-with-fog extension... I realized with the shadows in fog, and the transparent stuff in fog, the only thing left not in fog (along a certain render path) was the sky. So I decided adding fog to the shadows was similar enough to adding fog to the transparent stuff, even though the process is quite different, it's really just adding to fog to all stuff blended, which basically Som doesn't do. So anyway the shadowfog stuff will just be wrapped into the alphafog extension, even though maybe technically it should be called blendfog or something...

And back to the sky. Inside the shader, when the alphafog extension is in use, the shader saves a little bit of work by assuming everything is in fog. This doesn't seem to bother the sky because it's not actually drawn in real world coordinates, and with rangefog at least all points on the sky should be at the same distance... anyway, I've never noticed anything weird. So there is this constant basically not used that tracks whether fog is on or not. So I just added a sky specific line of code which only comes into play when fog is off...

What the code does is blend the sky into the background as it approaches the horizon. This was a minor victory because I've been disappointed with the hard line the sky cuts along the horizon for a while. It takes advantage of an additional fog parameter which was added to do the sky blending extension which basically adds an alpha factor to the fog.

I looked at KF2 a while back, and noticed the sky does get darker towards the horizon. Unfortunately I couldn't quite pull that off because the blending with the high color dither (which I'm fond of) causes a very noticeable banding effect. I'm not exactly sure why, but the sky always seems to more susceptible to dithering artifacts. In 32bpp mode the banding probably wouldn't be so bad and the type of sky can make a big diff. A higher resolution sky would probably not look so bad. But anyway the default behavior is to just match the fog roll off on the ground... though there is currently no attempt to synchronize it with the maps fog settings.

The calculation I chose was just to be fast since it happens to all non map vertices basically, but it does look a little better with a power 2 operation, but I'm not sure it's worth it. My original plan was to setup a custom shader framework which worked per texture, and just kick that off by setting up some shaders for the sky textures, but I like this less complicated approach in general / for now. Of course you can still do custom sky shaders.

The power 2 might be more worth it if the sky was higher resolution. However the actual values are linearly interpolated between the sky polygons, so I reckon there being so few polygons it doesn't even really make sense to have a non linear function. I think if someone could use that sky technique John developed to produce just some simple higher resolution domes to replace the ones that come with Som, that would not change the look/feel and would just increase the all around quality of games (in other words I could setup Ex to just swap out the better domes on the fly without fear of changing the authors intent)

The clouds might also look better if you could somehow make them repeat or something. One thing I really don't understand is the band that appears around the skies... more prominently for others. I don't know if it's supposed to represent something like a veil of fog or what. At first I thought maybe it was just an optical illusion, but it definitely seems to be a separate model to the dome in many cases. Anyway, the sky floor extension doesn't help that... not the top part anyway. All layers of the sky though are blended into the horizon.

I'm just roping this extension in with the do_alphafog option -- because without alphafog it won't work. You can control it in the [Details] section with alphafog_skyfloor_constant and alphafog_skyflood_constant. The skyfloor is the lowest point of the sky, which for Som's skies seems to be -0.125. If you make your own skies you might need to change that. It might also effect the way the sky is blended in some way if you monkey with it. The skyflood is not super intuitive. But basically the larger it is the smaller the blend rolloff, or rather the more sky there is. As it approaches infinity it looks more and more like Som's sky. At 0 there is no more sky. Therefore at 0 it's disabled rather than hiding the sky, because inputting infinity into the config file is not worth it :rolleyes:
« Last Edit: November 29, 2010, 06:08:35 pm by Holy Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Visual improvements
« Reply #12 on: November 29, 2010, 11:10:51 pm »
Integrating the shadows into the fog went off without a hitch. I also experimented with a few techniques to try to get the shadows to appear over the outdoor tiles. They generally looked good but all had side effects...

In general whenever the monsters/npcs are walking on an object, that's going to present some problems for these sorts of point shadow techniques. Some heuristic like only draw the shadows on objects/etc that have a lower center than the shadow would probably work out ok.

At any rate... I think this was my last initiative before beginning to start working on preparing some Ex versions of a number of games. Though I'm sure some fine tuning will prove in order as we proceed. The skyfloor effect or whatever was a pleasant surprise in the end, as was a number of innovations I was not expecting along the way.

About all I hope to have to do is to prepare a rudimentary download for each game. I'm hoping/counting on Todd to integrate things however he likes into the website etc.


PS: I won't be tweaking every single asset in each game for Ex or otherwise. Though I will address the glaring problem ones. Though I do hope they are all addressed over time (mainly by way of the images.key file in the EX\KEYS folder)

Speaking of which, I've so far required that the images.key file have an entry for the shadow textue. Otherwise things won't work right in the shadow/skyfloor dept.
« Last Edit: November 30, 2010, 04:33:52 pm by Holy Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Visual improvements
« Reply #13 on: December 29, 2010, 12:10:52 pm »
I'm trying to figure out how to word an extension to let you visualize the lighting normals. Mainly to make sure everything is in order / spot problem object etc.

But anyway... while I was visualizing the normals myself this morning, I noticed that the sky dome has lighting normals which are not leveraged by Som. I'm trying to setup some more elaborate extensions for controlling the sky material. But another interesting thing would be to apply the directional lights to the sky in some way. A natural sky would not look right I think with arbitrary lights (not how the atmosphere works afaik) but a top down light could create an effect something like a sunset, or something more natural for sky lighting anyway.

The colours you see in the sky have more to do with atmospheric scattering I think, but in lieu of a dedicated scientific sky shader of some kind just slapping on a light would probably add some colour/shape. Hopefully any banding would not be too bad.
« Last Edit: December 29, 2010, 12:13:32 pm by Holy Diver »