Skip to content

Instantly share code, notes, and snippets.

@T5impact
T5impact / AtmosphericScattering.shader
Last active February 22, 2024 11:51
Atmospheric Scattering Shader for Unity that works in the URP (feel free to use this in any projects) (default settings are tailored towards an earth-like atmosphere)
Shader "Atmosphere/Atmospheric Scattering"
{
Properties
{
_LightIntensity("Light Intensity", Float) = 30
_LightColor("Light Color", Color) = (1,1,1)
_LightDirection("Light Direction", Vector) = (0,0,1)
_PlanetRadius("Planet Radius", Float) = 47
_AtmosphereRadius("Atmosphere Radius", Float) = 50
_Steps ("Steps", Int) = 20
@Marsgames
Marsgames / ICanRewind.cs
Last active November 5, 2020 21:40
A simple system to rewind time like in Prince of Persia
// Source : https://www.twitch.tv/videos/519292916?filter=all&sort=time
#region Author
/////////////////////////////////////////
// RAPHAËL DAUMAS --> ICanRewind
// https://raphdaumas.wixsite.com/portfolio
// https://github.com/Marsgames
/////////////////////////////////////////
#endregion
public interface ICanRewind
@smkplus
smkplus / SimpleInkPaint.shader
Created April 18, 2019 18:13
Unity Simple Ink Paint Shader
Shader "Unlit/SimpleInkPaint"
{
Properties{
_MainTex("MainTex", 2D) = "white" // メインテクスチャ
_Brush("Brush", 2D) = "white" // ブラシテクスチャ
_BrushScale("BrushScale", FLOAT) = 0.1 // ブラシサイズ
_ControlColor("ControlColor", VECTOR) = (0, 0, 0, 0) // ブラシの色
_PaintUV("Hit UV Position", VECTOR) = (0, 0, 0, 0) // ブラシで塗りたい位置
}
@runewake2
runewake2 / CrackedEarthShader.shader
Created April 18, 2018 03:38
Hacked together triplanar shader for custom particle effect in https://youtu.be/FGTpz3O8PnQ
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
Shader "Custom/CrackedEarthShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_TriPlanarScale ("Triplanar Scale", Float) = 5
_EmissionStrength ("Emission", Float) = 1
@CKShare
CKShare / ITimeControl.cs
Created March 29, 2018 01:17
오브젝트별 타임스케일 적용
public interface ITimeControl
{
void Initialize();
void AdjustTimeScale(float timeScale);
}
using UnityEngine;
using Vectrosity;
using System.Collections.Generic;
using UnityEngine.UI;
using System.IO;
using System.Collections;
using UnityEngine.SceneManagement;
public class DrawingView : MonoBehaviour {
public Text _Console;
@rtlsilva
rtlsilva / TimeKeeper.cs
Created May 3, 2016 04:51
Unity3D scripts that keep track of multiple independent time layers, each with its own time scale and all updated from a single timer. This allows, for example, to simultaneously have multiple entities operating at a sped up/slowed down rate and being frozen in time by simply changing their TimeLayer in the Inspector.
using System.Collections;
using System.Diagnostics;
using UnityEngine;
public enum TimeLayer {
//Unity's time
GameTime,
//Custom time layer for UI
MenuTime,
//Unity's unscaled time
@Naphier
Naphier / SimpleCSVDebug.cs
Created November 19, 2015 03:11
Simple class to log output to file for debugging.
using System.IO;
using System;
using System.Text;
public class SimpleCSVDebug
{
string GetPathFile()
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string file = "output.csv";
@stramit
stramit / UnityMethodValidator.cs
Last active June 10, 2019 16:16
Unity Method Validator
//Enable this if you want it to work in NUNIT, see the test example at the bottom
//#define UNIT_TESTING
/**
*
* https://i.imgur.com/GoH9rkv.png
*
* One of the frustrating things about Unity is that there are a spate of magic methods that can be
* called from the runtime. They do not have an interface defined, which by itself is pretty frustrating,
* but it can allow some valid c# that is bad Unity mojo. Consider a private 'OnEnable' function unity
@rje
rje / gist:11408219
Created April 29, 2014 18:27
audio spectrum code
using UnityEngine;
using System.Collections;
/// <summary>
/// A class for taking spectrum data & calculating the volume of various frequency bands.
///
/// Notes:
/// This doesn't do any smoothing, so wherever you leverage these values you'll probably want to do something.
/// In my project I immediately jump to any higher value, and then have it decay over time at a fixed rate.
/// </summary>