in my game i already wrote the part that loads the terrain in many tiles, and now i have to wrote the part that puts the vegetation on it.
I need a procedural way to set the coordinates.
I thought of using
x = sin(T(x,y))* size_of_the_tile's_side/2and
y = cos(K(x,y))*size_of_the_tile's_side/2to calculate the position relative to the tile center(in this way i'm sure the coords can't fell out of the tile).
The problems i have are:
1) i can't use any random function (the vegetation must not change, every time you are on a tile the vegetation must be the same)
2) i need to have the T(x,y) and K(x,y) functions a bit vary, since i don't want the vegetation to be much repetitive(since sin & cos are periodic functions)
3) i need an "algorithm" to calculate how much vegetation add (i can't add always 50 trees, i need it to vary, and it should be dependent from the sector(so that the density is quite costant in macro-zones))
Long story short, i need to set how many vegetation to add and where..
Is there any docs, resources, papers to get informations from?
Thank you very much in advance
Ps: i said cos and sin since they are the simplest functions that always return [-1;+1], but i'm open to more complex functions
PPs: x and y are the integer index of the tile. Watching from above, the lower-left tile is (0,0) , the upper-right is the ,eg, (300,300)
PPPs: the game is 3D, but the z coord is not a problem, since i'll throw a ray from above and find the intersection with the terrain, and than i'll have the z coord of the hit point and the normal of that face(and then if the terrain is too steep i'll add a different type of vegetation, and i'll load different meshes in base of the height of the terrain)