Skip to content

Instantly share code, notes, and snippets.

@EIZENHORN91
EIZENHORN91 / PhysicallyBasedExample.shader
Created October 12, 2018 07:41 — forked from phi-lira/PhysicallyBasedExample.shader
Physically Based Example shader that works with Lightweight Render Pipeline (LWRP) 4.X.X-preview
// When creating shaders for Lightweight Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not match perfomance of the built-in LWRP Lit shader.
// This shader works with LWRP 4.X.X preview version
Shader "Lightweight Render Pipeline/4.0.0-preview/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@EIZENHORN91
EIZENHORN91 / AutohookAttribute.cs
Created April 7, 2019 15:41 — forked from LotteMakesStuff/AutohookAttribute.cs
[Autohook] property drawer for unity - Add this [Autohook] attribute to a property to and the inspector will automagically hook up a valid reference for you if it can find a component attached to the same game object that matches the field you put it on. You can watch a demo of this in action here https://youtu.be/faVt09NGzws <3
// NOTE DONT put in an editor folder!
using UnityEngine;
public class AutohookAttribute : PropertyAttribute
{
}
@EIZENHORN91
EIZENHORN91 / TrafficLightAttribute.cs
Created April 7, 2019 15:44 — forked from LotteMakesStuff/TrafficLightAttribute.cs
TrafficLight control/layout/property drawer: Adds a new editor control that draws lil Traffic Lights in the inspector. its really useful for visualizing state. For example, checkboxes can be hard to read at a glace, but a Red or Green status light is easy! Recommend you use the attached package, as it has all the icon image files.
// Non Editor code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class TrafficLightAttribute : PropertyAttribute
{
public bool DrawLabel = true;
public string CustomLabel;
public bool AlsoDrawDefault;

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"
@EIZENHORN91
EIZENHORN91 / LightweightPipelineTemplateShader.shader
Created November 26, 2019 14:49 — forked from phi-lira/UniversalPipelineTemplateShader.shader
Template shader to use as guide to create Lightweight Pipeline ready shaders. This shader works with LWRP 5.7.2 and above.
// When creating shaders for Lightweight Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not match perfomance of the built-in LWRP Lit shader.
// This shader works with LWRP 5.7.2 version and above
Shader "Lightweight Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@EIZENHORN91
EIZENHORN91 / UnlitTexture.shader
Created April 28, 2020 10:05 — forked from phi-lira/UnlitTexture.shader
URP Unlit Texture example
Shader "Universal Render Pipeline/Custom/UnlitTexture"
{
Properties
{
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1)
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {}
}
SubShader
{
@EIZENHORN91
EIZENHORN91 / UnlitTexture.shader
Created April 28, 2020 10:05 — forked from phi-lira/UnlitTexture.shader
URP Unlit Texture example
Shader "Universal Render Pipeline/Custom/UnlitTexture"
{
Properties
{
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1)
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {}
}
SubShader
{
@EIZENHORN91
EIZENHORN91 / gist:feb002ae3f3b8fd42e2d0bcb26c84d86
Created September 10, 2020 15:58 — forked from DuncanF/gist:353509dd397ea5f292fa52d1b9b5133d
Unity lockless (no GPU readback) marching cubes via Graphics.DrawProceduralIndirect - some slight faffing because compute shader must append full triangle (3 verts) at a time to render correctly, but this means the appendbuffer count is 3 times smaller than it needs to be, so we have to invoke a very short compute shader (FixupIndirectArgs) just…
MarchingCubesGPU.cs:
...
// DrawProceduralIndirect
ComputeBuffer argsBuffer;
[StructLayout(LayoutKind.Sequential)]
struct DrawCallArgBuffer
{
public const int size =
sizeof(int) +
sizeof(int) +
@EIZENHORN91
EIZENHORN91 / WorldNormalFromDepthTexture.shader
Created April 19, 2021 10:43 — 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
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)