Skip to content

Instantly share code, notes, and snippets.

@nbriz
Last active March 26, 2019 03:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbriz/ab18e9862ee9a4c1badc to your computer and use it in GitHub Desktop.
Save nbriz/ab18e9862ee9a4c1badc to your computer and use it in GitHub Desktop.
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