Skip to main content
GameDev.net gamedev.net
🔒 Locked

Function Based Terrain

Started by higherspeed Apr 23, 2003 at 12:39 PM 1 replies 350+ views
Original Post
higherspeed
higherspeed
This topic isn''t about how to draw the terrain exactly, but more on how to generate it. Although bitmaps are the most commonly used methods of obtaining the height of a specific vertex, wouldn''t it be easier to do with a function based on the x and y coords. The function would be complicated, but would save on memory for large terrains, where a heightmap isn''t easy to implement. Also using some fractal methods(I have a few ideas, but haven''t worked out how to use them yet) you could put as much detail as you want if necessary. Using a system like ROAM you could get VERY large terrains, with very detailed surfaces. This detail of course couldn''t be defined by the mapper, but then again, what sort of mapper would have time to put that much detail in. Creating a hill would be easy, with a function like f(x,y) = k / (1 + dist^2), where dist is the distance from a defined point. By varying 1(yes I know, but you know what I mean) and k, you could created blunted and sharp shapes. By using a different distance(not linear), you could vary the general shape of the hill. I''ve thought of many other functions for other purposes, such as making a section of ground flat. When wanting a height value, a function would take the x and y coord and stick them in the different functions in a predefined way and order and out would come a value. This wouldn''t be quick for many vertices, but shouldn''t be too bad, if new ones are spread out over time. If this is an old idea then please tell me and point me to some reading on it. I''d like your views and opinions and any potential problem you''ve seen.
Ready4Dis
Ready4Dis
Look up perlin noise.
higherspeed
higherspeed
That''s pretty much exactly what I meant for the detail that can be added. That would work really well as the random layer added onto the user defined function. So I would just add on a high frequency Perlin function onto the top. Effectively replacing the low frequency with my own. I read a couple of books on fractals a while back, but they dealt more with less random fractals like the Mandelbrot and Julia Sets, as well as iterators, like the quadratic.

Thanks a lot.

For people wanting a direct link:
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.