Skip to content

Instantly share code, notes, and snippets.

View keenanwoodall's full-sized avatar
🛠️
Making stuff!

Keenan Woodall keenanwoodall

🛠️
Making stuff!
View GitHub Profile
@SorenSaket
SorenSaket / main.odin
Last active September 23, 2024 06:31
GLFW, OpenGL Window Tutorial in Odin language
// GLFW and OpenGL example with very verbose comments and links to documentation for learning
// By Soren Saket
// semi-colons ; are not requied in odin
//
// Every Odin script belongs to a package
// Define the package with the package [packageName] statement
// The main package name is reserved for the program entry point package
// You cannot have two different packages in the same directory
@bgolus
bgolus / MobileVRHighlight.shader
Last active October 25, 2023 01:44
A mobile VR and MSAA friendly single object highlight shader using the stencil buffer
Shader "Mobile VR Highlight" {
Properties {
_ColorOutline ("Outline", Color) = (1,1,1,1)
_ColorInterior ("Interior", Color) = (0.25,0.25,0.25,0.25)
_ColorInteriorFaded ("Interior Faded", Color) = (0.1,0.1,0.1,0.1)
_ColorInteriorOcc ("Interior Occluded", Color) = (0.15,0.15,0.15,0.15)
_ColorInteriorOccFaded ("Interior Occluded Faded", Color) = (0.05,0.05,0.05,0.05)
_PulseRateMod ("Pulse Rate Modifier", Float) = 4.0
_OutlneWidth ("Outline Pixel Width", Float) = 1.0
}
@Fewes
Fewes / Tricubic.cginc
Last active May 7, 2024 07:16
Tricubic texture sampling using 8 trilinear samples
#ifndef TRICUBIC_INCLUDED
#define TRICUBIC_INCLUDED
float4 Cubic(float v)
{
float4 n = float4(1.0, 2.0, 3.0, 4.0) - v;
float4 s = n * n * n;
float x = s.x;
float y = s.y - 4.0 * s.x;
float z = s.z - 4.0 * s.y + 6.0 * s.x;
@Kryzarel
Kryzarel / EasingFunctions.cs
Last active November 8, 2024 17:23
C# Easing Functions
using System;
namespace Kryz.Tweening
{
// Made with the help of this great post: https://joshondesign.com/2013/03/01/improvedEasingEquations
// --------------------------------- Other Related Links --------------------------------------------------------------------
// Original equations, bad formulation: https://github.com/danro/jquery-easing/blob/master/jquery.easing.js
// A few equations, very simplified: https://gist.github.com/gre/1650294
// Easings.net equations, simplified: https://github.com/ai/easings.net/blob/master/src/easings/easingsFunctions.ts
@pixelsnafu
pixelsnafu / CloudsResources.md
Last active October 20, 2024 03:34
Useful Resources for Rendering Volumetric Clouds

Volumetric Clouds Resources List

  1. A. Schneider, "Real-Time Volumetric Cloudscapes," in GPU Pro 7: Advanced Rendering Techniques, 2016, pp. 97-127. (Follow up presentations here, and here.)

  2. S. Hillaire, "Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite" in Physically Based Shading in Theory and Practice course, SIGGRAPH 2016. [video] [course notes] [scatter integral shadertoy]

  3. [R. Högfeldt, "Convincing Cloud Rendering – An Implementation of Real-Time Dynamic Volumetric Clouds in Frostbite"](https://odr.chalmers.se/hand

@mandarinx
mandarinx / CoordsRadius.cs
Created October 31, 2019 09:12
Spatial partitioning
using UnityEngine;
namespace TerrorSquid.Collisions {
public static class CoordsRadius1 {
public static readonly Vector3[] coords = {
new Vector3(-1, -1, -1).normalized,
new Vector3(0, -1, -1).normalized,
new Vector3(1, -1, -1).normalized,
new Vector3(-1, -1, 0).normalized,
@FreyaHolmer
FreyaHolmer / LengthTable.cs
Created August 21, 2019 02:18
Béziér curve utility class for converting a t value to percentage of distance along the spline
using UnityEngine;
public class LengthTable {
public float[] distances;
int SmpCount => distances.Length;
float TotalLength => distances[SmpCount - 1];
public LengthTable( OrientedCubicBezier3D bezier, int precision = 16 ) {
distances = new float[precision];
@TheAllenChou
TheAllenChou / Seek.cs
Last active August 26, 2019 10:15
Value Seeking
// example of how to move a current value towards a target value at a constant speed
// without going over the target value
// formula is the same for vectors of any dimension
Vector3 Seek(Vector3 currentValue, Vector3 targetValue, float maxSpeed, float dt)
{
// delta/difference from current value to target value
Vector3 delta = targetValue - currentValue;
// don't take the square root of magnitude yet
// so we can potentially early out on degenerate case of currenvValue ~= targetValue
@playatwork
playatwork / SimplexNoise3Node.cs
Last active October 26, 2020 17:08
Simplex noise custom node for Shader Graph
//
// Simplex noise custom node for Shader Graph
//
// Original work (webgl-noise) Copyright (C) 2011 Ashima Arts.
// Translation and modification was made by Keijiro Takahashi.
// Ported to Shader Graph by Sergio L. Valladares
//
// This shader is based on the webgl-noise GLSL shader. For further details
// of the original shader, please see the following description from the
// original source code.
@LotteMakesStuff
LotteMakesStuff / NativeMeshTest.cs
Created August 8, 2018 00:30
[NativeCollections] How to copy a regular .C# array into a NativeArray suuuuuper quick using memcpy. its about as fast as its ever gunna get!
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class NativeMeshTest : MonoBehaviour
{
private NativeArray<float3> vertexBuffer;
private Vector3[] vertexArray;