Author Topic: Visual improvements  (Read 4885 times)

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Visual improvements
« on: August 17, 2010, 11:08:51 am »
I'm not positive how many ways Som can be immediately improved visually without any loss or input from authors. But I came up with a goody today, and I can think of at least a few more, and I have a feeling if everyone just listed their pet peeves that might lead to some others. I'd like to restrict any discussion to improvements that don't require setup by authors and would be an all around improvement with only negligible cons if any.

My number one pet peeve is the map pieces disappearing along the flanks in wide open vistas, especially in widescreen mode. The factors that lead to this are potentially many but it's safe to say I think that Som was never intentionally meant to be played in any aspect ratio other than 4:3. Even though there were other aspect ratios for monitors, and even PAL for TVs, Som seems to be hindered by an NTSC-J (ie. Japanese console games) mode of thought. I've got no lead on this but it's high up on my list. Most likely if a fix exists it will require interfacing with Som's memory to some extent.

Another problem is the object vs. map pieces lighting mismatch. Theres no way to integrate an object with map pieces if the lighting setup is complex because Som only computes shadows etc for map pieces. But if the lighting is simple the colours should fuse as much as possible. I'd like to see if the object lighting can't be calibrated to improve upon this. However best results (with the traditional lighting model) would come from a tool that could fuse static objects into map pieces (making a new custom piece)

I would like to see if the 4 lights per object limit cannot be exceeded by forcing all lights in the map to light objects/monsters.

Finally I want to report on a very simple fix which fogs transparent objects. I've tested it with DD and it's a radical improvement even in the area with the white fog. Whether the effect is perfect or not depends on the order the fog is blended (if perfect it's added to the object's colour which is then blended with the current pixel colour -- if imperfect the object is blended then the fog is added on top of the summed pixel) either way by forcing transparent objects to have black fog you get much better results whether your fog is dark or light (the entire spectrum of fog)

I will attach a screenshot. Obviously the best thing about this is your transparent water sheets blend into the fog like everything else, instead of being constantly bright and then suddenly disappearing with a hard edge. Which is a big improvement (just to be clear)

For instance the seaside cliffs in DD, or the water realm in DoM. This will be available in the next SomEx.dll release, by adding "do_alphafog = yes" to the [Options] section.

UPDATE: Added a brightened version of the same attachment/image.
« Last Edit: August 17, 2010, 11:49:50 am by Holy Diver »

Offline dmpdesign

  • Moonlight Retiree
  • Administrator
  • Dark Slayer Destroyer
  • *****
  • Posts: 1864
    • http://swordofmoonlight.com
Re: Visual improvements
« Reply #1 on: August 17, 2010, 11:22:43 am »
It may very well be my monitor at work, but I cant make hardly anything out in that picture Holy...the setting is very dark.

Is it just me?
- Todd DuFore (DMPDesign)
Site Founder

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Visual improvements
« Reply #2 on: August 17, 2010, 11:32:19 am »
Yeah I'm not sure if that is the default Som lighting or if it is also dark because of the ambient lighting in DoM. I don't have any trouble making it out, but I can definitely see how someone could, especially on a CRT display with a poor gamut. I tried to increase the brightness option only to be reminded it doesn't work yet in window mode (something I guess I need to get cracking on)

I keep the brightness for DoM on 4, so I don't know if that is darker or lighter than in that screenshot.... if you literally just see black I will try to manually brighten the image and post that too eventually. The basic idea though is without this effect the water sheets would be blazing on the image and have a stark outline dominating the black space. A before/after shot might be worth something. I will try to do that later with two windows open :D

PS: The icon is missing from the window because of a Windows bug I just caught where if the game starts in fullscreen (undecorated window) the icon is never drawn to the titlebar even after it comes out of fullscreen. I fixed that anyway, but just in case anyone is wondering. I gotta say Som is so much less cheesy with just this fix (the fog / not the icon!!)
« Last Edit: August 17, 2010, 11:34:52 am 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 #3 on: August 17, 2010, 11:42:25 am »
If btw you need to see something dark... if you can go into your video card setting, there is a colour/gamma correction setting where you can just increase the gamma which will make your display all bright, then cancel without affirming the setting when you're done.

WEIRD: My present display drivers wouldn't let me do colour correction?? So anyway, I've added a brightened version to the top post.
« Last Edit: August 17, 2010, 11:51:40 am 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 #4 on: August 21, 2010, 12:21:28 pm »
I'm adding a do_rangefog option.

Range fog computes the true distance from the viewer instead of the using the pseudo-depth coordinate for fog. The benefits are when you turn around the fog doesn't change (as you'd expect) and you don't have a sweeping line, almost like a scanline delineating your fog. Which is especially apparent in 16bpp mode because the fog tends to manifest as thick bands of colour.

