Page 2 of 3

PostPosted: Fri Dec 08, 2006 5:11 am
by Aaron
Hi Forboding,

Yeah, I think some form of automatic feature placement for Spring based on the attributes map is very doable. I'll pop this on the to-do list (via a plugin.)

Cheers,
Aaron.

PostPosted: Mon Jan 11, 2010 2:51 pm
by David Walters
I realise this is an old topic, but I'm just posting to add my voice to the request for some kind of vegetation distrubtion map.

For me I'd really only need a formal image map "VEG" that held an attribute describing the type of flora that could be found in that square. High resolution support would be useful here to make the seams nicer - but I'd expect to have to jitter positions myself when rendering the grass meshes.

That would sort out grass and scrub. For tree placement, perhaps a second layer on which a sort of 'game of life' algorithm is run to ensure the density is more organic. Alternatively, leave it up to the user application to place the trees within the tree regions.

Looking forward to grassy valleys!

PostPosted: Mon Feb 22, 2010 1:18 am
by demi
Sorry to necro this but what is the status? I need something similar for MV but will code it in script if I can get a pointing direction and some expert advice. :)

Possible to use zeoscript to build a database of plant life?

PostPosted: Tue Feb 23, 2010 11:19 am
by Aaron
Hi Demi,

It may be possible to implement vegetation mapping in scripts, but I can't guarantee that all necessary functions have been implemented without having a closer look at the problem. Certainly, there are only the most basic user interface functions, so if your database requires a UI, you're out of luck with ZeoScript.

A plugin is probably a better bet, as you can make whatever UI you like. I have started work on a vegetation manager plugin, but at the moment my work has been limited to back-end stuff like data structure design, as well as some preliminary tests of vegetation rendering in Sapphire. I've not done anything particularly fancy with generating vegetation maps, other than the old trick of using the attributes map to generate simple vegetation masks. If that's all you need, I can bash something for this together in the near-ish future.

I must beg your pardon, but I am a tad busy with another problem at this moment. I'll try to get back to this thread later in the week.

Regards,
Aaron.

PostPosted: Wed Feb 24, 2010 12:28 am
by demi
No problem, Finish the other tasks first just when you have time. No rush as we are not ready for this just yet anyway.

First off, I am trying to use the computer instead of hand editing a 3000 square mile terrain.I want to Make computers work as they are good at repetitive tasks. However I am unsure how to program the algorithm. You being an expert, well, can maybe guide me a bit. ;)

It is hard to explain but I will give it a go and I don't know if a script will work. I don't even know where to begin on this until I know what language to program it in. Python, C++ and use my own program or use L3DT zeoscript or C++ and use a plugin.

I want to be able to lay grass and tree regions out by using the alphas and heightmap and water table. I though maybe reading the heightmap, water tables and then all the alpha layers I could determine what could grow at that pixel.(I Don't know if script can read pixel data). Suppose a rock was in this place instead of ground then there be nothing there so skip this until I find a point of a planttype. I then can do a scan in the x and y direction to find a difference point. Suppose there was a steep slope then nothing could grow there but some vine maybe. This point is an end point for the boundary. Scan in the other direction until I find another boundary. Could just be a triangle.

I can then reference height/slope and water table and make an sort of guess as to the type of the plant. Based on the area of this region and the water table I can set density of the PlantType Instances.

At this point I could then have a triangular region which I could label Boundary "plant_type" based on the pixel data.

As long as the region is under say 100 meters in x and y direction it can be one single unit. If it exceeds the 100 meters it will need split. I can make several passes across the world and get multiple plants trees and so on. I can overlay multiple regions with several passes of plants and trees (tree data is different)

RGB is predefined for shade of the grass.(Lush to dry) (based on water table data)

Once I have this region I can convert to the text description and write a collection data of plant life. splitting it up into chunks that are regions similar to a mosaic. These collections can be approximately equivalent to a 515x512 mosaic.

Filename is region-x-y-to-x-y or some meaningful name.

<?xml version="1.0" encoding="utf-8"?>
<WorldObjectCollection Version="2">
<Boundary Name="grass3" Priority="50">
<PointCollection>
<Point WorldViewSelect="True" x="2011249" y="59917.06" z="-4190813" />
<Point WorldViewSelect="True" x="1870521" y="63299.98" z="-4225753" />
<Point WorldViewSelect="True" x="1840249" y="62303.96" z="-4147017" />
</PointCollection>
<Grass Name="cgrass">
<PlantType Instances="10000" ColorMultHi="1" ColorMultLow="1" Name="Colorized Grass 1" ImageName="grass1" ScaleWidthLow="1000" ScaleWidthHi="1000" ScaleHeightLow="1000" ScaleHeightHi="1000" WindMagnitude="100" R="0.6235294" G="0.6392157" B="0.3960784" />
</Grass>
</Boundary>

<nextboundry>
More data points more plant types. etc
</nextboundry>

</WorldObjectCollection>

You can see here what I am trying to do but I just don't know where to start. :)

PostPosted: Fri Feb 26, 2010 1:26 pm
by Aaron
Hi Demi,

I think it would be best if the L3DT application handled the loading, saving and editing of the the vegetation database, much the same way as it handles materials. I'm working on this now.

In terms of how to generate the vegetation coverage, I'm thinking of using the land type coverage in the attributes map as much as possible, since this already contains the results of all the land type-related calculations (slope, salinity, watertable, etc.) Vegetation types will probably still have parameters for the water table and terrain aspect, but stuff like gradient, salinity and altitude range may be handled by land types.

Once I've somewhat settled on a definition of a vegetation type, I'll start building a plugin to perform the mapping calculation. The output, in the first instance, will likely be a 16-bit map, where each pixel value is the index of the vegetation type in the project's vegetation list. This vegetation map may then subsequently be used by plugins/scripts to calculate a list of vegetation instances, or areas, or whatever.

Anyway, I'm now off to the Virtual Terrain Project to start my literature search on plant distribution.

Cheerio,
Aaron.

PostPosted: Sat Feb 27, 2010 2:29 am
by demi
aaron wrote:Hi Demi,

I think it would be best if the L3DT application handled the loading, saving and editing of the the vegetation database, much the same way as it handles materials. I'm working on this now.

In terms of how to generate the vegetation coverage, I'm thinking of using the land type coverage in the attributes map as much as possible, since this already contains the results of all the land type-related calculations (slope, salinity, watertable, etc.) Vegetation types will probably still have parameters for the water table and terrain aspect, but stuff like gradient, salinity and altitude range may be handled by land types.

Once I've somewhat settled on a definition of a vegetation type, I'll start building a plugin to perform the mapping calculation. The output, in the first instance, will likely be a 16-bit map, where each pixel value is the index of the vegetation type in the project's vegetation list. This vegetation map may then subsequently be used by plugins/scripts to calculate a list of vegetation instances, or areas, or whatever.

Anyway, I'm now off to the Virtual Terrain Project to start my literature search on plant distribution.

Cheerio,
Aaron.


Oh, OK.

SO what you are doing is making a overlay I can just read if I understand you correctly? WOW! that save me a million hours of programming. Well, not a million but it save a lot of headache trying to figure out what to do. :)

Thanks Aaron for going that extra mile again.

D

PostPosted: Tue Mar 23, 2010 1:01 pm
by David Walters
Hi, here's an update showing my work with vegetation. I added trees over the last couple of nights.

Image

Based on your prior post alluding to the system you're planning, I've designed my vegetation system so that it uses a single 8-bit map at a 1M resolution (same as my HM). The values represent the type of thing in that square metre - grass, grass+flower, tree, etc.

Currently my map defaults to grass in all umasked areas and then trees and flowers are added onto that randomly. Unfortunately this ends up being too dense in places, so a rules system to enforce a minimum and maximum seperation should help that out a lot. Also the grass+flower texture is something I want to use sparingly, so I'd apply a seperation rule there too.

I'm weeks behind your thinking on the subject, but if it's not too late can I make the following requests for the specification of the system:

1. The ability to assign an arbitrary user id value for each plant type. I use 0x80 and up for trees as they require different processing from grasses and it makes it easy to quickly filter them.

2. The ability to mark a plant type as being present at all points of a mask, and not just dotted around. I can only think of grasses for this, or maybe kelp forests? :?

3. A coarse priority assignment to resolve ambiguities at the merging phase - eg. a tree is high, flower is medium, grass is low. Equal priorities would have a random resolution -- so you could have blue flowers and red flowers that both trump grass, but you'd still have a random spread of flowers.


In terms of density/mask maps like the ZeoGraph stuff I did - would they be used one per-biome? I think this would work well to allow user injection of masks. I definitely think some user control here would be nice to allow for drawing crop circles or something.

I thought for mask edges maybe they would work as a dice roll against the value as it dropped from 1.0 to get a ragged 'binary' fringe? although maybe you'd want a curve there? some plants could be tagged as outlyers and thus prefer edges. This would be good to have more ragged plants there or perhaps to apply a greater tilt so they hang out over the edge of a river?


Combining a selection of biomes from a project into the final vegetation map should be a case of generating instances in each biome using the priority rules and then a second pass per-pixel (-per-cpu core 8)) on the whole set would run the priority rules again to get the final map.


I hope this isn't too much of a ramble, I'm just throwing out my ideas as best I can to explain my thinking (and to hopefully get something I can use without much extra processing)


ps. I used tree[d] to create the model and I would recommend it to anyone as a great, and free, tree generation tool.

PostPosted: Wed Mar 24, 2010 2:11 am
by demi
Outstanding stuff.

Sorry this is another Demi WOT as it is important to understand the functions of the engine to be able to figure out the algorithms. :)

Aaron is working on the code end and getting it into production. Wonder if the duplication is necessary. :?:

According to your post here this may be all that is required. Multiverse streams data blocks so the map of the terrain is streamed out. The entities (houses, grass, plants, trees, player character and non-player characters) are also streamed based on perception of the avatar. In other words millions upon millions of entities can be placed in the world as long as the total entities does not exceed the point of causing frame rate to fall below acceptable levels. (data packed to tight in one area, to many entities in memory)

To keep this from happening a map of the world entries in split into collections and regions. The collections are usually placed so they form a region of their own and have internal regions. The other areas where there are not many entities such as a forest are place in a different collection and the regions are divided into small sections. This allows the engine to stream small data blocks on demand and not cause a tremendous lag spike on loading.

Regions can overlap and have multiple entities. One type of grass, and maybe some trees. Never 2 plant types though. You will see this later in the video. The trees are placed by the engine based on area density. i.e.. the square size by the number of requested trees.

Plants are also defined by density based on the amount of plants to the total area size. i.e.. A trees count of 100 based on a square area of 100 SQ meters will place a tree/plant ever square meter. the same number of trees placed on a 10000 sq meters will place a tree/plant about 10 meters apart.

Http://www.whrenonline.com/screenshots/grass1.jpg

shows low density grass.In the next screen we upped the density here form 1000 to 10000 blades of grass.

Http://www.whrenonline.com/screenshots/grass2.jpg

Now we add a second layer to the first layer which means this will cause issues in the engine.

Note: One region of plant needs to overlay another layer. Trees seem unaffected but plants only show one object so if we want the engine to display 2 to 5 types of plants we need to make 2 to 5 regions.

Http://www.whrenonline.com/screenshots/grass3.jpg

Examples of tree density.

Http://www.whrenonline.com/screenshots/trees1.jpg

Http://www.whrenonline.com/screenshots/trees2.jpg

The other consideration on plants and trees is scale variances. (how much do I vary the size and how much do I vary the height) Also, grass color can be defined based on the water table. A lot of water equals a much greener plant. Very low elevations can take a swampy look and higher elevations can take on a drier look. Flowers can have shades of color.

Http://www.whrenonline.com/screenshots/trees3jpg

So we have map that has a scientific approach that elms and maple trees would grow in the region and a water table suggests that these trees are very healthy. the density is small so they grow rather large. We then feed the engine tree data based on this. This example uses speedtree but I have to look at maybe ngplant as the data trees are procedural generated.

The file that is produced.

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<WorldObjectCollection Version="2">
<Boundary Name="garss1" Priority="50">
<PointCollection>
<Point WorldViewSelect="True" x="1097658" y="50001.86" z="21245.81" />
<Point WorldViewSelect="True" x="1056807" y="39188.38" z="-266441.9" />
<Point WorldViewSelect="True" x="1225020" y="37375.02" z="-271841.5" />
</PointCollection>
<Grass Name="grass3">
<PlantType Instances="5000" ColorMultHi="1" ColorMultLow="1" Name="Colorized Grass 2" ImageName="grass2" ScaleWidthLow="1000" ScaleWidthHi="1000" ScaleHeightLow="1000" ScaleHeightHi="1000" WindMagnitude="100" R="0.8862745" G="0.8705882" B="0.2117647" />
</Grass>
</Boundary>
<Boundary Name="trees1" Priority="50">
<PointCollection>
<Point WorldViewSelect="True" x="1339636" y="42335.38" z="-149751.1" />
<Point WorldViewSelect="True" x="1050409" y="52795.37" z="10783.78" />
<Point WorldViewSelect="True" x="1070120" y="36931.2" z="-281216.2" />
</PointCollection>
<Forest Name="Forest" Filename="demoWind.ini" WindSpeed="0.3" Seed="0">
<WindDirection x="0" y="0" z="0" />
<Tree Name="Weeping Willow" Filename="WeepingWillow_RT.tre" Scale="10000" ScaleVariance="1000" Instances="35" />
</Forest>
</Boundary>
<Boundary Name="trees2" Priority="50">
<PointCollection>
<Point WorldViewSelect="True" x="1018502" y="48052.08" z="-181416.8" />
<Point WorldViewSelect="True" x="1244842" y="53937.13" z="40583.25" />
<Point WorldViewSelect="True" x="1239863" y="37478.7" z="-225278" />
</PointCollection>
<Forest Name="Forest" Filename="demoWind.ini" WindSpeed="0.3" Seed="0">
<WindDirection x="0" y="0" z="0" />
<Tree Name="Sugar Pine" Filename="SugarPine_RT.tre" Scale="50000" ScaleVariance="1000" Instances="50" />
</Forest>
</Boundary>
<Boundary Name="grass1" Priority="50">
<PointCollection>
<Point WorldViewSelect="True" x="1362477" y="43847.89" z="-203590.5" />
<Point WorldViewSelect="True" x="1098477" y="38404.6" z="-235401.8" />
<Point WorldViewSelect="True" x="1160834" y="53887.62" z="83310.28" />
</PointCollection>
<Grass Name="grass1">
<PlantType Instances="10000" ColorMultHi="1" ColorMultLow="1" Name="Colorized Grass 1" ImageName="grass1" ScaleWidthLow="1000" ScaleWidthHi="1000" ScaleHeightLow="1000" ScaleHeightHi="1000" WindMagnitude="100" R="0.4823529" G="0.5882353" B="0.2392157" />
</Grass>
</Boundary>
</WorldObjectCollection>


Now lets take a look from the server end.

http://www.youtube.com/watch?v=2BlzZN3yQBo

Notice how the grass is streamed? This is true for all objects that will come into perception range. It is most noticeable with small items as the perception range is real short.

