Cave & Outdoors Harmonization and Illumination

Production of artwork for the game by regular contributors takes place here.

Moderator: Forum Moderators

Post Reply
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Cave & Outdoors Harmonization and Illumination

Post by Eleazar »

EDIT: I split this out from my terrain thread since it is an involved topic that could get lost in my main thread.

Cave & Outdoors Color Harmonization

It's often been said (and even more often ignored) that cave terrains don't belong on outdoors maps. It's true that many cave terrains don't make sense outside of caves, and that cave terrain don't look quite right on outdoors maps.

But there are a significant subset of terrains that make sense in both outdoors and subterranean maps. Water, Dirt, and Cobbled road terrain make perfect sense in caves, and Chasms, Lava, and Dwarvish castles make sense under the sun.

However they still don't look right next to each other. Night on outdoors maps is simulated by the game darkening the hexes. However there is no darkening effect applied in underground maps. The darkness of cave maps is achieved simply by making the original cave tiles rather dark. See attached.


My proposal is to lighten all cave terrains and add a darkening effect to the "underground" ToD. This would have the effect of making cave terrains look more or less the same in cave maps, but non-cave terrains would look better in caves because both would be receiving the same darkening effect. And cave terrains (like chasm) would would look better outdoors, because they would no longer be darkened twice at night-- once in the original file, and once by the ToD night filter.


I'm confident i can do the necessary color-shifting of terrains, though there are a good deal of terrains to adjust. But i want to check before starting this to make sure there are no unexpected ramifications.
Attachments
Note the relative brightness of the dirt and water
Note the relative brightness of the dirt and water
cavetest.jpg (103.06 KiB) Viewed 13359 times
Note the relative darkness of the cave tile and villiage
Note the relative darkness of the cave tile and villiage
test.jpg (121 KiB) Viewed 13359 times
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
doofus-01
Art Director
Posts: 4121
Joined: January 6th, 2008, 9:27 pm
Location: USA

Re: Eleazar's Terrain Improvements

Post by doofus-01 »

For what it's worth, this idea makes sense to me. One thing I just want to bring up is that the "lit cave" light beams should still be easily visible.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Eleazar's Terrain Improvements

Post by Eleazar »

doofus-01 wrote:For what it's worth, this idea makes sense to me. One thing I just want to bring up is that the "lit cave" light beams should still be easily visible.
Yeah, the lit cave is made from a nearly white overlay, so it should be visible on anything darker than desert. I still have the PSDs if there need to be tweaks.

I kinda want to redo/retouch most of the cave terrains anyway, so this wouldn't be taking me too far out of my way anyway.

I wish we had a better system for showing lit/dark hexes than stacking on overlays, but there are some difficulties with a more robust color-shifting for ToD. As an additional bonus the change discusses in my previous post would make just as much sense (or more) if we were implementing a per-hex ToD color-shifting system.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Alink
Inactive Developer
Posts: 181
Joined: March 5th, 2007, 6:45 am
Location: Belgium

Re: Eleazar's Terrain Improvements

Post by Alink »

Eleazar wrote: As an additional bonus the change discusses in my previous post would make just as much sense (or more) if we were implementing a per-hex ToD color-shifting system.
That would be some serious coding work and will probably have some cost (mainly in memory because we would need to store various ToD versions, and for cpu because of some new cache bookkeeping). But before even checking the implementation part, are you sure that it will look better, or even good ? A per-hex ToD difference means no light transitions, which causes the hex edges to be very visible (and probably ugly). That's a bit sad when combined with the nice smooth terrain transitions.

BTW, here is 2 old underused ToD features that we should probably use or kill before adding other new ones.
(warning, underused means not sure how functional/buggy they are)

- ToD image variant, which should allow a terrain to use variable image depending of ToD. I always thought it should be used to add light behind village's windows at night. Could also be used to make some underground terrains different. A bit work to test because of the terrainWML macros.
http://wiki.wesnoth.org/TerrainGraphicsWML

- ToD image masks, which display an image on top of terrain depending of ToD (using alpha, which is less nice than color shifting). Need to verify that it also works for ToD areas, but I think so. There is also a smooth transition effect between turn when images are different. Should be easy to test by editing macros/schedules.cfg
http://wiki.wesnoth.org/TimeWML

Note that I always wanted to kill both features, not because they are bad but because they seems not really used and still add complexity in code. They also have the same hard edges flaw as with your proposal. BTW if you start to use them massively, we will probably also need to check/update the implementation part, but at least you can already see the final result.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Eleazar's Terrain Improvements

Post by Eleazar »

