开发者

3D. "Hand made" Hills and Mountains

In my program I've create a mesh that look like this:

http://en.wikibooks.org/wiki/File:Blender3DNoobToPro-Creating_The_Canvas.jpg

And I want to get something like this:

http://en.wikibooks.org/wiki/File:Blender3DNoobToPro-Molding_the_Mountains_02.jpg

I create this mesh with this simple code

for (int i = -(xPlanesCount / 2); i < (xPlanesC开发者_高级运维ount / 2); i++)
        {
            for (int j = -(yPlanesCount / 2); j < (yPlanesCount / 2); j++)
            {
                var xOffset = i * size;
                var yOffset = j * size;

                //code that create a plane
            }
        }

The question is... if I want to make a hill... how can I do that? I know the coordinates of "hill" top (for example x10 - y2), the radius of the hill is 2 planes and height of the hill is 10 pixels.

What calculation do I need to make to get this result?

http://en.wikibooks.org/wiki/File:Blender3DNoobToPro-Molding_the_Mountains_02.jpg


Applying a Gaussian function at the correct point might do the trick.

EDIT: In Two-dimensional Gaussian function, you have the general f(x,y) formula, and the explanation of the parameters. Now, you only need to use math functions from your favorite language!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