Now in clip 1 we have overlaid the grass with two types. Notice that only one is displayed? I exited the server and fixed it bay adding another region for the second grass.

Now as you probably seen what was maybe 1/10,000 of the world so you can imagine what nightmare it would ensue to hand edit this. It would take years just to layout the foliage and trees. A computer is good at algorithms and this is much easier to accomplish. I am working on so many things I can't keep track. I have ngplant to work on yet. Then quest system, guild syatem, crafting system. Tons and tons of work. :)

PostPosted: Sat Apr 03, 2010 1:23 pm
by Aaron
Hi Guys,

Hurrah, first test results from L3DT's vegetation mask generator:

Image

This is the mask for a 'grass' veg type. The mask is zero (black) for all non-grass land types in the attributes map (sand, rocks, etc.) The mask value is 20% lower for 'dry grass' land types, and 20% greater for 'lush grass' land types. Furthermore, there is variation in the score based on the gradient, so steep areas have lower score in this type. There is also support for masking based on the altitude (i.e. for snow lines), water depth (for mangroves, etc.), and salinity, but these was not used in this demonstration. Anti-aliasing to smooth transitions from one land type to another is also planned, but not yet implemented.

These per-type vegetation masks represent the first stage in vegetation mapping. It is envisioned that the user may then customise/modify these masks to add perlin noise or light map dependency (as David demonstrated), or other effects using ZeoGraph. Once the user is satisfied with the masks, they will be fed into a yet-to-be-written algorithm that will generate a vegetation instance map (probably 8-bit, but possibly 16 if required) and/or a long list of vegetation instances. This calculation step may involve a 'game of life' style simulation, but in the first instance, it might just involve a sort of random shotgun approach.

Anyway, I have still yet to build a user interface for the mask generation, so it will be at least several weeks before the vegetation masks are available to users.

David Walters wrote:Hi, here's an update showing my work with vegetation. I added trees over the last couple of nights.
Image


Bravo! Really nice work there.

David Walters wrote:Based on your prior post alluding to the system you're planning, I've designed my vegetation system so that it uses a single 8-bit map at a 1M resolution (same as my HM). The values represent the type of thing in that square metre - grass, grass+flower, tree, etc.


That sounds fine. By default, the veg type masks are generated at the same resolution as the attributes mask (to make anti-aliasing less of a headache), but the final output vegetation instance map will have user-selectable resolution, probably defaulting to the size of the heightmap.

David Walters wrote:Unfortunately this ends up being too dense in places, so a rules system to enforce a minimum and maximum separation should help that out a lot.


Planned; will be set by 'game of life' rules.

David Walters wrote:1. The ability to assign an arbitrary user id value for each plant type. I use 0x80 and up for trees as they require different processing from grasses and it makes it easy to quickly filter them.


OK, on to-do list. However, I wash my hands of managing ID collisions. User beware.

David Walters wrote:2. The ability to mark a plant type as being present at all points of a mask, and not just dotted around. I can only think of grasses for this, or maybe kelp forests? :?


Sure. I'll have a thinker about it.

David Walters wrote:3. A coarse priority assignment to resolve ambiguities at the merging phase - eg. a tree is high, flower is medium, grass is low. Equal priorities would have a random resolution -- so you could have blue flowers and red flowers that both trump grass, but you'd still have a random spread of flowers.


I will have to implement this for the game of life, but I've not thought through the mechanism just yet.

David Walters wrote:In terms of density/mask maps like the ZeoGraph stuff I did - would they be used one per-biome? I think this would work well to allow user injection of masks. I definitely think some user control here would be nice to allow for drawing crop circles or something.


Each vegetation type will have its own mask, and yes, you certainly could make crop circles using it.

