Filling in the holes (HELP!)
Frustrating...
I have a program that generates a random piece of terrain that I want to have a little buggy move around in (eventually).
What I have is a 10 X 10 grid of quads made up of points. They form little hills and such.
What I want to do is create a function that will return the height at a location I specify. I'm okay if I want to query the height at, say, point (7,3) but I want to be able to get the height at point (7.3,3.7) or something.
And I cant just make a finer grid (say 100 X 100) because the points are random and it will create 1000 little mountains!
Help!
To get the height at point 7.3 on the x axis you could do:
To make a random terrain you could use something like Perlin noise or the diamond-square algorithm.
Hope that helps.
height = point[7].height + ((point[8].height - point[7].height) * 0.3f)
The y axis would be the same, this assumes your grid runs left to right, top to bottom. You get the 7 from the integer part, 8 is the next cell and 0.3 is the fractional part.To make a random terrain you could use something like Perlin noise or the diamond-square algorithm.
Hope that helps.
--
Cheers,
Darren Clark
Cheers,
Darren Clark
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement