WS30: Better edge-hardness implementation
This commit is contained in:
parent
1d76ced7c7
commit
49b1b83be2
3 changed files with 37 additions and 40 deletions
|
@ -185,7 +185,7 @@
|
|||
<parameters>
|
||||
<rotation_flag>0</rotation_flag>
|
||||
<rotation_scale>8000.0</rotation_scale>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.5</edge-hardness>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
|
@ -252,7 +252,7 @@
|
|||
<tree-height-m>15.0</tree-height-m>
|
||||
<tree-width-m>10.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -275,7 +275,7 @@
|
|||
<urban_blend>1</urban_blend>
|
||||
<blend_bias>0.2</blend_bias>
|
||||
<hires_overlay_bias>-1.0</hires_overlay_bias>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
<xsize>1024</xsize>
|
||||
<ysize>1024</ysize>
|
||||
|
@ -337,7 +337,7 @@
|
|||
<tree-height-m>15.0</tree-height-m>
|
||||
<tree-width-m>10.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.9</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -417,7 +417,7 @@
|
|||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.1</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -446,7 +446,7 @@
|
|||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.1</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -530,7 +530,7 @@
|
|||
<overlay_autumn_flag>1</overlay_autumn_flag>
|
||||
<overlay_brightness_top>1.4</overlay_brightness_top>
|
||||
<overlay_brightness_bottom>0.6</overlay_brightness_bottom>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
|
@ -565,7 +565,7 @@
|
|||
<overlay_autumn_flag>1</overlay_autumn_flag>
|
||||
<overlay_brightness_top>1.4</overlay_brightness_top>
|
||||
<overlay_brightness_bottom>0.6</overlay_brightness_bottom>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
<xsize>2000</xsize>
|
||||
<ysize>2000</ysize>
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>1</bumpiness>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -119,7 +119,7 @@
|
|||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>0.85</bumpiness>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -140,7 +140,7 @@
|
|||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>0.95</bumpiness>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -162,7 +162,7 @@
|
|||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>1</bumpiness>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.9</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -182,7 +182,7 @@
|
|||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>1</bumpiness>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.9</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -201,7 +201,7 @@
|
|||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>1</bumpiness>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -310,7 +310,7 @@
|
|||
<tree-height-m>25.0</tree-height-m>
|
||||
<tree-width-m>15.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -334,7 +334,7 @@
|
|||
</emissive>
|
||||
<object-group include="Materials/base/industrial-buildings.xml"/>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -364,7 +364,7 @@
|
|||
</emissive>
|
||||
<object-group include="Materials/base/industrial-buildings.xml"/>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.9</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -398,7 +398,7 @@
|
|||
<tree-height-m>12.0</tree-height-m>
|
||||
<tree-width-m>7.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.7</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -420,7 +420,7 @@
|
|||
<effect>Effects/water</effect>
|
||||
<texture>Terrain/water.png</texture>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -454,7 +454,7 @@
|
|||
<rolling-friction>1.5</rolling-friction>
|
||||
<bumpiness>0.6</bumpiness>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -473,7 +473,7 @@
|
|||
</texture-set>
|
||||
<parameters>
|
||||
<ice_cover><use>/environment/surface/ice-cover</use></ice_cover>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
<xsize>400</xsize>
|
||||
<ysize>400</ysize>
|
||||
|
@ -714,7 +714,7 @@
|
|||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.7</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -748,7 +748,7 @@
|
|||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -780,7 +780,7 @@
|
|||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -907,7 +907,7 @@
|
|||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.7</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
@ -932,7 +932,7 @@
|
|||
<tree-height-m>20.0</tree-height-m>
|
||||
<tree-width-m>12.0</tree-width-m>
|
||||
<parameters>
|
||||
<edge-hardness>1.0</edge-hardness>
|
||||
<edge-hardness>0.8</edge-hardness>
|
||||
</parameters>
|
||||
</material>
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
// Note: transitions occur on both sides of the landclass borders.
|
||||
// The width of the transition is equal to 2x this value.
|
||||
// Default: 100m
|
||||
const float transition_search_distance_in_m = 130.0;
|
||||
const float transition_search_distance_in_m = 25.0;
|
||||
|
||||
// Number of points to search in any direction, in addition to this fragment
|
||||
// Default:4 points. Fewer points results in a less smooth transition (more banding)
|
||||
|
@ -162,7 +162,7 @@
|
|||
|
||||
// Use the edge-hardness parameter from materials.xml to determine
|
||||
// weighting of the landclass in transitions
|
||||
const int use_edge_hardness_with_large_scale_transition = 0;
|
||||
const int use_edge_hardness_with_large_scale_transition = 1;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
@ -915,6 +915,11 @@ void get_landclass_id(in vec2 tile_coord, in vec4 dFdx_and_dFdy,
|
|||
|
||||
int lc = lookup_landclass_id(tile_coord, dxdy, lc_n_tx, num_n_tx, lc_n_w);
|
||||
|
||||
float edge_hardness = 0.0;
|
||||
if (use_edge_hardness_with_large_scale_transition == 1) {
|
||||
edge_hardness = fg_dimensionsArray[lc].a;
|
||||
}
|
||||
|
||||
// Neighbor landclass ids
|
||||
ivec4 lc_n = ivec4(lc);
|
||||
|
||||
|
@ -948,13 +953,14 @@ if ( (enable_large_scale_transition_search == 1) &&
|
|||
|
||||
|
||||
// Transition search
|
||||
|
||||
const int n = num_search_points_in_a_direction;
|
||||
|
||||
const float search_dist = transition_search_distance_in_m;
|
||||
vec2 step_size_m = vec2(search_dist/float(n));
|
||||
// step size in tile coords
|
||||
vec2 steps = step_size_m.st / tile_size.st;
|
||||
// step size in tile coords. Modulated by the edge hardness which makes
|
||||
// the step size smaller and hence the range of adjacent landclasses
|
||||
// smaller.
|
||||
vec2 steps = step_size_m.st / tile_size.st * (1.0 - edge_hardness);
|
||||
|
||||
vec2 c0 = tile_coord;
|
||||
|
||||
|
@ -1157,15 +1163,6 @@ if (grow_landclass_borders_with_large_scale_transition == 1)
|
|||
//lc = int(t);
|
||||
//mfact[2] = t;
|
||||
|
||||
if (use_edge_hardness_with_large_scale_transition == 1)
|
||||
{
|
||||
// the edge-hardness material parameter has range 0.0 (soft) to 1.0 (hard)
|
||||
// We use this to force the mix factor to 0 or 1
|
||||
if ((num_n > 0) && fg_dimensionsArray[lc].w > 0.5) {
|
||||
mfact[0] = step(0.5, mfact[0]);
|
||||
}
|
||||
}
|
||||
|
||||
landclass_id = lc;
|
||||
neighbor_landclass_ids=lc_n;
|
||||
num_unique_neighbors = num_n;
|
||||
|
|
Loading…
Reference in a new issue