0
\$\begingroup\$

I want to make a simple 2d terrain with just a few bumps and height changes:

terrain with le car

I thought about just using random numbers to describe the height of a certain vertex, but I don't see how I can make one mesh from this. I'm looking for a way to find the vertex and indices buffers for the terrain.
How do I do this?

\$\endgroup\$
1

1 Answer 1

11
\$\begingroup\$

Create a triangle strip. You could have your random heights at intervals equal to t. So the triangle strip would then consist of you alternating between the height vertices (with y being random and x equal to t * iteration) and vertices that go along the bottom (with y being constant and x also equal to t * iteration).

enter image description here

Naturaly, the distance between each vertex pair doesn't have to be constant, this is just an example of the implementation.

\$\endgroup\$
1
  • \$\begingroup\$ I thought about how to do this and this answer makes it pretty simple. This actually helps me out with making random asteroid objects. \$\endgroup\$
    – Azaral
    May 3, 2012 at 1:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .