-
-
Save nbriz/ab18e9862ee9a4c1badc to your computer and use it in GitHub Desktop.
render your scene in ascii, for threejs_playGnd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ------------------- INSTRUCTIONS ----- | |
to render your scene as 'ASCII' | |
you must first add this AsciiEffect file to your HTML page | |
add the following tag belelow the Detector.js script | |
which is on line 16 | |
-------------------------------------- */ | |
<script src="http://brangerbriz.net/labs/threejs_playGnd/js/AsciiEffect.js"></script> | |
/* -------------------------------------- | |
then in your setup() function, | |
replace 'render.setsize(W, H);' | |
and 'document.body.appendChild( renderer.domElement );' | |
with the code below | |
-------------------------------------- */ | |
effect = new THREE.AsciiEffect( renderer ); | |
effect.setSize( W, H ); | |
document.body.appendChild( effect.domElement ); | |
/* -------------------------------------- | |
then in your draw() funcion | |
replace 'renderer.render( scene, camera );' | |
with the code below | |
-------------------------------------- */ | |
effect.render( scene, camera ); | |
/* -------------------------------------- | |
NOTE: make sure you have lights in your scene | |
NOTE: make sure that your mesh is using either | |
Lambert or Phong material | |
(otherwise you wont see any definition) | |
-------------------------------------- */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment