Skip to content

Instantly share code, notes, and snippets.

View gsimone's full-sized avatar
🏠
Working from home

Gianmarco gsimone

🏠
Working from home
View GitHub Profile
//MIT License
//Copyright (c) 2021 Felix Westin
//Source: https://github.com/Fewes/MinimalAtmosphere
//Ported to GLSL by Marcin Ignac
#ifndef ATMOSPHERE_INCLUDED
#define ATMOSPHERE_INCLUDED
// -------------------------------------
@abesmon
abesmon / FakeLiquid.frag
Last active April 28, 2021 08:10
Fake Liquid shader made in GLSL to run in TouchDesigner. Though, can be ported painlessly to any other engines/languages :) It also supports shaking, but some external script should provide wobble angles :)
uniform vec3 uLine;
uniform vec4 uLiquidColor;
uniform float uLineHeight;
uniform float uFrenelPow;
in Vert {
vec3 objectPoint;
vec3 normalForCam;
} iVert;
/**
original code https://gist.github.com/Dan-Piker/f7d790b3967d41bff8b0291f4cf7bd9e
need to declare the following:
uniform vec3 origin;
uniform float p;
uniform float q;
uniform float t;
*/
@raysan5
raysan5 / custom_game_engines_small_study.md
Last active October 24, 2024 16:16
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active October 24, 2024 18:10
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@sketchpunk
sketchpunk / catenary.js
Last active January 19, 2023 06:26
Catenary Curve for 2D / 3D in Javascript
// How to increment using the slope and offset comes from tasaboia's example but did not have a solution for A
// But found a way to calc for A from a ruby Wire Tool plugin, but it's incrementing did not work as well as tasaboia
// So mixing the two results in a good implementation of the Catenary Curve. All Credit belongs to those two developers.
// All I did is mash the code together and fixed / optimized it - SketchpunkLabs
// https://github.com/tasaboia/Procedural-Rope-Generator/blob/master/Assets/CatenaryTeste/Scripts/Catenary.cs
// http://rhin.crai.archi.fr/rld/plugin_details.php?id=990
function catenary(a, x){ return a * Math.cosh( x / a ); }
catenary.MAX_TRIES = 100;
catenary.getA = function(vecLen, maxLen){

Generating Procedural Game Worlds with Wave Function Collapse

Wave Function Collapse (WFC) by @exutumno is a new algorithm that can generate procedural patterns from a sample image. It's especially exciting for game designers, letting us draw our ideas instead of hand coding them. We'll take a look at the kinds of output WFC can produce and the meaning of the algorithm's parameters. Then we'll walk through setting up WFC in javascript and the Unity game engine.

sprites

The traditional approach to this sort of output is to hand code algorithms that generate features, and combine them to alter your game map. For example you could sprinkle some trees at random coordinates, draw roads with a brownian motion, and add rooms with a Binary Space Partition. This is powerful but time consuming, and your original vision can someti

@rocketraman
rocketraman / .gitconfig
Last active November 7, 2024 21:42
.gitconfig aliases useful for gitworkflow (https://github.com/rocketraman/gitworkflow)
[alias]
# Basically `log --oneline --decorate --graph` with different colors and some additional info (author and date)
lg = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)'
# lg (see above) with --first-parent
lgp = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)' --first-parent
# https://stackoverflow.com/questions/61510067/show-specific-commits-in-git-log-in-context-of-other-commits
hl = "!f() { cd -- ${GIT_PREFIX:-.}; grep --color -E \"$(git log --pretty=%h \"$@\" | tr '\n' '|')\" || true; }; f"
hlp = "!f() { cd -- ${GIT_PREFIX:-.}; less -R -p $(git log --pretty=%h \"$@\" | tr '\n' '|'); }; f"
@mattdesl
mattdesl / IceMaterial.js
Last active May 17, 2024 09:48
fast subsurface scattering in ThreeJS PBR material — see "TRANSLUCENCY" in the frag shader
const glslify = require('glslify');
const path = require('path');
const assign = require('object-assign');
const defined = require('defined');
// This is the original source, we will copy + paste it for our own GLSL
// const vertexShader = THREE.ShaderChunk.meshphysical_vert;
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag;
// Our custom shaders
@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent