Skip to content

Instantly share code, notes, and snippets.

@darktable
darktable / WorldNormalFromDepthTexture.shader
Created November 11, 2023 18:00 — forked from bgolus/WorldNormalFromDepthTexture.shader
Different methods for getting World Normal from Depth Texture, without any external script dependencies.
Shader "WorldNormalFromDepthTexture"
{
Properties {
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@darktable
darktable / Loggers.cs
Created July 31, 2023 01:47 — forked from thygrrr/Loggers.cs
A zero-boilerplate static logger for Unity in 25 lines of code
//SPDX-License-Identifier: Unlicense OR CC0-1.0+
using System;
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
// ReSharper disable MemberCanBePrivate.Global
namespace Loggers
{
/// <summary>
@darktable
darktable / DoomGlow.cs
Created June 20, 2022 11:53 — forked from TiliSleepStealer/DoomGlow.cs
Doom glow - fake volumetric light glow effect in Unity by Tili_us
// This file is in the public domain. Where
// a public domain declaration is not recognized, you are granted
// a license to freely use, modify, and redistribute this file in
// any way you choose.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Unity remake of a fake volumetric light glow effect
@darktable
darktable / UnityGetNativeAndroidVersion
Created March 4, 2022 22:03 — forked from kibotu/UnityGetNativeAndroidVersion
Get versionCode and versionName with unity.
//int vesioncode = context().getPackageManager().getPackageInfo(context().getPackageName(), 0).versionCode;
public static int GetVersionCode() {
AndroidJavaClass contextCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject context = contextCls.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject packageMngr = context.Call<AndroidJavaObject>("getPackageManager");
string packageName = context.Call<string>("getPackageName");
AndroidJavaObject packageInfo = packageMngr.Call<AndroidJavaObject>("getPackageInfo", packageName, 0);
return packageInfo.Get<int>("versionCode");
}
@darktable
darktable / MaterialGradientDrawer.cs
Created October 20, 2021 17:44 — forked from totallyRonja/MaterialGradientDrawer.cs
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;
using System;
using System.IO;
using System.Runtime.CompilerServices;
using UnityEditor;
using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// Hierarchy Window Group Header
/// http://diegogiacomelli.com.br/unitytips-changing-the-style-of-the-hierarchy-window-group-header/
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
# import threading
class WebSocketsHandler(SocketServer.StreamRequestHandler):
@darktable
darktable / ProjectAssetPostprocessor.cs
Created April 20, 2012 03:37 — forked from hoesing/ProjectAssetPostprocessor.cs
Unity asset pre/postprocessor for applying asset defaults by path.
// Drop this script in the Editor directory in your project (creating the Editor directory if it's not there yet)
// Then re-import the assets in the directories covered by this script (right click and reimport)
//
// I would replace my path checking with the path checking from this gist:
// https://gist.github.com/1842177
//
// The texture settings for icons might want to use some of his settings combined with mine as well
using UnityEngine;