David Walters wrote:I thought for mask edges maybe they would work as a dice roll against the value as it dropped from 1.0 to get a ragged 'binary' fringe? although maybe you'd want a curve there? some plants could be tagged as outliers and thus prefer edges. This would be good to have more ragged plants there or perhaps to apply a greater tilt so they hang out over the edge of a river?


I'm not sure edges will require any particularly special treatment, but I'll keep it in mind when developing the game of life algorithm.

Tilting trees is a possibility. I suppose I could use a 24-bit vector for the tree's up vector, plus another 24-bit vector for random axial scaling, and a byte for rotation about the up axis. This will add quite a bit to the data size; m'think's I'll use a binary file format for storing this per-instance data.

Cheerio,
Aaron.

PostPosted: Sun Apr 04, 2010 11:17 am
by David Walters
aaron wrote:Hurrah, first test results from L3DT's vegetation mask generator:

Ace, this is just what I was hoping for!

Everything you've posted is right on track for what I'd like out of the system and I can easily imagine using this data with my toolchain. I will be able to get a ton of use out of just the masks themselves due to their accuracy with respect to the material system. Beyond that any system to distribute flowers and trees and things will be a great bonus.

Looking forward to trying this out :)

PostPosted: Thu Apr 08, 2010 11:51 am
by Aaron
Hi David,

Okie dokie, in the latest build (v2.8 build 19), I've included the mask generation code. At this time, the masks are defined by XML files, as there is no mask editor UI just yet. I have included a demo mask file (grass.mask.xml) in the 'Masks' resource folder. To use these masks, I have created two new ZeoGraph filters:
  • MaskGen.LoadMask, for loading the mask generator object from the file, and;
  • MaskGen.ProcessMask, for calculating the mask map from the mask generator object.
These filters are demonstrated in a new example graph (MaskDemo.zgraph), which is included with the installer. It looks a little something like this:

Image
(nothing too tricky here)

This mask generation system will be used as the first stage in the vegetation mapping. It is planned that there will be a 'vegetation type' object, which will contain one mask generator (as used in the above graph), as well as some additional vegetation-specific data, such as tree height, mesh file, yada yada yada.

I'll get to work on the user interface next. I'll also try to bash together some documentation on the subject of mask definitions.

Cheers,
Aaron.

PostPosted: Sat Apr 10, 2010 2:21 pm
by David Walters
Hi, got back from holiday today and found this update waiting, great!

It didn't take long to integrate with my system and although it was hard to find a good angle to take a screenshot from I hope the image below captures it working 'in the field' so to speak :wink:

Image

This shot represents a 'pure' build using the data directly (as input probabilities for my vegetation map generator) with no hacks to remove grass on slopes, etc.

I just used the default grass.xml data for this too, looking forward to a UI to play with, but for my purposes the values you've given me are perfect.

Thanks!

PostPosted: Wed Apr 14, 2010 11:52 am
by Aaron
Hi David,

Looking good.

If you're feeling rather brave, you can remove the grass from the steep slopes by reducing the 'GradRange->Max' parameter in the grass.mask.xml file (for safety, also reduce 'GradRange->MaxBevel' to the same number).

I'm making some progress on the mask editor UI, but I think it's probably still a few days away. There are lots of parameters and flags, and it's taken quite a lot of time to work out just how to arrange them all. I hope everybody likes tabbed dialogs!

I will, of course, let you know when the UI is available for testing.

Best regards,
Aaron.

PostPosted: Wed Apr 14, 2010 1:51 pm
by David Walters
Thanks for the update Aaron, "a few days away" is great news -- I won't hold you to that of course but it's nice to hear it's coming soon! I'm preoccupied with lakes and seas at the moment, improving on the rather poor blue blob in the screenshot I posted above!

That's pretty much done though, so I'm keen to have a tinker with the new UI. I think the first thing I'll use it for is for a 'stone map' to add some little bits of shale and pebbles and things on there. Should work out well, think I'll start on some meshes to pass the time!

As for tabbed UIs - that's all good with me :)

Regards
David