Reputation: 81
I'm trying to randomly generate terrain in a low-poly style similar to the terrain seen in Cube Slam and this video. I tried experimenting with the webgl_geometry_terrain.html example, but it still generates somewhat smooth terrain, as opposed to the flat polygons making up my intended terrain.
I'm just starting with Three.js so it's quite possible that there is a rather simple solution to my problem.
Upvotes: 2
Views: 2763
Reputation:
Really simple, just use THREE.FlatShading
(edit: and geometry.computeFaceNormals()
):
var geometry = new THREE.BoxGeometry(2, 2, 2);
var material = new THREE.MeshLambertMaterial( { color: 0xdddddd, shading: THREE.FlatShading } );
geometry.computeFaceNormals(); // <-- I think you'll need this if you're doing terrain (as opposed to built in geometry like BoxGeometry)
var mesh = new THREE.Mesh( geometry, material );
scene.add(mesh);
Upvotes: 0
Reputation: 73
Take a look at http://threejs.org/examples/canvas_geometry_terrain.html it seems to do pretty good random terrain.
Upvotes: 1