Jump to content
  • Advertisement
Sign in to follow this  
soconne

Generating Shore Lines

This topic is 5414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anybody know how to generate shore lines where the water meets the land, such as in the FarCry Sandbox editor? Since the terrain is simply a grid of points, I was thinking of creating another grid of equal resolution representing points for the shore lines. Then I simply do a line test with each point and its neighboors (up,down,left,right) to see if the line crosses the water plane. If it does, then I flag that point and store the slope of the line. Then I do the same thing for every other point in the grid. When I'm done with every point, I then go back and for each point, I check all its neighbors (up-left,up-up,up-right,left,right,....,down-right)... and if one of the neighbors is also flagged then I create a quad which extends out in the direction of the average of the 2 points vectors with a predefined length of my choosing. Now lets say I'm on point A, and I connect to point B to my bottom left, then I check point C to my bottom right, well when I connect point A and point C, I average the new vector of A and C, so A vector gets changed again. Basically something like this
Before connecting A and B
     
       | 
       | 
       A

 ---B  

Then after connecting A and B

           \ 
  \    A
   \  /
     B 


Then there is C

             \ 
  \    A
   \  /
     B    C-----


So after connecting C I would get

      |
       | 
  \    A      /
   \  /     /
     B    C




So I thought one could basically do this for all the points in the grid, continually connecting each point to its neighbors and creating triangles from these connections. Anybody have any thoughts on this or another way that Halo, FarCry, or any other game for that matter does shore lines?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!