Skip to content

Instantly share code, notes, and snippets.

View cmarangu's full-sized avatar
📚
studying

Chase Marangu cmarangu

📚
studying
View GitHub Profile
@devshgraphicsprogramming
devshgraphicsprogramming / bait.md
Created October 23, 2023 22:48
Don't even dream of reprojecting last frame depth for occlusion culling, you will fail!

Originally posted as a reply to: https://gist.github.com/reduz/c5769d0e705d8ab7ac187d63be0099b5

Turned into a gist due to high likelihood of deletion. Also edited down to not include irrelevant trolling as to be useful to someone else considering Depth Reprojection.

Yes I know SSR and Parallax Corrected Shadowmaps work, but the consequences of errors in those depth tests aren't as high.

Lack of Generality (oh the irony)

You yourself state that this is general purpose engine, how is a technique that will have trouble with:

  • deformables (cloth, vegetation, skinned meshes, etc.)
@companje
companje / map.glsl
Created January 23, 2018 22:46
map() function for GLSL known from Processing & openFrameworks
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
anonymous
anonymous / gist:7200880
Created October 28, 2013 17:20
Processing motion blur
/* passable motion blur effect using frame blending
* basically move your 'draw()' into 'sample()', time runs from 0 to 1
* by dave
* http://beesandbombs.tumblr.com
*/
int samplesPerFrame = 32; // more is better but slower. 32 is enough probably
int numFrames = 48;
float shutterAngle = 2.0; // this should be between 0 and 1 realistically. exaggerated for effect here
int[][] result;

Twitter abuses all media file uploads, each type in its own way. If we want to upload a good looking animation loop from some low-color, high-detail generative art, we have to game their system's mechanisms.

  • don't upload a video file, they will re-encode it into absolute 💩

  • create a GIF, which they will auto-convert into a video file 😱

  • The frames of the GIF will be resized to an even-sized width using an extremely naive algorithm. Your GIF should be an even size (1000, 2000,

@antiboredom
antiboredom / index.html
Created December 15, 2014 16:36
A simple example showing how to save animated gifs from p5.js sketches, using https://github.com/jnordberg/gif.js
<html>
<head>
<script src="gif.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.11/p5.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.11/addons/p5.dom.js"></script>
<script src="sketch.js"></script>
</head>
<body>
<p>First, allow camera access.<p><p>Then click once to start recording, and another time finish recording and make a gif.</p>
</body>
@jarble
jarble / generic_example.frag
Last active January 11, 2023 21:41
Generic programming in GLSL (parametric polymorphism, template metaprogramming) https://www.reddit.com/r/glsl/comments/mmxves/generic_programming_parametric_polymorphism/
//I wish there were a better way to do this!
#define func(type,name,param1,param2,body) type name(type param1,type param2) {body}
#define generic(name,param1,param2,body) func(float,name,param1,param2,body) func(vec2,name,param1,param2,body) func(vec3,name,param1,param2,body) func(vec4,name,param1,param2,body)
//define two "generic" functions using this macro
generic(add,a,b,
return a + b;
)
generic(sub,a,b,
@nixin72
nixin72 / against-online-proctoring.md
Last active June 15, 2021 06:14
Proctored exams will not be tolerated

Dear Concordia University,

I am writing to you on behalf of the Concordia student body regarding the final exams and the decision to use online proctoring. We are urging you to change your decision about having online proctored exams. For many, this is an appalling invasion of privacy, a security risk, a demand for students to trade their morals for a grade, and discrimination against the less fortunate among the student body. In addition, over 7000 thousand Concordia students are against online proctoring.

  1. An invasion of privacy Forcing cameras and microphones into the homes of students is a violation of everyone's online privacy. For some, this might not be a huge concern, but for many others it's spying on
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
int[][] result;
float t, c;
float ease(float p) {
@gregzanch
gregzanch / convert-base.ts
Created November 12, 2019 06:38
Base Conversion
function base_10_to_base_n(v: number,b: number,r:number[]=[]): number[]{
if(b==0) return;
if (Math.floor(v) != v || Math.floor(b) != b) return;
const div = Math.floor(v / b);
const rem = v - div * b
r.push(rem);
return div == 0 ? r.reverse() : base_10_to_base_n(div, b, r);
}
function base_n_to_base_10(val: number[], base: number) {
if (base == 0) return;
set theProcessName to "iOS Simulator"
set theWindowNumber to 1
tell application "System Events"
tell process theProcessName
activate
tell window theWindowNumber
set thePosition to position
set theSize to size
end tell