Elevation - Adding sides

Software: Away3D 4.x

tomdanvers, Newbie
Posted: 05 April 2013 02:17 PM   Total Posts: 2

Hello all!
I want to create a landscape mesh that has edges (so the landscape appears to be cut out of a block). Is there a good way of achieving this with the Elevation mesh class (http://away3d.com/livedocs/away3d/4.0/away3d/extrusions/Elevation.html)?

Here is what I have so far: http://tomdanvers.com/labs/landscape_gen/

So I need to add sides to that shape. Does that make sense!?

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 06 April 2013 07:34 AM   Total Posts: 166   [ # 1 ]

Following is just a idea.
I don’t know this is the easiest way.
But you can.

At first, prepare 4 plane:

edgeMeshPosX = new Mesh(new PlaneGeometry(1terrainZ1terrainGridY,true), edgeMaterial);
edgeMeshNegX = new Mesh(new PlaneGeometry(1terrainZ1terrainGridY,true), edgeMaterial);
edgeMeshPosZ = new Mesh(new PlaneGeometry(terrainX1terrainGridX1,true), edgeMaterial);
edgeMeshNegZ = new Mesh(new PlaneGeometry(terrainX1terrainGridX1,true), edgeMaterial); 

If you can get the vertices at the edge of terrain mesh,
copy values to the vertices of edge meshes (up side vertices).

Or you can get the value from terrain’s height map’s edge pixels.

This is an example of controlling vertices of Plane geometry.
You can learn from this, if you don’t know how to change vertices.
http://wonderfl.net/c/dN94

And you should edit UVs of the edge meshes.
That’s a next step:)

Cheers.

   

tomdanvers, Newbie
Posted: 06 April 2013 12:19 PM   Total Posts: 2   [ # 2 ]

@GoroMatsumoto

Thanks for that tip!
I’ll give it a go and then let you know how i get on.
Thanks,

Tom

   

Avatar
Fabrice Closier, Administrator
Posted: 06 April 2013 06:38 PM   Total Posts: 1265   [ # 3 ]

Actually you have all you need in the api for this. Collect side points, and use SkinExtrude. The class will build the surface of each side as it should.
Then because uvs will be distorted depending on points values. You need after each sides constructs to pass the ‘skin mesh’ to the Projector class, to set uvs correctly using: front, back, left and right params.

One tip for the SkinExtrude, as both start and destination vectors needs to have the same length, simply reuse the same value vector3D as for the terrain side level for the second buffer but with the y value of your bottom.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X