Alink wrote:
Eleazar wrote: As an additional bonus the change discusses in my previous post would make just as much sense (or more) if we were implementing a per-hex ToD color-shifting system.
That would be some serious coding work and will probably have some cost (mainly in memory because we would need to store various ToD versions, and for cpu because of some new cache bookkeeping). But before even checking the implementation part, are you sure that it will look better, or even good ? A per-hex ToD difference means no light transitions, which causes the hex edges to be very visible (and probably ugly). That's a bit sad when combined with the nice smooth terrain transitions.
What's really sad is that a major strategic feature of Wesnoth, light, is so badly implemented with ugly circular overlays on top of already color-shifted base terrain. And that on mixed maps (with ToD areas) caves darken and brighten with day/night, while this visual change has nothing to do with the chaotic bonus they give. There's a lot of interesting ways illumination could be used on maps, if we actually had a way to show what's going on.

Yes, i'm sure this would be an improvement. It wasn't the improvement i was trying to achieve yesterday, but your links make me think it may be relatively easy to achieve.

Here's a link to an older comparison.

As far as giving the illumination effects a soft edge instead of a hard one, that would be easy to achieve if ToD image mask could properly deal with a mask larger than 72x72. Note the illuminated cave. It uses a multi-hex tile with a fuzzy edge that meshes perfectly with other tiles of it's kind.


Alink wrote:BTW, here is 2 old underused ToD features that we should probably use or kill before adding other new ones.
(warning, underused means not sure how functional/buggy they are)

