It is a
threex extension
for
three.js
which provide a laser like display.
You can do a simple laser beam which display the laser as transparent and additive blending.
Or you can get something more cooked.
THREEx.LaserCooked
provides dynamic collision, cool impact effect with point light and
impact sprites.
- examples/demo.html [view source] : It shows a demo with cooked laser impacting a moving torus.
- examples/laserbeam.html [view source] : It shows a usage of threex.laserbeam.js, it could be the basis for a light sword for example.
- examples/lasercooked.html [view source] : It shows a usage of threex.lasercooked.js. The laser is inside a cube, the cube is filled with toruses positioned at random, and the laser is colliding with other objects.
You can install it via script tag
<script src='threex.laserbeam.js'></script>
<script src='threex.lasercooked.js'></script>
Or you can install with bower, as you wish.
bower install threex.laser
It is a raw laser beam using dynamic textures. Here is to create the laser beam and add it to the scene.
var laserBeam = new THREEx.LaserBeam()
scene.add(laserBeam)
It is a laser beam with dynamic collision.
On impacts, to increase realism, there is sprite and point light.
It depends on THREEx.LaserBeam
so first create it and add it to the scene
var laserBeam = new THREEx.LaserBeam()
scene.add(laserBeam)
Then you create the laserCooked based on it. Don't forget to update it in your render loop.
var laserCooked = new THREEx.LaserCooked(laserBeam)
onRenderFcts.push(function(delta, now){
// every time you render the scene, update laserCooked
laserCooked.update(delta, now)
})
- make light vary random for realism
- leave a mark on the wall
- multimaterialobject
- each object for a texture in a empty canvas
- draw in this canvas and update the texture
- laser with pointing leap