whs-component-Terrain
WhitestormJS Terrain plugin
Usage
With presets
const terrain = geometry: map: 'assets/terrain/default_terrain.png' // Heightmap image. depth: 100 // Difference between min z and max z. width: 256 // Terrain x resolution height: 256 // Terrain y resolution mass: 0 // Make it static. physics: friction: 1 restitution: 0 material: 'default' // Use preset. // Array of textures for preset. WHS WHS WHS WHS WHS ;
Custom
const terrain = geometry: map: 'assets/terrain/default_terrain.png' // Heightmap image. depth: 100 // Difference between min z and max z. width: 256 // Terrain x resolution height: 256 // Terrain y resolution mass: 0 // Make it static. physics: friction: 1 restitution: 0 material: from: 01 025 to: 024 026 scale: 100 texture: WHS from: 024 027 to: 028 031 scale: 100 texture: WHS from: 028 032 to: 035 040 scale: 200 texture: WHS from: 030 040 to: 040 070 scale: 200 texture: WHS from: 042 045 scale: 100 texture: WHS ;
- from - Gradient start (applied texture).
- to - Gradient end (applied texture).
- scale - Texture scale.
- texture -
THREE.Texture
object.
Heightmap example
- Should be grayscale. (black <-> white).
- Resolution should be a power of two (256x256, 512x512, 1024x1024 ...)