Skip to content

Instantly share code, notes, and snippets.

View goshki's full-sized avatar
👨‍💻
Such development, much coding. 😵‍💫

@goshki goshki

👨‍💻
Such development, much coding. 😵‍💫
View GitHub Profile
@brihernandez
brihernandez / Bayer4x4.hlsl
Last active March 24, 2026 11:39
Bayer 4x4 dithering shader for use with Unity's FullscreenRenderPassFeature. This is meant to be plugged into a simple Shader Graph Custom Function node which takes in raw screen position and the URP sample buffer. Also includes 2x2 and 8x8 Bayer matrices in case you want to try those out.
inline half3 GammaToLinearSpace (half3 sRGB)
{
// Approximate version from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1
return sRGB * (sRGB * (sRGB * 0.305306011h + 0.682171111h) + 0.012522878h);
}
inline half3 LinearToGammaSpace (half3 linRGB)
{
linRGB = max(linRGB, half3(0.h, 0.h, 0.h));
// An almost-perfect approximation from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1
@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)
@antonkudin
antonkudin / pipeGenerator.cs
Created September 26, 2023 13:48
Generates pipe mesh from mesh segments
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class pipeGenerator : MonoBehaviour
{
[SerializeField] Mesh straightMesh;
[SerializeField] Mesh elbowMesh;
[Space]
[SerializeField] Vector3[] pathPoints;
@runevision
runevision / Unity versions not affected by Unity Runtime Fee.md
Created September 14, 2023 09:45
Unity versions not affected by Unity Runtime Fee

Unity versions not affected by Unity Runtime Fee

This is information that has been dug up by me and others in the Unity community. It's not official information from Unity (but most of the linked resources are). It is also not legal advise. I am not a lawyer.

TLDR:

Contrary to what Unity themselves are saying, for games made with these Unity versions, developers can elect not to be affected by a newer version of the Terms of Service that introduces the Unity Runtime Fee:

  • Unity 2022.x or earlier
  • Unity 2021.x LTS or earlier
@BrianAmadori
BrianAmadori / OutlineShader.shader
Last active August 7, 2023 22:46
Screen buffer based depth outline shader
//
// Screen space based depth outline. No post processing setup needed.
//
// - Enable Depth Buffer on URP settings.
// - Put any geometry with this shader (like a Quad) in front of geometry.
// - Voila.
//
// This shader is based on the work of Mirza Beig.
// https://github.com/MirzaBeig/Post-Processing-Wireframe-Outlines
//
@synasius
synasius / SerializableId.cs
Last active April 10, 2023 20:07
UI Toolkit Serializable Id
using System;
using UnityEngine;
/// <summary>
/// A generic serializable GUID.
/// </summary>
[Serializable]
public struct SerializableId<T> : IComparable<SerializableId<T>>, IEquatable<SerializableId<T>>, ISerializationCallbackReceiver
{
[SerializeField] private string _guid;
@shanecelis
shanecelis / DebugOnce.cs
Last active October 21, 2021 08:59
DebugOnce.Log() logs only once from each source code location.
/* Original code[1] Copyright (c) 2021 Shane Celis[2]
Licensed under the MIT License[3]
This comment generated by code-cite[4].
[1]: https://gist.github.com/shanecelis/549ee612b67b13620cd0f9c95e34c853
[2]: https://twitter.com/shanecelis
[3]: https://opensource.org/licenses/MIT
[4]: https://github.com/shanecelis/code-cite
*/
@LotteMakesStuff
LotteMakesStuff / Flicker.cs
Created June 16, 2021 04:49
Quake/Halflife style light flicker
using UnityEngine;
public class Flicker : MonoBehaviour
{
public string LightStyle = "mmamammmmammamamaaamammma";
private Light light;
public float loopTime = 2f;
[SerializeField]
private int currentIndex = 0;
@MaZyGer
MaZyGer / EditorModeOnly
Last active October 28, 2025 10:53
The default EditorOnly of Unity Engine will only remove objects from standalone player and not in the editor. EditorModeOnly will remove also objects if you start playmode in the editor. Its really nice for things such as UI List tests, to remove the list in play mode. You can remove or change the namespace if you want. Drop it in an Editor fold…
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
namespace Maz.Unity.EditorExtensions
{
[InitializeOnLoad]
public class EditorModeOnly
{