voxel-fakeao
Apply a naive ambient occlusion to geometry faces.
Currently this just gradients horizontal faces dark to light, top faces light and bottom faces dark. Could definitely be better but hey it's fake.
example
var fakeao = game; // Apply fakeao to every chunkgame; // Or apply to a specify geometryfakeao; // Or specific facesfor var i = 0; i < geometryfaceslength; ++i ;
api
var fakeao = require('voxel-fakeao')(game)
fakeao(face, [light, dark])
Will apply gradient between light and dark onto the face. If light
is omitted
it will use the existing face color. If dark
is omitted then it will be
automatically calculated at 10% darker than light
.
fakeao.onGeometry(geometry, [light, dark])
Apply to all the faces of a geometry.
fakeao.onChunk(chunk, [light, dark])
Apply to all the faces of a geometry on a chunk.
install
With npm do:
npm install voxel-fakeao
Use browserify to require('voxel-fakeao')
.
release history
- 0.1.1 - fix color conversions
- 0.1.0 - initial release
license
Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.