Scaling my terrain
-
- Posts: 11
- Joined: Sun Mar 24, 2013 10:27 pm
Scaling my terrain
I have a terrain generated from a 1024x1024 heightmap. I have a parameter in engine that scales the position of each vertex by a user-defined amount, so that the world can be larger without requiring larger heightmap images and more memory. I need to be able to take a 1024x1024 heightfield array and create a scaled terrain in BEPU, like one that would be 4096x4096 in size. Can this be done?
Re: Scaling my terrain
Yup. The Terrain has a world transform associated with it. The transform can accept any affine transform including scaling.
For example, here's a snippet from the TerrainDemo:
That AffineTransform constructor takes a scaling, orientation, and translation.
For example, here's a snippet from the TerrainDemo:
Code: Select all
var terrain = new Terrain(heights, new AffineTransform(
new Vector3(xSpacing, 1, zSpacing),
Quaternion.Identity,
new Vector3(-xLength * xSpacing / 2, 0, -zLength * zSpacing / 2)));
-
- Posts: 11
- Joined: Sun Mar 24, 2013 10:27 pm
Re: Scaling my terrain
Thanks, that worked perfectly.