The cons are rangefog is not per pixel. You can implement per pixel fog in a shader, but it's generally not considered worthwhile (though I might add that as an option yet) expensiveness wise. Instead the distance of every vertex is computed and the fog gets interpolated across the triangle like everything else. In general the results are exactly what you'd expect. The distance however is not linear per say (imagine a circle of fog emanating from the player) but the interpolation is. So you can end up with a visual disconnect.

In practice it looks like better quality fog. But in theory like if you had a wide floor that was one polygon (say two triangles) then the fog across it would appear linear, but the fog across other things in the room would appear more "correct". If the scene is fairly detailed and full of natural polygons (the outdoor ground in Som is a pretty good example) things look good. But across very flat surfaces, I can't even say if busting it up into smaller polygons would help or not. But at worst hopefully the player isn't that focused on fog.

The only trick I can think of would be to bump things up to D3D10 for Geometry Shader support. If you could tessellate the polygons with respect to screen space that might look better. I've noticed modern games always have their surfaces very tessellated. Even when flat, mostly it seems for vertex color based shadows. All vertex color approaches end up with houndstooth patterns however. Another ubiquitous feature Geometry Shader support could bring to Som would be shadow volume extrusion. So with beefy enough hardware all objects could project shadows that match their silhouettes (versus the little fuzzball shadow) ...I generally prefer this kind of shadow, but it can be very hard edged. I think maybe modern games draw the shadows to the stencil buffer then sample the stencil buffer to produce the vertex colors for their tessellated geometry so that the hard shadows are softened that way. But with Som's more abstract look I think I'd rather have the hard edges than the houndstooth artifacts. ST:Abyss had some volumetric shadows going on here and there. The PSP has better support for this kind of effect than the PS2.

EDITED: The only real trick would be working out what light source would dictate the shadows. Another effect I want to add is to load a 2D map of each map up as a texture. With four color channels. I was thinking one channel for instance would be light. So you could make the squares inside a cave darker. And another might be sea level, which could be used for water effects... another temperature for feax effects. But probably it would be best to store the light intensity (a) and direction vectors (r,g,b) in their own map and that could drive the shadow volumes. Then you could just make a b/w 100x100 image and dob it with an airbrush effect in your paint program, then run that thru a normal map generator and use then copy the original image into the alpha channel, and you're done.

I guess you'd still want ambient light intensity in the effects map, or maybe better yet a whole other map for rgb+intensity ambient lighting.
« Last Edit: August 21, 2010, 12:43:58 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 #5 on: September 11, 2010, 09:18:36 pm »
Here is some good news.

I've noticed that the little sprites like the lamp flames and the flames that appear in the hands of the skeleton magi are not displayed via the same interface as the map/object graphics. I'd assumed the alphafog extension would fog out those sprites but I guess I never actually payed attention to that in game.

I actually did not want them fogged just because it seemed really haunting to me to approach a field of of those skeletons for example and see all their lights flickering in the distance despite everything else being black. Of course on the other hand it's not "realistic" for the lights to just appear out of nowhere, but if it's your fancy you can just pretend the lights popping up are the monsters acknowledging the presence of the player. And it does make sense for the lights to peek thru the fog a bit more.

So anyway I reckon the way to go is to just add a multiplier setting for the sprite fog. So you can set it to 0 to disable it, or 1 to make it the same, or somewhere in between to make the sprites catch less fog but eventually fog out also (more or less)

Also I've noticed numerous cases where the stuff in game gets cutoff (not disappears) before it's consumed by fog. I'm not sure why this happens. I don't think I see it in DoM, but I definitely see it in DD. It might have something to do with how far your draw distance is or whether or not sky is turned on. It might help to add a setting so fog can be pulled forward by some amount so your game doesn't suffer from that. You would then want to make your draw distance a little further. And if everything worked out you would never see hard edges where stuff is clipped against the back pane of the viewport. Whether it would fog out the sky I dunno. The alphafog extension doesn't seem to effect the sky (which is a good thing)

UPDATE: It's hard to tell for certain but if I had to make a bet I'd guessing the clipping is the sky being drawn over the background rather than vice versa. If I could isolate the sky it might even be possible to artificially push back its depth in the zbuffer so it would only get drawn onto pixels that have not had anything drawn on them, which might look better, especially indoors.
« Last Edit: September 11, 2010, 09:23:30 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 #6 on: September 12, 2010, 08:42:14 am »
I noticed in 16bpp mode the monster/npc shadows were not reaching pure white giving them a square outline. So I bumped the pre-blending brightness up just enough to get them over that hill. The shadows must not be 15bit textures. I'm assuming the same glitch (or whatever) exists under DirectX7, but it might be the colour conversion is handled differently. Doesn't hurt anyway just to be safe.

I'm not sure how popular these shadows are because I have a feeling they clip when walking up hills etc. Because of their peculiar blending mode they are probably pretty easy to detect. At the very least they could be turned on/off with a global setting (assuming they are in the game to begin with)

I assume they just stay level with the monsters feet... or wherever ground level is relative to them. I'd bet in fact that the imps for example have a shadow that will float in mid air unless they are just the right height off the ground.


UPDATE: Err actually it turns out that the crappy shadow images stop short of 255 at 248 :doh:
« Last Edit: September 12, 2010, 08:58:12 am 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 #7 on: September 15, 2010, 01:29:05 pm »
I'm going to add an extension to Ex to disable non 4:3 resolutions when I can get around to it. It's clear Som was never meant to be played in widescreen and it causes a lot of trouble... map pieces disappearing on the flanks, and text in the menu being way too tall (though that could be fixed without any new achievements on the technical front)

The main problem is the map pieces disappearing. If your draw distance is very close as is DoM's it doesn't seem to be a problem / that game is good to go for widescreen. But if you like vistas like DD it's probably more practical to disable widescreen. Combined with window mode (which I recommend for all without question) your game will fill like it has better quality even though without widescreen option. Ex also preserves the aspect ratio in fullscreen, and also in true fullscreen mode if the monitor does not force stretching. So you can be sure people stuck playing in fullscreen on a widescreen monitor will not be stuck watching fatty vision.

Of course ultimately I want to find a fix for the widescreen bug, but it's going to be a tough one, and there is a possibility it will not be correctable.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Visual improvements
« Reply #8 on: October 20, 2010, 02:59:32 pm »
The 16bpp mode generally looks really good with dithering. I realize 32bpp is technically better but something about it just doesn't seem right. Well not with the stuff that comes with Som anyway. I'm sure if you did everything custom with really high production quality it would be as good as anything, but for the most part the 32bpp just kind of highlights the shabbiness of the otherwise really nice graphics.

Anyway the real Achilles' heel of 16bpp is the black tint blend which is applied successively in the menus. If not for that tint I'd guess that 32bpp was never really the primary target (because everything else is 16bpp) 

16bpp does not do well in the dark. And it does even worse when squashing a fully lit image into a dark image, ie. black tinting. The reason why is you're taking an already limited colour range and squashing it into (in Som's case) a half of that range. And then another layer of tint, and it's squashed again, and by the 3rd or 4th layer (which Som sometimes applies) there's just no range left at all and you end up with like a two colour image :rolleyes:

So I'm thinking... with Ex at this point 16bpp pretty much never comes for free, and just ends up being converted to 32bpp anyway. So might as well cut out of 16bpp before the first layer of tint is applied. Up until Shader Model 3.0 the only way to do the colour conversion is draw everything to a 16bpp surface, then plaster that surface over a 32bpp surface as a texture. But 3.0 is the best quality target atm, and it can actually do the 16bpp conversion without any middle surface or even any coordination, so this should even be a performance booster in best quality mode as long as the middle surface is not required for any special effects.

With shaders you can even cheat and just do everything in 32bpp mode then do the 16bpp conversion with dither... which would look at least as good a 16bpp mode probably with better colour where blending is involved.

Sometime it may be worth setting up an auto-brightness effect to try to simulate the eye adapting to the light level. That would allow some more range to be reclaimed / would be interesting.

It's funny I mentioned setting the black level to just above true black in another post today, but I decided to chew that over for a little while longer because it had the weird effect of making dark games even darker. I wasn't sure why for a while but decided it's an optical illusion... which basically works because bright things seem darker next to other light things than next to dark things. Kind of like one day I spent quite a while trying to decide if my lighting calculations were wrong in the opening hallway off DD because whenever I got close to a torch it would get darker... that drove me nuts until I realize while walking towards/more under them they moved from a dark backdrop to a light backdrop and hence only seemed darker :doh:

^Weird thing was under DX7 I'm pretty sure they did not seem to become darker. But under D3D9 they did. I was worried about my shader, not D3D9. I based it on the D3D9 docs, and it indeed looked like D3D9, but I still couldn't figure out for the life of me what the hell was going on. It may be the DX7 specs were somewhat different in the lighting dept. But either way I decided it was just an illusion.
« Last Edit: October 20, 2010, 03:02:32 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 #9 on: October 22, 2010, 02:23:30 pm »
Everything does look a whole lot better in the dither dept. when it's applied as a post step (after all the blending is done)

The water looks much better. The black tint at its darkest is even acceptable. May just leave it at that for a while, because I can't think of a simple way to do the menus in 32bpp precision, then switch back to 16bpp for the 3D item overlays in the menus.