Skip to content

Instantly share code, notes, and snippets.

@FreyaHolmer
FreyaHolmer / GpuPrinter.cginc
Last active February 17, 2026 17:42
A unity shader .cginc to draw numbers in the fragment shader - see the first comment below for example usage!
///////////////////////////////////////////////////////////////////////////////
// ABOUT: A unity Shader .cginc to draw numbers in the fragment shader
// AUTHOR: Freya Holmér
// LICENSE: Use for whatever, commercial or otherwise!
// Don't hold me liable for issues though
// But pls credit me if it works super well <3
// LIMITATIONS: There's some precision loss beyond 3 decimal places
// CONTRIBUTORS: yes please! if you know a more precise way to get
// decimal digits then pls lemme know!
// GetDecimalSymbolAt() could use some more love/precision
@bgolus
bgolus / InfiniteGrid.shader
Last active March 6, 2026 03:17
Infinite Grid shader with procedural grid with configurable divisions and major and minor lines markings.
Shader "Unlit/InfiniteGrid"
{
Properties
{
[Toggle] _WorldUV ("Use World Space UV", Float) = 1.0
_GridScale ("Grid Scale", Float) = 1.0
_GridBias ("Grid Bias", Float) = 0.5
_GridDiv ("Grid Divisions", Float) = 10.0
_BaseColor ("Base Color", Color) = (0,0,0,1)
_LineColor ("Line Color", Color) = (1,1,1,1)
@h3r2tic
h3r2tic / raymarch.hlsl
Last active March 19, 2026 00:49
Depth buffer raymarching for contact shadows, SSGI, SSR, etc.
// Copyright (c) 2023 Tomasz Stachowiak
//
// This contribution is dual licensed under EITHER OF
//
// Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
// MIT license (http://opensource.org/licenses/MIT)
//
// at your option.
#include "/inc/frame_constants.hlsl"
@tgfrerer
tgfrerer / README.md
Last active January 14, 2026 21:24
Generate bitonic merge sort network based on number of sortable items n, and workgroup size.

This command-line utility generates a bitonic merge sort network based on number of sortable items n, and workgroup size.

Choose workgroup size to be ==n for an ideal sorting network. Number of sortable elements n must be power of two.

In-depth discussion, GPU implementation, and context for this code: https://poniesandlight.co.uk/reflect/bitonic_merge_sort/