Skip to content

Instantly share code, notes, and snippets.

View patriciogonzalezvivo's full-sized avatar

Patricio Gonzalez Vivo patriciogonzalezvivo

View GitHub Profile
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active April 25, 2024 12:16
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@patriciogonzalezvivo
patriciogonzalezvivo / PythonSetup.md
Created October 7, 2014 23:17
How to install Python correctly on Mac OSX

Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Add PATH to ~/.bash_profile and ~/.zshrc

export PATH=/usr/local/bin:$PATH
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Math.md
Last active April 15, 2024 20:34
GLSL Math functions

Trigonometry

const float PI = 3.1415926535897932384626433832795;
const float PI_2 = 1.57079632679489661923;
const float PI_4 = 0.785398163397448309616;

float PHI = (1.0+sqrtf(5.0))/2.0;
@patriciogonzalezvivo
patriciogonzalezvivo / include.py
Last active January 14, 2024 23:38
Resolve includes for GLSL, HLSL and metal on Python
import re
from os.path import join, abspath, dirname, basename
def load_source( folder: str, filename: str, dependencies = []):
path = abspath( join(folder, filename) )
if path in dependencies:
return ""
else:
dependencies.append( path )
@patriciogonzalezvivo
patriciogonzalezvivo / SFM.md
Last active January 10, 2024 12:29
SfM Tools

Probably the most straight forward way to start generating Point Clouds from a set of pictures.

VisualSFM is a GUI application for 3D reconstruction using structure from motion (SFM). The reconstruction system integrates several of my previous projects: SIFT on GPU(SiftGPU), Multicore Bundle Adjustment, and Towards Linear-time Incremental Structure from Motion. VisualSFM runs fast by exploiting multicore parallelism for feature detection, feature matching, and bundle adjustment.

For dense reconstruction, this program supports Yasutaka Furukawa's PMVS/CMVS tool chain, and can prepare data for Michal Jancosek's CMP-MVS. In addition, the output of VisualSFM is natively supported by Mathias Rothermel and Konrad Wenzel's [SURE]

@patriciogonzalezvivo
patriciogonzalezvivo / Tri-planar.md
Created July 1, 2014 19:28
GLSL Triplanar Texture Mapping
// Great example of the use of Lygia samplers functions https://github.com/patriciogonzalezvivo/lygia/tree/main/sample
// and GlslViewer https://github.com/patriciogonzalezvivo/glslViewer
// on the Looking Glass Display
#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D u_buffer0;
uniform sampler2D u_buffer1;
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Lights.md
Last active November 16, 2022 01:46
GLSL Shaders Lights Funtions
@patriciogonzalezvivo
patriciogonzalezvivo / toGif.sh
Created February 12, 2017 14:57
Frag Shader to gif
#!/bin/bash
SHADER=$1
SEC=$1
COUNTER=0
for i in `seq -w 0.01 .031 $SEC`; do
echo $i
`glslViewer $SHADER -s $i -o frame-$COUNTER.png`
let COUNTER=COUNTER+1
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-color.md
Last active August 29, 2022 15:54
GLSL color functions

RGB - YUB

mat3 yuv2rgb = mat3(1.0, 0.0, 1.28033, 1.0, -0.21482, -0.38059, 1.0, 2.12798, 0.0);
mat3 rgb2yuv = mat3(0.2126, 0.7152, 0.0722, -0.09991, -0.33609, 0.43600, 0.615, -0.5586, -0.05639);

RGB - HSV