From 32ff0056ef063480e880e37907b41705323e41ac Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Fri, 9 Jun 2017 12:07:51 +0300 Subject: [PATCH] Daily variation of road traffic with commuter rush hours based on actual traffic studies for ALS road shader --- Effects/road.eff | 9 +++ Environment/local-weather-rules.xml | 101 ++++++++++++++++++++++++++++ Shaders/road-ALS-ultra.frag | 3 +- 3 files changed, 112 insertions(+), 1 deletion(-) diff --git a/Effects/road.eff b/Effects/road.eff index 1ddf88dff..be53d4f11 100644 --- a/Effects/road.eff +++ b/Effects/road.eff @@ -23,6 +23,7 @@ /sim/rendering/osm/road-traffic-enabled /sim/rendering/osm/road-traffic-density /sim/rendering/osm/road-traffic-direction + /sim/rendering/osm/road-traffic-daily-variation /environment/lightmap-factor @@ -488,6 +489,14 @@ + + road_traffic_variation + float + + road-traffic-variation + + + road_traffic_direction int diff --git a/Environment/local-weather-rules.xml b/Environment/local-weather-rules.xml index 4313bb746..1206cbca6 100644 --- a/Environment/local-weather-rules.xml +++ b/Environment/local-weather-rules.xml @@ -839,7 +839,108 @@ /environment/lightmap-factor + + + + EnvironmentInterpolator:OSM:LocalTime + + + + /sim/time/utc/day-seconds + /sim/time/local-offset + + + + /sim/time/local-day-seconds + gain + 1.0 + + + + EnvironmentInterpolator:OSM:LocalTimeOverrun + + + + /sim/time/local-day-seconds + 86400.0 + + + + + + + /sim/time/local-day-seconds + 86400 + + + + /sim/time/local-day-seconds + gain + 1.0 + + + + EnvironmentInterpolator:OSM:LocalTimeUnderrun + + + + /sim/time/local-day-seconds + 0.0 + + + + + + + /sim/time/local-day-seconds + 86400 + + + + /sim/time/local-day-seconds + gain + 1.0 + + + + EnvironmentInterpolator:OSM:TrafficDensity + gain + + + + /sim/time/local-day-seconds + 0.00.32 + 3600.00.21 + 7200.00.18 + 10800.00.16 + 14400.00.19 + 18000.00.21 + 21600.00.45 + 25200.00.77 + 28800.01.30 + 32400.01.44 + 36000.01.04 + 39600.00.95 + 43200.01.03 + 46800.01.04 + 50400.01.10 + 54000.01.30 + 57600.01.50 + 61200.01.26 + 64800.00.92 + 68400.00.72 + 72000.00.56 + 75600.00.52 + 79200.00.45 + 82800.00.36 +
+
+ + /sim/rendering/osm/road-traffic-daily-variation +
+ + EnvironmentInterpolator:Precipitation:Illumination diff --git a/Shaders/road-ALS-ultra.frag b/Shaders/road-ALS-ultra.frag index ab06a9fc6..02e82da5c 100644 --- a/Shaders/road-ALS-ultra.frag +++ b/Shaders/road-ALS-ultra.frag @@ -57,6 +57,7 @@ uniform float grain_magnification; uniform float wetness; uniform float rain_norm; uniform float road_traffic_density; +uniform float road_traffic_variation; uniform float streetlight_factor; uniform float avisibility; @@ -353,7 +354,7 @@ void main (void) cSign *= road_traffic_direction; - float total_traffic_density = road_traffic_density * rtype_traffic_density; + float total_traffic_density = road_traffic_density * rtype_traffic_density * road_traffic_variation; float cCoord = roadCoords.t + cOffset; cCoord += 0.3 * osg_SimulationTime * cSign * rtype_traffic_speed * (1.0 - (0.9 * smoothstep(1.0, 2.5, total_traffic_density)));