Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.
brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
#define sectorize(value) step(0.0, (value))*2.0-1.0 | |
#define sum(value) dot(clamp((value), 1.0, 1.0), (value)) | |
#define PI 3.141592653589793 | |
vec2 normalToUvRectOct(vec3 normal){ | |
normal /= sum(abs(normal)); | |
if(normal.y > 0.0){ | |
return normal.xz*0.5+0.5; | |
} | |
else{ |
THREE.TransformationShader = { | |
defines: {}, | |
uniforms: { | |
"tDiffuse": { type: "t", value: texture }, | |
"opacity": { type: "f", value: 1.0 }, | |
"translationX": { type: "f", value: 1.0 }, | |
"translationY": { type: "f", value: 1.0 }, | |
"translationZ": { type: "f", value: 1.0 }, | |
"scaleX": { type: "f", value: 1.0 }, |
// Uses getUserMedia to record audio from microphone, compresses it to mp3, and throws it away. | |
// You should change the last step to e.g. pushing the audio to a server over a WebSocket. | |
// This script uses lame.js for mp3 encoding | |
// https://github.com/zhuker/lamejs | |
var audioDataCallback = function(encodedData, originalData) { | |
console.log("Encoded " + encodedData.byteLength + " bytes. Original: " + originalData.byteLength); | |
}; |
// FXAA 3.11 implementation by NVIDIA (github.com/NVIDIAGameWorks/GraphicsSamples) | |
// Ported to WebGL by Agost Biro (github.com/abiro) | |
//---------------------------------------------------------------------------------- | |
// File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag | |
// SDK Version: v3.00 | |
// Email: [email protected] | |
// Site: http://developer.nvidia.com/ | |
// | |
// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. |
/* | |
** Copyright (c) 2012, Romain Dura [email protected] | |
** | |
** Permission to use, copy, modify, and/or distribute this software for any | |
** purpose with or without fee is hereby granted, provided that the above | |
** copyright notice and this permission notice appear in all copies. | |
** | |
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
// There's always some fiddling because the GLTF exports a whole scene | |
// with root bone and skinned mesh already appended to it. | |
let gltf = loadedGltf; | |
let skinned; | |
gltf.scene.traverse(function(object) { | |
if (object instanceof THREE.SkinnedMesh) { | |
skinned = object; | |
} | |
}) |
var cameraZ = camera.position.z; | |
var planeZ = 5; | |
var distance = cameraZ - planeZ; | |
var aspect = viewWidth / viewHeight; | |
var vFov = camera.fov * Math.PI / 180; | |
var planeHeightAtDistance = 2 * Math.tan(vFov / 2) * distance; | |
var planeWidthAtDistance = planeHeightAtDistance * aspect; | |
// or |