Home

Awesome

threex.volumetricspotlight

threex.volumetricspotlight is a three.js extension which provide a 'good enought' spot light. as in described in "Good Enough" Volumetrics for Spotlights post from john chapman. Well almost the same, it doesn't include the soft particles feature when the spot cross the ground. I implemented it but THREE.DepthMaterial is storing depth on 8 bit. It creates strong precisions issues.

Show Don't Tell

How To Install It

You can install it via script tag

<script src='threex.volumetricspotlight.js'></script>

Or you can install with bower, as you wish.

bower install threex.volumetricspotlight

How To Use It

threex.volumetricspotlighthelper.js

Create the object and attached it to the scene.

var helper  = new THREEx.VolumetricSpotLightHelper(light)
scene.add(helper.object3d);

Then at every frame rendered, you update it.

helper.update(deltaSecond, nowSecond);

threex.volumetricspotlightmaterial.js

var geometry = new THREE.CylinderGeometry(0.0, 1.5, 5, 32*2, 20, true)
var material = new THREEx.VolumetricSpotLightMaterial(light)
var mesh = new THREE.Mesh(geometry, material)
scene.add(mesh)

Possible Improvements

TODO

use Depth for 'soft particles'