Board index FlightGear Development Scenery

Regional textures v0.1

Questions and discussion about enhancing and populating the FlightGear world.

Regional textures v0.1

Postby Thorsten » Fri May 13, 2011 8:51 am

What has bothered me for a long time is that many of our textures are valid for a particular geographical region and look decidedly odd when used elsewhere. For instance, the city textures with fairly regular street grid are how typical North American cities look like - European cities are convoluted, grown objects. Irrigated crops in Asia typically means rice terraces - a texture reflecting European crops doesn't work well. Thus, I thought it would be neat to use different textures dependent on where on the globe you are.

Likewise, at some point we had a collection of African savannah trees - and while northern boreal trees look strange in the savannah, the savannah trees don't work in Europe.

Previously I assumed that this needs modifications to the core, or to the landclass definitions. But it turns out that there is a partial solution to the problem, i.e. textures, trees and random objects can be determined by the startup location, though not currently at runtime. So the solution does not work for transcontinental flights. It also doesn't change textures when you use the menu to set a different location (it seems, materials.xml is parsed only at startup, although there may be a command to force it to parse again?).

It works by adding conditionals on position/latitude-deg and position/longitude-deg into materials.xml and define a separate entry for every region you want to model. Here's a demo which uses normal irrigated crop texture for longitudes below 60 deg, but switches to a rice terrace texture when above 60 deg, i.e. in Asia.

Code: Select all
<material>
  <condition>
   <and>
   <equals>
    <property>sim/startup/season</property>
    <value>summer</value>
   </equals>
   <less-than>      
    <property>position/longitude-deg</property>
    <value>60.0</value>
   </less-than>
   </and>
  </condition>
  <effect>Effects/crop</effect>
  <name>IrrCropPastureCover</name>
  <name>IrrCrop</name>
  <name>Orchard</name>
  <name>Olives</name>
  <name>Vineyard</name>
  <name>Rice</name>
  <texture>Terrain/irrcrop1.png</texture>
  <texture>Terrain/irrcrop2.png</texture>
  <texture>Terrain/irrcrop3.png</texture>
  <xsize>2000</xsize>
  <ysize>2000</ysize>
  <!--<texture>Terrain/rice1.png</texture>
  <xsize>2000</xsize>
  <ysize>2000</ysize>-->
  <light-coverage>2000000.0</light-coverage>
  <solid>1</solid>
  <friction-factor>0.9</friction-factor>
  <rolling-friction>0.3</rolling-friction>
  <bumpiness>0.6</bumpiness>
  <load-resistance>1e30</load-resistance>
  <object-group>
   <range-m>5000</range-m>
   <object>
    <path>Models/Buildings/silo.ac</path>
    <coverage-m2>5000000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
   <object>
    <path>Models/Buildings/red-barn.ac</path>
    <path>Models/Buildings/horse-stable.ac</path>
    <path>Models/Buildings/cow-stable.ac</path>
    <path>Models/Agriculture/farmhouse1.ac</path>
    <path>Models/Agriculture/farmhouse2.ac</path>
    <path>Models/Agriculture/farmhouse3.ac</path>
    <coverage-m2>750000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
  </object-group>
  <!-- Disabled to avoid a tremendous osg performance penalty when
       deleting scenery tiles, caused by tens of thousands of shared
       horse/cow objects. Need a better implementation!
  <object-group>
   <range-m>1000</range-m>
   <object>
    <path>Models/Fauna/cow.ac</path>
    <coverage-m2>100000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
   <object>
    <path>Models/Fauna/horse.ac</path>
    <coverage-m2>300000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
  </object-group> -->
  <wood-coverage>500000.0</wood-coverage>
  <tree-texture>Textures/Trees/mixed-summer.png</tree-texture>
  <tree-varieties>8</tree-varieties>
  <tree-range-m alias="/params/forest/tree-range-m"/>
  <tree-height-m>20.0</tree-height-m>
  <tree-width-m>12.0</tree-width-m>
 </material>


<material>
  <condition>
  <and>
   <equals>
    <property>sim/startup/season</property>
    <value>summer</value>
   </equals>
   <greater-than>      
    <property>position/longitude-deg</property>
    <value>60.0</value>
   </greater-than>
  </and>
  </condition>
  <effect>Effects/crop</effect>
  <name>IrrCropPastureCover</name>
  <name>IrrCrop</name>
  <name>Orchard</name>
  <name>Olives</name>
  <name>Vineyard</name>
  <name>Rice</name>
 <texture>Terrain/rice1.png</texture>
  <xsize>2000</xsize>
  <ysize>2000</ysize>
  <light-coverage>2000000.0</light-coverage>
  <solid>1</solid>
  <friction-factor>0.9</friction-factor>
  <rolling-friction>0.3</rolling-friction>
  <bumpiness>0.6</bumpiness>
  <load-resistance>1e30</load-resistance>
  <object-group>
   <range-m>5000</range-m>
   <object>
    <path>Models/Buildings/silo.ac</path>
    <coverage-m2>5000000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
   <object>
    <path>Models/Buildings/red-barn.ac</path>
    <path>Models/Buildings/horse-stable.ac</path>
    <path>Models/Buildings/cow-stable.ac</path>
    <path>Models/Agriculture/farmhouse1.ac</path>
    <path>Models/Agriculture/farmhouse2.ac</path>
    <path>Models/Agriculture/farmhouse3.ac</path>
    <coverage-m2>750000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
  </object-group>
  <!-- Disabled to avoid a tremendous osg performance penalty when
       deleting scenery tiles, caused by tens of thousands of shared
       horse/cow objects. Need a better implementation!
  <object-group>
   <range-m>1000</range-m>
   <object>
    <path>Models/Fauna/cow.ac</path>
    <coverage-m2>100000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
   <object>
    <path>Models/Fauna/horse.ac</path>
    <coverage-m2>300000</coverage-m2>
    <heading-type>random</heading-type>
   </object>
  </object-group> -->
  <wood-coverage>500000.0</wood-coverage>
  <tree-texture>Textures/Trees/mixed-summer.png</tree-texture>
  <tree-varieties>8</tree-varieties>
  <tree-range-m alias="/params/forest/tree-range-m"/>
  <tree-height-m>20.0</tree-height-m>
  <tree-width-m>12.0</tree-width-m>
 </material>


Since there is always the condition on summer or winter texture, any additional customization has to be wedged in with an <and> tag, so the basic structure without all the rest is

Code: Select all
<condition>
   <and>
   <equals>
    <property>sim/startup/season</property>
    <value>summer</value>
   </equals>
   <less-than>      
    <property>position/longitude-deg</property>
    <value>60.0</value>
   </less-than>
   </and>
  </condition>


which you can make as interesting as you like by adding more conditions on latitude and longitude. Of course, the sum of all regions should cover the whole globe, and regions shouldn't overlap, so some care is needed. But since you declare a separate material for every region, you can alter anything you like - textures, random objects, tree textures, tree density, ... you name it.

Since regionalizing Earth in this way is rather cumbersome, at the moment I'd use it to avoid the worst clashes, i.e. human-made structures, but if someone is in the mood to work out the conditionals for the different continents / temperature zones, why not...


Edit:

I've made a package of my current setup available as regional textures v0.1. The file writes into /materials.xml /Textures/Terrain/ and /Textures.high/Terrain - save your originals before installing the package.

Currently I'm using regional textures for city and suburb/town as well as for irrigated crops - see some examples:

City, town and fields in Europe - Innsbruck

Image

City and fields in USA - California

Image

City and rice fields in Asia - Kathmandu

Image

Some scenery in other parts of the world:

Coastline near Seattle - Pacific Northwest custom scenery

Image

Columbia river gorge - Pacific Northwest custom scenery

Image

Annecy and Annecy-les-vieux - France custom scenery

Image

Rural terrain near Geneva - France custom scenery

