08-12-2005, 03:42 AM,
|
|
thelusiv
Administrator
|
Posts: 2,346
Threads: 223
Joined: Jun 2005
|
|
foliage help
Messing around with the new scenery support, I've successfully added around 250 trees, but it's a pretty big pain to map out the objects in a text file. i have to make a row of them, and then copy it, then change the values and it takes quite a while. i was thinking, what if there was another way to map some of the objects - for instance, if we added a png to the objects directory for each track, maybe objects.png, which could be the same size as the terrain graphic.The png would work like this. Each dot on the map tells what kind of foliage is there and how dense it is. This data is represented by the color value on the map. Each color channel is broken up into 3 or 4 ranges of values, sorta like this:0-33% red: foliage a34-66% red: foliage b67-99% red: foliage c0-33% blue: foliage d34-66% blue: foliage e67-99% blue: foliage f0-33% green: foliage g34-66% green: foliage h67-99% green: foliage iInstead of breaking it up into thirds it could also be fourths, that would give 16 different types of foliage instead of nine. Anyway with the above values, a dot of value 33% green and 100% red and blue would be a lot of foliage g, but nothing else in the the area represented by that dot on the map. The positions of the foliage inside that area would be random, as well as the rotation of the objects. The quantity of foliage g in that area would be the maximum for that type of foliage's range (which would be set along with the model filename in the settings text file).Using this scheme many different combinations can be made, for instance a dot with a lot of foliage a (red 33%), a few of foliage e (40% blue) and a medium amount of foliage i (80% green) could be placed next to a dot with two or three very different types or amounts of foliage, etc. etc. Along with the randomization I think this would make foliage a lot easier to place.Other objects could still be directly mapped to positions as they are now.
|
|
08-15-2005, 10:30 AM,
|
|
charlieg
Member
|
Posts: 98
Threads: 10
Joined: Aug 2005
|
|
foliage help
thelusiv Wrote:Each color channel is broken up into 3 or 4 ranges of values ... it could also be fourths, that would give 16 different types of foliage instead of nine. Actually, if you think about it, you're already (potentially) representing more than 9 types with 3 classifications in each as doing it by RGB individually makes it a 3d matrix.You're thinking of it like this:<pre> R G B1 a b c2 d e f3 g h i</pre>But really you get 27 combinations:<pre> R1 R2 R3 R1 R2 R3 B1 B2 B3B1 a b c G1 j k l G1 s t u B2 d e f G2 m n o G2 v w x B3 g h i G3 p q r G3 y z @</pre> EDIT - actually it's probably more than that... R1G1 has 3 combos with B etcUnless you want colour to affect foilage type (e.g. so more green means conniferus or blue means more bushy) then it could be a lot simpler just breaking down 1 number than it will be combining 3, so you may want to stick with greyscale unless features require otherwise.I do, however, think the 'treemap' image is an excellent idea.
|
|
08-15-2005, 11:55 AM,
|
|
thelusiv
Administrator
|
Posts: 2,346
Threads: 223
Joined: Jun 2005
|
|
foliage help
charlieg: I see what you mean and I think you're talking about the same thing I am.<pre> R G B1 a d h2 b e i3 c f j</pre>So, let's say on a given pixel represents a square 5 m x 5 m in the actual game (it may be different, idunno). Let's also say that for each lowercase letter in my matrix above there is a range equivalent to 0-100% that corresponds to the color values 0-33% for a, 34-66% for b, etc. Let's say "a" represents grass, "c" represents bushes, and "h" is an oak tree. Let's also say grass has a 10-unit per-square max density, bushes have a 6-unit max density, and oak trees have a 2-unit max density.So, if there was a dot on the map that had the value a(50%) c(20%) h(10%) then in that 5x5 meter square there would be 4-6 grass tufts, 1-3 bushes, and 0-1 oak tree. The actual numbers of them should have some random coefficients because that's how plants grow, kinda randomly.If there is a dot which has any channel as 0xFF (255) then all the foliage types that channel maps to are forced to 0% for that 5x5 meter square.The extended matrices you made are basically permutations of the system I describe here. As you say, we could have each of these permutations map to another type of foliage, but realistically 9 types of foliage will be plenty for one track. Thus it'd be more useful to be able to combine different types of foliage in a given area than have yet more types of foliage. charlieg Wrote:I do, however, think the 'treemap' image is an excellent idea. I must admit the idea is not mine, a grayscale foliage map was used in their FAQ page as well as the rest of how to make Trigger tracks.
|
|
08-16-2005, 04:46 AM,
|
|
FFuser
Member
|
Posts: 147
Threads: 10
Joined: Jul 2005
|
|
foliage help
[quote="thelusiv"]I must admit the idea is not mine, a grayscale foliage map was used in ppracerI don't know if it is exactly the same, but it looks the same
|
|
08-25-2005, 11:43 AM,
|
|
charlieg
Member
|
Posts: 98
Threads: 10
Joined: Aug 2005
|
|
foliage help
You want to be careful with shadows because if you don't shade the tree as well as the ground, it can look quite wrong.
|
|
08-27-2005, 08:18 PM,
|
|
thelusiv
Administrator
|
Posts: 2,346
Threads: 223
Joined: Jun 2005
|
|
foliage help
Since Joe's last post he changed the way they're done and they look very good now. I need to update the shadow graphics themselves a bit more but after that I think the tree shadows are more or less done.The biggest remaining problem I see with the tree system is this:When trees are placed on the terrain, it isn't taken into account where other trees are around them. So, some trees can end up stuck under others. When they're really thick like this the framerate drops quickly. I think the best way to fix this would be to make the game aware of the trees' radii, maybe just have another text file in runtime/data/objects/ called trees.txt that has the width of each tree. This text file could be something like this:<pre># tree 0rad 2.0# tree 1rad 2.0# tree 2rad 4.0# tree 3rad 10.0# tree 4rad 3.0</pre>So each tree would have a radius, and that way the trees could be made to avoid each other and not be too clumpy, even if they are at the highest density.One more idea for the trees: they look a little funny sometimes when the trees are mixed together because usually, trees tend to group together somewhat. It would be nice to have some way to control which types of trees go where so that we could have a clump of pines, then some oaks, blah blah blah.Oh yeah one other thing: it would be nice if the shadows of the trees moved/grew a little along with the weather system, so that as the sun sets the shadows get longer or move.
|
|
|