- ToD image variant, which should allow a terrain to use variable image depending of ToD. I always thought it should be used to add light behind village's windows at night. Could also be used to make some underground terrains different. A bit work to test because of the terrainWML macros.
http://wiki.wesnoth.org/TerrainGraphicsWML
It used to be used that way. I agree it would be nice to have lit windows. I don't want to get distracted from the 50 things i'm already doing to make all the villages lit, but i could do one set, to raise awareness that this feature exists. However, i'm not sure how to invoke this in the terrain-graphics.cfg.
Alink wrote:- ToD image masks, which display an image on top of terrain depending of ToD (using alpha, which is less nice than color shifting). Need to verify that it also works for ToD areas, but I think so. There is also a smooth transition effect between turn when images are different. Should be easy to test by editing macros/schedules.cfg
http://wiki.wesnoth.org/TimeWML
For the kind of color-shifting that BfW does alpha is only slightly inferior, or maybe even different but equal. That gradual transition is nice. I wonder if this is the remnant of an old ToD system, or a "new" one that was never used.
Unfortunately ToD areas and (if there's a difference) illumination cast by a MoL are ignored.


Theoretically both of these systems could be used to get the ToD varied-by-hex effect that i want (if the second one didn't ignore areas. And with the first one i'd have to at least triple the number of terrains PNG files, which would theoretically look best, but would be a huge job, and add i'm not sure how much complexity to the terrainWML.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Alink
Inactive Developer
Posts: 181
Joined: March 5th, 2007, 6:45 am
Location: Belgium

Re: Eleazar's Terrain Improvements

Post by Alink »

Eleazar wrote: For the kind of color-shifting that BfW does alpha is only slightly inferior, or maybe even different but equal.
Replacing globally the color shifting (adding RGB values to terrain images) by a ToD half-transparent mask has some big implications:
- This would indeed make possible to have light transitions, basically like fog do.
- I am no artist, but to cite Jetrell from your last posted thread: "colors are washed out". To take an extreme example, color shifting allow to simulate well a pure red sunlight, but alpha blending can't (it will look like a red fog).
- Units will be ToD colored too (currently not), because they will be under the ToD mask (forced because of the terrain foreground stuff). This has implication for team-coloring differences and UI stuff.
- All that alpha blending will be slightly slower to render than simply blit a cached color-shifted version. OtOH, we will gain some memory by avoiding this big cache.

Now, the problem with color shifting is that it can not use smooth edges. It's too slow to be done in real-time, so it's currently cached. I suppose that we could cache all the possible lighting transition cases for each terrains needing it, but that could be costly (there is 2^6 possibilities, a dozen very common). Again, not a big 'impossible', but a big expensive job to code and process.

On a more positive note and to get back on your cave problem, I realize now that it should be easy to disable the ToD color shifting in some ToD areas (the untouched images are already in memory). There is still the transition problem though, especially when it's night outside, because underground terrain would be more lighted. But that could be a solution to at least have a fixed ToD coloring in caves, regardless of sunlight. Maybe you could then even uses the same trick as illuminated caves but reversed to have darker caves, which will also spread "shadows" transitions to the outsides. (I am just throwing random ideas here)

Now about the 'illuminates' ability effect, IMO it's a separated topic and should probably use a different implementation than ToD terrain/areas because:
- the aura is moving with the unit (unless you want a hex-step moves, but that seems ugly). This is a problem for hex-based lighting: impossible for color-shifting, and not sure how moving ToD mask + possible transitions will work.
- I understand that it's related to ToD rules (and some UI elements show it), but visually it's really different. It's a point light instead of sun light. And if a special scenario uses a red sunlight and illuminates has its old white light, you will then have a new special case where combining different ToD lights is needed.
- any ability having an UI indication that it affects adjacent hexes will probably uses halo too. For example, its opposite, the 'darkens' ability, should not even be a light effect but a black smoke instead. So I see no real need to do something special for illuminates.
- using halo allow to easily animate it and add various other effects (move with the unit, react to fight or anything that animation/WML filter can detect, maybe even local ToD)
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Eleazar's Terrain Improvements

Post by Eleazar »

Alink wrote:
Eleazar wrote: For the kind of color-shifting that BfW does alpha is only slightly inferior, or maybe even different but equal.
Replacing globally the color shifting (adding RGB values to terrain images) by a ToD half-transparent mask has some big implications:
- This would indeed make possible to have light transitions, basically like fog do.
- I am no artist, but to cite Jetrell from your last posted thread: "colors are washed out". To take an extreme example, color shifting allow to simulate well a pure red sunlight, but alpha blending can't (it will look like a red fog).
After further testing, i have a pretty decent ToD system using masks instead of color shifting. I'm willing to bet most people wouldn't notice the difference.

The reference to "colors are washed out" is to the MoL's overlay. Overlays work more satisfactory for darkening than lightening. Any sort of lightening overlay will tend to wash things out, but that's the strength of this idea. We no longer would need to use overlays to simulate bright hexes, we'd just use them unmodified, (or very slightly modified) and use overlays to darken hexes darker than daylight.

Alink wrote:- Units will be ToD colored too (currently not), because they will be under the ToD mask (forced because of the terrain foreground stuff). This has implication for team-coloring differences and UI stuff.
That is a problem. The only significant one you've brought up. I played through Dwarven doors and plunging through darkness using overlays. Again, i don't think a lot of people would be able to pin down the change, but the characters loose some of their "pop." I don't know if that can be easily fixed by anything other than abandoning the idea of terrain overlapping characters."
Alink wrote:- All that alpha blending will be slightly slower to render than simply blit a cached color-shifted version. OtOH, we will gain some memory by avoiding this big cache.
There's a ton of alpha blending in the current terrain, and by the end of the summer i'll have put in a whole lot more. This will would probably have negligible impact on performance, especially when compared to something like animated water with 15 frames and transitions from every hex.

Alink wrote:Now, the problem with color shifting is that it can not use smooth edges. It's too slow to be done in real-time, so it's currently cached.
I'll happily take hard edges over nothing.
Alink wrote:On a more positive note and to get back on your cave problem, I realize now that it should be easy to disable the ToD color shifting in some ToD areas (the untouched images are already in memory). There is still the transition problem though, especially when it's night outside, because underground terrain would be more lighted.
Currently the underground tiles are naturally approximately as dark as exterior tiles with "night" color-shifting on them. They do look fine next to each other. This doesn't solve all the problems i've listed, but perhaps it is a good place to start.

It seems to me a natural progression to go from selectively disabling ToD color-shifting, to applying multiple ToD color-shifts to different areas of the map. ;)

Alink wrote:Now about the 'illuminates' ability effect, IMO it's a separated topic and should probably use a different implementation than ToD terrain/areas because:
- the aura is moving with the unit (unless you want a hex-step moves, but that seems ugly). This is a problem for hex-based lighting: impossible for color-shifting, and not sure how moving ToD mask + possible transitions will work.
Using hex-based coloring wouldn't totally replace the use of a halo for units like the MoL. The halo would simply not be responsible for doing as much (see previous linked example). There would still generally be a hot-spot in the middle and perhaps some beams going out, but it wouldn't cover the hex in so much white semi-opacity.

Moving units take certain liberties, they overlap all terrain for instance. It wouldn't be very noticeable if the the hex-based color shifting didn't follow the MoL as it moved, but only appeared at his final destination.

Alink wrote:- I understand that it's related to ToD rules (and some UI elements show it), but visually it's really different. It's a point light instead of sun light. And if a special scenario uses a red sunlight and illuminates has its old white light, you will then have a new special case where combining different ToD lights is needed.

Someone who wants to make red sunlight can worry about the MoL if and when that comes up.
Dusk and Dawn both are "neutral" amounts of light, but have different color mixes. We would need to make a few more illumination definitions, or overlays for light sources (lighthouses, campfires, etc) to use, but that's not a serious problem. 2 definitions for the levels of illumination that correspond to "dusk/dawn", and "day", should work fine for 99% of probable uses.
Alink wrote:- any ability having an UI indication that it affects adjacent hexes will probably uses halo too. For example, its opposite, the 'darkens' ability, should not even be a light effect but a black smoke instead. So I see no real need to do something special for illuminates.
- using halo allow to easily animate it and add various other effects (move with the unit, react to fight or anything that animation/WML filter can detect, maybe even local ToD)
These are kinda moot. I'm not suggesting getting rid of halo, especially when they are doing things that haloes are good at. I just want (among other things) an option to not rely on haloes for what they are lousy at-- brightening ToD darkened hexes.
Attachments
Cave, half effected by normal night, color-shifting, the other half left un-shifted.
Cave, half effected by normal night, color-shifting, the other half left un-shifted.
Cave, using ToD maks, in-game.
Cave, using ToD maks, in-game.
cave.jpg (127.23 KiB) Viewed 13174 times
Dusk, using ToD masks, ingame.
Dusk, using ToD masks, ingame.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Cave & Outdoors Harmonization and Illumination

Post by Eleazar »

After playing with it longer, i'm not as happy with the overlay method of ToD shifting as i was at first.

That leaves two basic method to achieve a map where different areas of a map have different ToD (or Aoi = amount of illumination) visible at the same time.


1) Make the color-shift engine more sophisticated, so it can do different parts of the map differently.
Pros: flexible, easy to define new ToDs
Cons: probably the difference between differently illuminated hexes would be hard-edged

2)Abandon the color-shift engine, and make ToD variants for all terrain images
Pros: more control over how a terrain looks in the dark
Cons: adds ~80MB of files, i have to do most of the work. ;)


However, whichever of these paths we take, or if nothing changes, i still think it is worth while to do what i describe in the first post. I'm going to start on that today.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Cave & Outdoors Harmonization and Illumination

Post by Eleazar »

And i did it. Though some terrains still need hand-tweaking.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Alink
Inactive Developer
Posts: 181
Joined: March 5th, 2007, 6:45 am
Location: Belgium

Re: Cave & Outdoors Harmonization and Illumination

Post by Alink »

Eleazar wrote: 1) Make the color-shift engine more sophisticated, so it can do different parts of the map differently.
Pros: flexible, easy to define new ToDs
Cons: probably the difference between differently illuminated hexes would be hard-edged
I really want to try color-shift and I think that any performance cost will be lower than ToD variants. Also, as I said before, I consider illumination not related to ToD areas for now. Many games have light engine dealing differently with static and dynamic lights, we could do the same. So, let's focus on the much more important issue of ToD terrains and after that recheck the rarely used illumination (both look and implementation).

Also, note that the c++ and WML code already consider illumination separated from ToD. It just gives a bonus to lawful units, which is also what ToD do, but that's the only link for now. So, now color info, or difference between similar times of day. That could be changed, but again we will see that later.
Eleazar wrote: 2)Abandon the color-shift engine, and make ToD variants for all terrain images
Pros: more control over how a terrain looks in the dark
Cons: adds ~80MB of files, i have to do most of the work. ;)
I know I suggested to check ToD variants, but I had only caves in mind. And seeing your commit, I realize now that I underestimated the number of cave images. Also, there is much more overhead than disk space: more I/O (which is slower than post-processing the same file), more memory used (we don't store png files, so 80MB is inaccurate), and more WML to manage/parse (all that must be wired in terrain WML and ToD variant are more complex). Since the last time, I also added a new probability feature in terrain variant, which is compatible with ToD variant, but will multiply even more the complexity.

So, for now I recommend assuming that we will use color-shift and not different variant images. The correct implementation will take time, but I will try to see if I can hack an experimental (and slow) feature, toggled off by default, to help you test how it will looks
Alink
Inactive Developer
Posts: 181
Joined: March 5th, 2007, 6:45 am
Location: Belgium

Re: Cave & Outdoors Harmonization and Illumination

Post by Alink »

And I did it. ;)
Trunk has now a prototype of local ToD with light transitions. This is dumb code completly ignoring the performance problem (even if it seems to run decently). So, it's disabled by default with the game_config key 'local_light'=no.
It works but I precise that there is a lot of work to make the code acceptable enough to be used. However I am more confident about it.

Here is how it looks with my quickly drawn light transitions (and I am just a coder randomly waving his mouse in Gimp):
Attachments
Final with light transitions
Final with light transitions
Old global ToD
Old global ToD
with per hex ToD light
with per hex ToD light
Post Reply