Water should be dithered as land terrain

Bug #1408707 reported by kaputtnik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Low
Unassigned

Bug Description

Placing different watertypes of the four landtypes (desert, green, wasteland and winter) beneath each other will result in hard edges between them. Look https://wl.widelands.org/forum/topic/1624/ for a picture about that.

Maybe the watertypes do not dither?

Tags: editor

Related branches

kaputtnik (franku)
tags: added: editor
Revision history for this message
SirVer (sirver) wrote :

This is a configuration change only. world/terrains/init.lua contains a dither_layer for each terrain. This value is compared when two terrains are adjacent and decides which one will be dithered over which other [1]. If both values are equal, no dithering is done. Making sure that not two values are equal in this file make sure that everything is dithered.

[1] http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/graphic/gl/dither_program.cc#L135

Changed in widelands:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
kaputtnik (franku) wrote :

Thanks :-) editing of world/terrains/init.lua works fine. But i didn't get a clue of what sense the dither_layer make. Of course the dither behavior is different depending on the layer value between two terrains (see attached picture), but i am not sure, which values do make sense. Sometimes it could make sense to "overlap" water over beach, sometimes not.

I thought about some kind of ruleset for the dither_layer: The terrain which covers other terrains should get a higher value. In this scenario Snow covers all other terrains, so it should get the highest value, while beach could be covered by most other terrains, so it should get the lowest value. As you might have guess, such a rule makes no sense at all.

In the end i think, the values for dither_layer couldn't get a ruleset, or couldn't be sorted/adjusted, to fit all the mapcreators needs. Somtimes he needs mountain covering beach, somtimes the other way round, depending on the look and feel in the map.

Am i right, that the only reason for dither_layer is: Give the dither-algorithm a rule, which terrain covers the other.
Or overlooked i some other aspects?

Revision history for this message
SirVer (sirver) wrote :

> Am i right, that the only reason for dither_layer is: Give the dither-algorithm a rule, which terrain covers the other.

You are right.

Another solution could be to save the "z-layer" of a triangle into the map - the editor could always set the triangle to being "on-top" of the one around it when it is changed. Then every dithering should be representable through the order at which the triangles are set in the editor.

This would be a rather esoteric feature and only experienced map makers would fully understand it I think. And it is quite some work to implement.

Revision history for this message
kaputtnik (franku) wrote :

The dither_layer isn't saved in the map, isn't it? Vice versa: Are in the saved map only the graphical results of the dithering saved?

If this is true, i thought about allways dither the choosen terrain over the terrain in the map. Saying if the terrain in the map is Beach and the user choose water to place on the map, water should be dithered over beach. Afterwards he decides that there there is too much water (or wrong placed water) he choose beach and then beach should dither over water.

Such a bahavior would bring all dithering possibilitys to the mapcreator by using one terrain after a another. If it doesn't look good, he could try it vice versa.

But such behavior should be tested before implementing.

Until we found a solution, the values for dither_layer in world/terrains/init.lua could be set from 0 to 60 with steps from 1. This could be made automatically i think.

Revision history for this message
SirVer (sirver) wrote :

> The dither_layer isn't saved in the map, isn't it?

No, they are a property of the terrain and therefore saved in the world.

> Vice versa: Are in the saved map only the graphical results of the dithering saved?

Not getting the question... the map only contains the terrain name for each triangle.

> If this is true, i thought about allways dither the choosen terrain over the terrain in the map. Saying if the terrain in the map is Beach and the user choose water to place on the map, water should be dithered over beach. Afterwards he decides that there there is too much water (or wrong placed water) he choose beach and then beach should dither over water.

That is what I was suggesting in #3 - you worded it much better than I did. Issues are: this needs implementing and is not fully trivial (but certainly doable). And it is an esoteric, non intuitive feature that map makers would need to learn.

 > Until we found a solution, the values for dither_layer in world/terrains/init.lua could be set from 0 to 60 with steps from 1. This could be made automatically i think.

Automatically is not good. The current dither values are chosen for a reason because for some terrains it make sense to dither always in one way (for example snow). But the current values should be changed so that there are no draws between terrains where it looks jarring, i.e. the examples you posted.

For some terrains that are quite similar (meadows), not dithering actually looks better IMHO.

Revision history for this message
kaputtnik (franku) wrote :

Ok, i understand.

I edited the init.lua and justified all values for dither_layer. To do so i've made me a spreadsheet and categorized the terrains in another way as "world" or "properties (the value for 'is')":

1. Lavalike
2. Mountainlike
3. Mountainmeadowlike
4. Beachlike
5. Water
6. Icelike
7. Snowlike

Lavalike terrains are coverd by all the following ones. Mountainlike terrains are covered by Moutainmeadowlike terrains and so on. Snowlike terrains are never covered by one of the others. Assigning the individual terrains to one of the above categories are did by looking at the maincolor of terrain and, in my mind main usage while creating a map.

Then i looked closer to the terrains in the categories. Those which are colored the same way, i gave the same value for dither_layer. If they are different (so that adjacent ones will look bad) i gave the next higher value.

In the end it result in values for dither_layer ranging from 0 (Lava; green) to 310 (snow; green) with steps of 10.

This init.lua is attached.

Revision history for this message
SirVer (sirver) wrote :

That sounds like a solid approach. I looked over your init.lua and it also contained some changes to temperature - I reverted them and then submitted the new file in r7352.

Changed in widelands:
status: Triaged → Fix Committed
milestone: none → build19-rc1
Revision history for this message
kaputtnik (franku) wrote :

> I looked over your init.lua and it also contained some changes to temperature

Uuuups .. sorry for that *ashamed*

GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.