Skip to content

Instantly share code, notes, and snippets.

View kchapelier's full-sized avatar
💬
On hiatus

Kevin Chapelier kchapelier

💬
On hiatus
View GitHub Profile
@kchapelier
kchapelier / nefertiti-smooth.json
Last active March 24, 2017 11:36
Smooth low-poly version of The Other Nefertiti. Original version : http://nefertitihack.alloversky.com/
{
"indices":[0,1,2,3,4,5,3,5,6,4,7,8,9,10,11,12,13,14,14,15,16,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,56,59,60,61,62,63,50,64,63,65,66,67,68,67,69,68,70,71,72,65,73,68,74,75,76,73,77,78,78,77,79,80,81,82,83,84,85,86,87,88,85,84,89,90,91,92,93,82,86,93,86,94,95,96,97,98,99,100,96,101,102,97,102,103,104,105,106,107,108,109,108,107,110,88,87,111,112,106,113,114,115,116,117,87,118,119,120,118,110,109,111,111,121,110,122,113,110,123,116,124,122,125,126,127,128,129,121,111,130,131,132,133,127,134,128,135,122,136,13,137,15,108,88,109,122,126,136,124,131,133,124,133,138,139,140,125,141,135,136,134,138,142,128,134,142,130,117,143,144,145,125,133,146,147,148,130,143,147,146,149,125,150,151,121,152,140,151,144,125,151,145,144,153,146,132,146,154,149,150,155,156,157,145,151,158,159,160,161,162,163,163,162,164,157,151,150,153,165,166,167,168,16,163,169,170,171,172,173,163,164,169,174,175,152,155,176,177,178,175,176,171,179,169,1
@kchapelier
kchapelier / scraper.js
Created April 28, 2017 10:06
Unicode blocks scraped from Wikipedia as a JSON
// executed directly on https://en.wikipedia.org/wiki/Unicode_block
var planes = [],
blocks = [],
plane,
pos;
var planesFirstLine = document.querySelectorAll('#collapsibleTable3 tr:nth-of-type(3) th');
var planesSecondLine = document.querySelectorAll('#collapsibleTable3 tr:nth-of-type(5) th');
@kchapelier
kchapelier / unexif.js
Last active April 28, 2017 12:15
UnEXIF: UnProtect Your Work!
/***
Undoing the hacks of https://www.exif.co/ with unsophisticated javascript.
As an artist, the best way to protect your work is to approach sharing technologies and third party services with a healthy dose of scepticism and to always clearly specify the license under which your work is made available on the Internet.
***/
// click on an image served by exif.co to replace it with a canvas containing the full image
document.body.addEventListener('click', function (e) {
if(e.target.parentNode && e.target.parentNode.classList.contains('js-exif-image')) {
var element = e.target.parentNode,
@kchapelier
kchapelier / things-to-read.md
Last active November 2, 2021 19:53
Things to read / public bookmarks
@kchapelier
kchapelier / merge-three-buffer-geometries.js
Last active September 11, 2018 22:04
Merge indexed and non-indexed THREE.BufferGeometry into a new indexed THREE.BufferGeometry. All missing uniforms are set to 0.
/**
* Combine indexed and non-indexed BufferGeometry into a new indexed BufferGeometry. All missing uniforms are set to 0.
* @param {array} geometries Array of THREE.BufferGeometry instances
* @returns {BufferGeometry}
*/
function mergeBufferGeometries (geometries) {
var indexLength = 0,
verticesLength = 0,
attributesInfos = {},
geometriesInfos = [],
@kchapelier
kchapelier / gaussianKernel1d.js
Created June 18, 2017 09:07
1D gaussian kernel
// based on https://warpycode.wordpress.com/2009/04/13/computing-a-1d-gaussian-kernel/
// see http://www.stat.wisc.edu/~mchung/teaching/MIA/reading/diffusion.gaussian.kernel.pdf.pdf for more info
var gaussianKernel1d = (function () {
var sqr2pi = Math.sqrt(2 * Math.PI);
return function gaussianKernel1d (size, sigma) {
"use strict";
// ensure size is even and prepare variables
@kchapelier
kchapelier / randomThetaPhi.js
Last active June 25, 2017 18:19
Uniform distribution on a sphere
//Return random directions, spherical angle pairs theta [0,PI) and phi [0,TWO_PI), distributed uniformly over a sphere
//Pairs generated with theta=random(PI) and phi=random(TWO_PI) have a higher density around the poles.
//See spherical coordinates: https://en.wikipedia.org/wiki/Spherical_coordinate_system
//Optimalization by Dan Gries
//https://pastebin.com/7uPYaA8G
function randomThetaPhi () {
"use strict";
@kchapelier
kchapelier / sources.txt
Created August 6, 2017 19:16
3D models sources
http://graphics.stanford.edu/data/3Dscanrep/
https://www.cc.gatech.edu/projects/large_models/
https://gumroad.com/l/xAQxj
https://www.myminifactory.com/scantheworld/
https://sketchfab.com/britishmuseum
http://lincoln3dscans.co.uk/
@kchapelier
kchapelier / notes.md
Last active October 23, 2017 07:04
Lighting technique notes
@kchapelier
kchapelier / test.json
Last active October 31, 2018 17:10
Test gist for gist retrieval in ajax
{
"version": 1,
"board": {
"position": [
-312,
-130
]
},
"nodes": {
"5FFEB054540A02AA692B2137ED72A17": {