Image

Honolulu - Hawaii terrasync scenery

Image

Haleakala crater - Hawaii terrasync scenery

Image

Important: The textures are from a variety of sources, some of them not GPL-compatible. The pack is intended as an experiment for myself to see what can be done with some effort. I've used

* default Flightgear textures
* old/so far unused Flightgear textures
* textures posted by Statto on the devel list
* Alternative summer textures 2.0.0 by Reptile
* Photo texture pack by Horacio
* textures from public texture servers
* and finally textures extracted from aerial photographs where I have permission of the photographer to redistribute under GPL
* ... probably something I forgot

Almost all textures are altered by myself to avoid hard contrasts - usually some hue rotation and desaturation is done.

If anyone wants to have a go, enjoy!
Last edited by Thorsten on Wed Jun 01, 2011 10:34 am, edited 1 time in total.
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Howto make textures (random objects, trees) regional

Postby ot-666 » Sat May 14, 2011 2:56 pm

Nice idea and indeed a long missed feature… Tropical islands look way better with palm trees. Would be nice, if this feature really could change scenery on long distance flights according to the position of the aircraft.
Callsign: ot-666
Working on LOWI and other stuff - Custom Scenery Overlay Repo: http://gitorious.org/fgfs-custom-scenery/custom-scenery-overlay/
VMX22 - Osprey... sometimes in 2014
ot-666
 
Posts: 746
Joined: Sun Nov 08, 2009 5:14 pm
Location: Germany, Konstanz
Callsign: ot-666
IRC name: ot666
Version: GIT
OS: win7 64bit

Re: Howto make textures (random objects, trees) regional

Postby statto » Sat May 14, 2011 10:55 pm

Silly question, but can xml files have "include"s?
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2088
Joined: Fri Jan 25, 2008 9:57 pm

Re: Howto make textures (random objects, trees) regional

Postby xiii » Sat May 14, 2011 11:11 pm

Hi Statto,

Sure,

Code: Select all
<PropertyList include="path to your xml">


Alexis
If the engines are Pratt and Whitney, the seats best be Martin Baker
xiii
 
Posts: 472
Joined: Tue Jan 08, 2008 10:04 pm

Re: Howto make textures (random objects, trees) regional

Postby Thorsten » Sun May 15, 2011 10:32 am

Would be nice, if this feature really could change scenery on long distance flights according to the position of the aircraft.


Maybe there's a command to reparse materials.xml runtime which one could call every 10 minutes from a Nasal loop. Or a periodical reparse can be added to the core - it doesn't seem excessively complicated to get this kind of behaviour.
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Howto make textures (random objects, trees) regional

Postby statto » Sun May 15, 2011 9:06 pm

That affects tile loading, though, which is a problem with optimization. If you have a lot of tiles loaded when the script runs, you will have to fly for awhile to see the difference. An on_tile_load script would be better, but not necessarily optimal.

Also a question of mine is a conflict. If we could have a "base" materials.xml and then include other files in the materials.xml, for instance materialsw130n40.xml, and they both define DryCrop, which DryCrop texture gets pulled?
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2088
Joined: Fri Jan 25, 2008 9:57 pm

Re: Howto make textures (random objects, trees) regional

Postby Thorsten » Tue May 17, 2011 6:26 am

That affects tile loading, though, which is a problem with optimization. If you have a lot of tiles loaded when the script runs, you will have to fly for awhile to see the difference. An on_tile_load script would be better, but not necessarily optimal.


Doesn't really matter - you wouldn't want to switch at a precise line anyway, since in reality there is not suddenly rice everywhere once you cross a longitude where before fields were found.

Conditionals in materials.xml are a rough first-level measure to mitigate the worst clashes. If you want things like a particular type of rock being shown in a particular region as in a custom scenery, then this has to go into landclass.

I imaging one could do quite a lot of interesting things at terragear level, because you have the elevation data as well. So there could be, say, different landclasses forest-flat and forest-gradient dependent on terrain slope, with different textures.

