Skip to content

Instantly share code, notes, and snippets.

#extension GL_EXT_shader_texture_lod : enable
uniform samplerCube uRadianceMap;
uniform samplerCube uIrradianceMap;
#define saturate(x) clamp(x, 0.0, 1.0)
#define PI 3.1415926535897932384626433832795
const float A = 0.15;
@shadercoder
shadercoder / scattering.glsl
Created December 17, 2015 13:41 — forked from geofftnz/scattering.glsl
Rewritten atmospheric scattering shader
/*
@geofftnz
Just mucking around with some fake scattering.
Trying to come up with a nice-looking raymarched solution for atmospheric
scattering out to the edge of the atmosphere, plus a fast non-iterative version
for nearer the viewer.
Some code pinched from here: http://glsl.heroku.com/e#17563.3
and here: http://codeflow.org/entries/2011/apr/13/advanced-webgl-part-2-sky-rendering/
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active July 18, 2025 09:10
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);
@msg555
msg555 / 3dhull.cpp
Last active April 1, 2023 17:39
3D Convex Hull
#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cassert>
using namespace std;
@sixtenbe
sixtenbe / analytic_wfm.py
Last active June 20, 2025 10:21 — forked from endolith/peakdet.m
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@endolith
endolith / peakdet.m
Last active June 9, 2025 16:41
Peak detection in Python [Eli Billauer]
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.