Skip to content

Instantly share code, notes, and snippets.

@ArieLeo
ArieLeo / Tricubic.cginc
Created February 16, 2022 14:38 — forked from Fewes/Tricubic.cginc
Tricubic texture sampling for Unity
/*--------------------------------------------------------------------------*\
Copyright (c) 2008-2009, Danny Ruijters. All rights reserved.
http://www.dannyruijters.nl/cubicinterpolation/
This file is part of CUDA Cubic B-Spline Interpolation (CI).
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
@ArieLeo
ArieLeo / RaindropTextureBomber.shader
Created January 20, 2022 10:59 — forked from unitycoder/RaindropTextureBomber.shader
Unity Texture Bombing (rain drops)
// https://forum.unity.com/threads/texture-bombing-lets-tackle-this-one.185724/#post-1278100
Shader "Annihlator/Raindrop TextureBomber" {
    Properties {
        _MainTex("Texture (RGB)", 2D) = "black" {}
        _BumpMap ("Normalmap", 2D) = "bump" {}
        _BombTex("Bomb Texture (RGB)", 2D) = "black" {}
        _RandomTex("Random Texture (RGB)", 2D) = "black" {}
        _Slider("Slider", Range(0,1)) = 1
        _Params("Params, Z = Scale",Vector) = (0.037, 0.119, 5, 0)
        _ReflectionTex ("Reflection", 2D) = "white" { TexGen ObjectLinear }
@ArieLeo
ArieLeo / AmbientOcclusionDirection.osl
Created January 15, 2022 13:36 — forked from simonbroggi/AmbientOcclusionDirection.osl
Calculates AO and the average direction where the ambient light came from.
/*
* Ambient Occlusion and Direction.
*
* Calculates AO and the average direction where the ambient light came from.
*
* Original AO code from https://github.com/sambler/osl-shaders/blob/master/ramps/BaAmbientOcclusion/BaAmbientOcclusion.osl
*
*/
void rng_seed(output int rng, int seed)
@ArieLeo
ArieLeo / GrabScreenFeature.cs
Created November 7, 2021 09:39 — forked from Refsa/GrabScreenFeature.cs
Unity URP custom grab pass
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class GrabScreenFeature : ScriptableRendererFeature
{
[System.Serializable]
public class Settings
@ArieLeo
ArieLeo / URPSimpleLit.shader
Created November 7, 2021 09:39 — forked from Refsa/URPSimpleLit.shader
Unity - Shader showing how to write a Simple Lit shader for Unity URP
Shader "Custom/URPSimpleLit"
{
Properties
{
_Color ("Color", Color) = (1,0,0,1)
}
SubShader
{
Tags {
"RenderPipeline" = "UniversalPipeline"
@ArieLeo
ArieLeo / BlurEffect.compute
Created November 7, 2021 09:38 — forked from Refsa/BlurEffect.compute
Unity URP custom render feature for UI Blur
#pragma kernel Downscale
#pragma kernel GaussianBlurVertical
#pragma kernel GaussianBlurHorizontal
#pragma kernel BoxBlur
Texture2D<float4> _Source;
RWTexture2D<float4> _Dest;
float _Amount;
float2 _Size;
@ArieLeo
ArieLeo / Usage.cs
Created November 7, 2021 09:38 — forked from Refsa/Usage.cs
DrawMeshInstancedIndirect with ShaderGraph and URP
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
class Render : MonoBehaviour
{
struct DrawData
{
public Vector3 Pos;
public Quaternion Rot;
@ArieLeo
ArieLeo / LICENSE
Created October 10, 2021 12:40 — forked from JohannesMP/LICENSE
[Unity3D] A Reliable, user-friendly way to reference SceneAssets by script.
/*******************************************************************************
* Don't Be a Jerk: The Open Source Software License.
* Adapted from: https://github.com/evantahler/Dont-be-a-Jerk
*******************************************************************************
* _I_ am the software author - JohannesMP on Github.
* _You_ are the user of this software. You might be a _we_, and that's OK!
*
* This is free, open source software. I will never charge you to use,
* license, or obtain this software. Doing so would make me a jerk.
*
@ArieLeo
ArieLeo / FlyCamera.cs
Created October 5, 2021 16:04 — forked from FreyaHolmer/FlyCamera.cs
A camera controller for easily flying around a scene in Unity smoothly. WASD for lateral movement, Space & Ctrl for vertical movement, Shift to move faster. Add this script to an existing camera, or an empty game object, hit play, and you're ready to go~
using UnityEngine;
[RequireComponent( typeof(Camera) )]
public class FlyCamera : MonoBehaviour {
public float acceleration = 50; // how fast you accelerate
public float accSprintMultiplier = 4; // how much faster you go when "sprinting"
public float lookSensitivity = 1; // mouse look sensitivity
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LabelDrawer : MonoBehaviour
{
struct Label3D
{
public readonly string text;
public readonly Vector3 position;