Create a gist now

Instantly share code, notes, and snippets.

@nbriz /asciiEffect.js Secret
Last active Dec 18, 2015

What would you like to do?
render your scene in ascii, for threejs_playGnd
/* ------------------- 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