Skip to content

Instantly share code, notes, and snippets.

@bgolus
bgolus / InfiniteGrid.shader
Last active November 20, 2024 01:20
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)
Shader "Pillow/PillowEquirectDepth" {
Properties{
_MainTex("Texture", 2D) = "white" {}
_Depth("Depth", 2D) = "white" {}
_Scale("Depth Multiplier", float) = 1
_Min("Min Depth Cutoff", float) = 1000
_Max("Max Depth Cutoff", float) = 100
_DisplacementBias("Displacement Bias", float) = 0.01
_PoleBoost("Pole Boost", float) = 1
}
// ==UserScript==
// @name Gitbook
// @match https://docs.openbrush.app/*
// @description Adds edit link to gitbook pages on https://docs.openbrush.app/
// @version 0.1
// @match https://www.tampermonkey.net/index.php?version=4.13.6136&ext=fire&updated=true
// @icon https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant none
// ==/UserScript==
@totallyRonja
totallyRonja / MaterialGradientDrawer.cs
Last active March 31, 2025 13:38
A Material Property Drawer for the [Gradient] attribute which lets you edit gradients and adds them to the shader as textures. More information here: https://twitter.com/totallyRonja/status/1368704187580682240
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
public class MaterialGradientDrawer : MaterialPropertyDrawer {
private int resolution;
@GlorifiedPig
GlorifiedPig / CLRConversions.cs
Last active September 8, 2024 18:32
MoonSharp Vectors
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Table, typeof(Vector3),
dynVal => {
Table table = dynVal.Table;
float x = (float)table.Get("x").CastToNumber();
float y = (float)table.Get("y").CastToNumber();
float z = (float)table.Get("z").CastToNumber();
return new Vector3(x, y, z);
}
);
Script.GlobalOptions.CustomConverters.SetClrToScriptCustomConversion<Vector3>(
// <copyright file="UpdateShaderGraphAssemblyInfo.cs" company="BovineLabs">
// Copyright (c) BovineLabs. All rights reserved.
// </copyright>
namespace BovineLabs.Vision.Editor.ShaderGraph
{
using System;
using System.IO;
using System.Linq;
using UnityEditor;
/*
LICENSE
The code is provided under the MIT License which is basically just to provide myself some basic legal security.
I definitely ALLOW you to use it in your own sofware (even commercial ones) without attributing me.
But I totally DISALLOW to sell the NonConvexMeshCollider itself (or any derivative work) if you sell it as a solution for 'Non-Convex Mesh Colliding'.
Also please dont repost the code somewhere else withour my approval, place a link to this page instead.
The point is that I don't want anybody to just rip or modify my algorithm and sell it on the unity asset store or anywhere else!
If (ever) anybody should be allowed to sell this algorithm for what it is, it should be me, don't you think? ;)
Anyhow: if you want to use it to provide non-convex mesh colliding in your own unity project, even if its a commercial one, go ahead and enjoy. :)
@NicholasSheehan
NicholasSheehan / TextToTextMeshPro.cs
Last active March 4, 2025 16:54
Convert Unity Text Component to Text Mesh Pro Component
using TMPro;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
namespace NicholasSheehan
{
//Place in an editor folder
class TextToTextMeshPro : MonoBehaviour
{
@elringus
elringus / RenderMyCustomPass.cs
Last active September 27, 2024 03:44
Example for adding custom render passes via renderer features for lightweight render pipeline (LWRP)
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.LWRP;
// Inheriting from `ScriptableRendererFeature` will add it to the
// `Renderer Features` list of the custom LWRP renderer data asset.
public class RenderMyCustomPass : ScriptableRendererFeature
{
private class MyCustomPass : ScriptableRenderPass
{
"Sampler2D" : {
"prefix": "sampl",
"body": [
"$1(\"$2\", 2D) = \"white\" {}",
"sampler2D $1;"
],
"description": "Makes a sampler2D property"
},
"Float" : {