Also a question of mine is a conflict. If we could have a "base" materials.xml and then include other files in the materials.xml, for instance materialsw130n40.xml, and they both define DryCrop, which DryCrop texture gets pulled?


I have tried conflict by mistake, I just don't remember if the early definition overwrites the late one or vice versa - so in principle this works. I just feel a bit uneasy to rely on such an intentional conflict. Although it would make customization much easier and keep materials.xml cleaner.
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Howto make textures (random objects, trees) regional

Postby Thorsten » Tue May 31, 2011 9:04 am

Okay, I tested it systematically - later definitions overwrite earlier ones, so one can make life easier by first specifying defaults, then the regional definitions for continents, followed by local definitions.

The biggest stumbling block is that currently it's startup only.

I guess I'll make my materials and textures available soonish for experiments, and ask on the devel list if it's possible to create a command to reparse textures runtime.
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Howto make textures (random objects, trees) regional

Postby Gijs » Tue May 31, 2011 11:44 am

By editing the "tree" shader, I was able to change tree textures on run-time, based on a property value (that could be position/latitude-deg). But, the big problem here is that I see no way to deal with various terrain-classes. And we don't want all terrain-types to have the same trees, do we?
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9295
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Howto make textures (random objects, trees) regional

Postby Thorsten » Tue May 31, 2011 12:13 pm

Stuart told me that the odd tree behaviour is a bug and will be fixed - in principle, they should then also be regionally available with the same technique.
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Regional textures v0.1

Postby Thorsten » Wed Jun 01, 2011 10:34 am

If anyone wants to give it a try, see first post.
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Regional textures v0.1

Postby statto » Wed Jun 01, 2011 6:00 pm

Very, very nice. Thank you for your work on this.

Also, I'm going to be that guy and ask a follow-up question - I haven't searched the files, is there a way to figure out which textures are not GPL?
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2088
Joined: Fri Jan 25, 2008 9:57 pm

Re: Regional textures v0.1

Postby Thorsten » Thu Jun 02, 2011 9:39 am

I don't know myself on a per texture basis e.g. for the two packages I used - you'd have to contact the authors. I remember some discussion about the alternative summer textures 2.0 which led to the conclusion that the whole package is not GPL - but some textures are clearly derived from Flightgear textures, and the author had the intention at some point to release under GPL, so in all likelihood a subset of textures can be released as GPL.

In any case, the point of the exercise was not to create something that can be released, but rather to illustrate what is possible if one starts on it seriously. I lack the raw material for texturing - I have no access to GPL-compatible or own aerial imagery. But some Flightgear people do fly regularly for real and should be able to contribute that,
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Regional textures v0.1

Postby Thorsten » Fri Jun 03, 2011 7:03 am

*shrugs*

Seriously - how many of you fly transatlantic or really long range on a regular basis? Most planes in the repository simply don't even have the range to run into the 'stumbling block'...

And in the default scheme, texture setup is startup only as well - but you're stuck with the same set of textures everywhere - so it's not like the regional texturing scheme as it stands takes something away from you - it just doesn't give you all you theoretically could have.
Thorsten
 
Posts: 9758
Joined: Mon Nov 02, 2009 8:33 am

Re: Regional textures v0.1

Postby statto » Sun Jun 05, 2011 8:06 pm

Perhaps the autogen switching over is more important than the textures changing. You are right to say textures won't change very often - they should change very gradually if at all. Plus differences in land cover should be more important in a forest->desert transition than changing textures.

However two problems arise.

The first is if we continue to push the envelope for creating textures. You could have incredibly localized textures if you want to now. I doubt this will happen anytime soon, but it is now possible.

The second is with autogen. You could have incredibly sophisticated autogen now and this could change even from island to island in Hawai'i, where the textures would not change.
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2088
Joined: Fri Jan 25, 2008 9:57 pm

Next

Return to Scenery

Who is online

Users browsing this forum: No registered users and 2 guests