Threex.grassground is a three.js game extension which provides a simple mesh for a flat grass. It is a content extension to help you start your game. It contains a diffuse and a normal texture from three.js. Play with the normal scale and the texture repeat to fit your needs. This could be an easily displayed grassground for your field or you terrain in your three.js game.
- examples/basic.html [view source] : It shows how to include a grass ground into your own code.
You can install it via script tag
<script src='threex.grassground.js'></script>Or you can install with bower, as you wish.
bower install threex.grassgroundFirst you instanciate the object
var groundMesh = new THREEx.GrassGround()
scene.add(groundMesh)There are some options arguments that you can tune to fix your own needs.
var groundMesh = new THREEx.GrassGround({
width : 1, // the width of the mesh, default to 1
height : 1, // the height of the mesh, default to 1
segmentsW : 1, // the number of segment in the width, default to 1
segmentsH : 1, // the number of segment in the height, default to 1
repeatX : 1, // the number of time the texture is repeated in X, default to 1
repeatY : 1, // the number of time the texture is repeated in Y, default to 1
anisotropy : 16, // the anisotropy applied to the texture, default to 16
})
- make geometry tunable
- opts.geometry
- thus able to use circle geometry for example
- var geometry = new THREE.CircleGeometry(width/2, 32)
