Skip to content

Instantly share code, notes, and snippets.

@totallyRonja
totallyRonja / MovingParticleContext.cs
Last active December 25, 2022 07:53
This script allows you to display movement of particle systems without them moving for tweaking them in the editor. This script is CC0, but I'd be happy if you credit me as Ronja(https://twitter.com/totallyRonja) and maybe give me some money for what I do (https://www.patreon.com/RonjaTutorials) (https://ko-fi.com/ronjatutorials)
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.EditorTools;
// Tagging a class with the EditorTool attribute and no target type registers a global tool. Global tools are valid for any selection, and are accessible through the top left toolbar in the editor.
[EditorTool("Moving Particle Context")]
@totallyRonja
totallyRonja / oklab.hlslinc
Created March 24, 2021 13:47
OkLab color conversion functions for hlsl
static const float3x3 lrgb2cone = {
0.412165612, 0.211859107, 0.0883097947,
0.536275208, 0.6807189584, 0.2818474174,
0.0514575653, 0.107406579, 0.6302613616,
};
static const float3x3 cone2lab = {
+0.2104542553, +1.9779984951, +0.0259040371,
+0.7936177850, -2.4285922050, +0.7827717662,
+0.0040720468, +0.4505937099, -0.8086757660,
@totallyRonja
totallyRonja / MaterialGradientDrawer.cs
Last active November 13, 2024 11:51
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;