Traffic Shader: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 6: Line 6:
{{OSM Navigation}}
{{OSM Navigation}}


feeding external traffic into FG would not necessarily be very difficult - but it would almost certainly never match "roads" shown in FlightGear, and even if elevations would be patched up, there would remain quite a bit of work to be done.<ref>{{cite web
a wish for a shader you suggested a while ago: red and white dots moving in opposite directions<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=212169#p212169
  |title  =  <nowiki> Re: osm2city.py development </nowiki>
  |author =  <nowiki> radi </nowiki>
  |date  =  Jun 9th, 2014
  |added  =  Jun 9th, 2014
  |script_version = 0.40
  }}</ref>
 
 
feeding external ground traffic ("moving cars") into FG would not necessarily be very difficult - but it would almost certainly never match "roads" shown in FlightGear, and even if elevations would be patched up, there would remain quite a bit of work to be done.<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=235994#p235994  
   |url    =  https://forum.flightgear.org/viewtopic.php?p=235994#p235994  
   |title  =  <nowiki> Re: AI  </nowiki>  
   |title  =  <nowiki> Re: AI  </nowiki>  
Line 14: Line 24:
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>
The hard-coded AI traffic system isn't yet sufficiently flexible for this kind of ground traffic - also, the underlying vector data for road networks must be available, too.<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=224434#p224434
  |title  =  <nowiki> Re: How to creat moving traffic </nowiki>
  |author =  <nowiki> Hooray </nowiki>
  |date  =  Nov 15th, 2014
  |added  =  Nov 15th, 2014
  |script_version = 0.40
  }}</ref>
A more promising/better-performing approach would involve using shaders, as per a number of "traffic shader" discussions we've had (especially  affected by OSM2City)<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=224434#p224434
  |title  =  <nowiki> Re: How to creat moving traffic </nowiki>
  |author =  <nowiki> Hooray </nowiki>
  |date  =  Nov 15th, 2014
  |added  =  Nov 15th, 2014
  |script_version = 0.40
  }}</ref>
If we have linear features like roads mapped in the proper direction and classified into left and right lanes, we could add overlay textures and normalmaps with the shader (think urban effect) and translate them with time, creating the semblance of traffic (like the urban effect, this would break at low altitude, but from reasonably high up might look credible)<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=180587#p180587
  |title  =  <nowiki> What effects are we missing? </nowiki>
  |author =  <nowiki> Thorsten </nowiki>
  |date  =  Apr 1st, 2013
  |added  =  Apr 1st, 2013
  |script_version = 0.40
  }}</ref>
Note that there are two road effects, and fgdata/Effects/road*eff is Emilian's traffic shader. Though the correct way of using it would be to set TRAFFIC_SHADER_ENABLE = True and then run roads.py<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=221316#p221316
  |title  =  <nowiki> Re: osm2city.py development </nowiki>
  |author =  <nowiki> radi </nowiki>
  |date  =  Oct 20th, 2014
  |added  =  Oct 20th, 2014
  |script_version = 0.40
  }}</ref>


you'd need vector data for the corresponding road networks - next, you'd use those  to come up with heuristics for creating and controlling "traffic". Usually (at high altitudes), those will just be colored spots moving along your roads - at lower altitudes (take/approach), you'd want to use some kind of LOD mechanism to use animated AI traffic nodes, at least within the visible FOV.
you'd need vector data for the corresponding road networks - next, you'd use those  to come up with heuristics for creating and controlling "traffic". Usually (at high altitudes), those will just be colored spots moving along your roads - at lower altitudes (take/approach), you'd want to use some kind of LOD mechanism to use animated AI traffic nodes, at least within the visible FOV.

Navigation menu