I've wanted to do this for a while…
I'm sure there are more efficient ways of implementing a rotating ASCII sphere, but for this demo I just used three.js to render a textured sphere and mapped that to an ASCII-palette.
<div id="output"></div> |
function init() { | |
window.WIDTH = 48; | |
window.HEIGHT = 48; | |
window.scene = new THREE.Scene(); | |
window.camera = new THREE.PerspectiveCamera( | |
1, | |
WIDTH / HEIGHT, | |
0.1, | |
1000 | |
); | |
window.renderer = new THREE.WebGLRenderer({ | |
alpha: true, | |
antialias: true | |
}); | |
//scene.background = new THREE.Color( 0xffffff ); | |
renderer.setSize(WIDTH, HEIGHT); | |
var texture = new THREE.TextureLoader().load('data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAyAAD/7gAOQWRvYmUAZMAAAAAB/9sAhAAIBgYGBgYIBgYIDAgHCAwOCggICg4QDQ0ODQ0QEQwODQ0ODBEPEhMUExIPGBgaGhgYIyIiIiMnJycnJycnJycnAQkICAkKCQsJCQsOCw0LDhEODg4OERMNDQ4NDRMYEQ8PDw8RGBYXFBQUFxYaGhgYGhohISAhIScnJycnJycnJyf/wAARCADIAZADASIAAhEBAxEB/8QAhAAAAQUBAQEAAAAAAAAAAAAAAAECAwQFBgcIAQEAAAAAAAAAAAAAAAAAAAAAEAACAQMDAQYEBAQDBQYGAwABAgMAEQQhEgUxQVFhIhMGcYEyFJGhUgexQiMVwWJy0YIzQyTw4cJTFhfxkqKy0iWzw1URAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AOy2jtBppCX0B/Gr6Ywc+a/zp5wRpb59tBmeX9J+ZpP93860mwu0afKkGIAbkX8BQZuv6aLN+m1avogaAWFJ6QJ0NBmBfh+dLsbw+VXnx76hfnSJjNezaCgpmF+3+NHp95qdsnjEf0/VuwsCVDMBfvZRtH401poQd0a3gH15O9PTX42YmgYIl/VTxCp/n/KmzySQsCixOliSWlCdOtiQRpUUmTJJjj0ZAgLASTRFJjGTeysFP50FoQf5ifk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An2h/XakOI36qKKBDhN+r8DSriyL0P50UUDhFKOtz86UI/6TRRQOCd4Ip+xT2EfGiigX0Yj9Sg/GmNhwMdwOxul1t0+d6KKBkWF6F/SyJV69HsNfDpVpGyU6ZbnwY3oooP/Z'); | |
var geometry = new THREE.SphereGeometry( 3, 64, 48 ); | |
var material = new THREE.MeshStandardMaterial( { | |
color: 0xffffff, | |
emissive: 0x000000, | |
roughness: 1, | |
metalness: 1, | |
map: texture | |
} ); | |
window.globe = new THREE.Mesh( geometry, material ); | |
window.globe.rotation.z = Math.PI; | |
window.globe.rotation.y = 1.5; | |
scene.add( globe ); | |
var light = new THREE.PointLight( 0xffffff, 3.33, 0 ); | |
light.position.set( 150, -150, 1500 ); | |
scene.add( light ); | |
var light2 = new THREE.PointLight(0xffffff, 2, 0); | |
light2.position.set(-125, 100, -500); | |
scene.add(light2); | |
camera.position.z = 345; | |
document.body.appendChild(renderer.domElement); | |
window.gl = window.renderer.context; | |
window.pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); | |
render(); | |
} | |
document.addEventListener("DOMContentLoaded", init); | |
var once = 0; | |
window.outputEl = document.getElementById("output"); | |
//window.ASCII = " ·:-+=*€%#@" //.split("").reverse().join("") | |
window.ASCII = " ·—+=##"; | |
function render() { | |
requestAnimationFrame(render); | |
window.globe.rotation.y -= 0.01; | |
window.renderer.render(window.scene, window.camera); | |
window.gl.readPixels(0, 0, window.WIDTH, window.HEIGHT, gl.RGBA, gl.UNSIGNED_BYTE, pixels) | |
var text = grayscale10(window.pixels).map(asciify).join(""); | |
text = text.split("\n").map(reverseString).join("\n"); | |
window.outputEl.innerHTML = text; | |
} | |
function reverseString(str) { | |
return str.split("").reverse().join(""); | |
} | |
function grayscale10(pixels) { | |
var length = pixels.length; | |
var gsPixels = []; | |
for (var i = 0; i < length; i += 4) { | |
gsPixels.push( | |
Math.floor( | |
(pixels[i] + | |
pixels[i+1] + | |
pixels[i+2]) / | |
768 * window.ASCII.length | |
) | |
); | |
} | |
return gsPixels; | |
} | |
function asciify (val, index) { | |
var br = ""; | |
if( | |
index !== 0 && // exclude first row | |
index % window.WIDTH === 0 | |
) { | |
br = "\n"; | |
} | |
return br + window.ASCII[val]; | |
} |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/84/three.min.js"></script> |
* { | |
box-sizing: border-box; | |
} | |
body { | |
background-image: radial-gradient( | |
circle, | |
#000 25vmin, | |
#024 100vmax | |
); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
min-height: 100vh; | |
} | |
#output { | |
background-image: radial-gradient( | |
circle farthest-corner at 75% 75%, | |
rgba(0,0,16,1) 0%, | |
rgba(0,16,32,1) 50%, | |
rgba(0,64,48,1) 100% | |
); | |
border-radius: 100%; | |
color: rgb(32, 220, 128); | |
font-family: "Inconsolata", monospace; | |
font-size: 3vmin; | |
line-height: .55em; | |
text-rendering: optimizeSpeed; | |
will-change: contents; | |
white-space: pre; | |
} | |
canvas { | |
display: none; | |
} |