Skip to content

Instantly share code, notes, and snippets.

Avatar

ColinLeung-NiloCat ColinLeung-NiloCat

View GitHub Profile
@Refsa
Refsa / GrabScreenFeature.cs
Last active Nov 17, 2021
Unity URP custom grab pass
View GrabScreenFeature.cs
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class GrabScreenFeature : ScriptableRendererFeature
{
[System.Serializable]
public class Settings
View HiddenJumpFloodOutline.shader
Shader "Hidden/JumpFloodOutline"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "PreviewType" = "Plane" }
Cull Off ZWrite Off ZTest Always
@JimmyCushnie
JimmyCushnie / UnityGraphicsBullshit.cs
Last active Oct 9, 2021
Exposes some Unity URP graphics settings that are (for some stupid fucking bullshit reason) private.
View UnityGraphicsBullshit.cs
using System.Reflection;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using ShadowResolution = UnityEngine.Rendering.Universal.ShadowResolution;
/// <summary>
/// Enables getting/setting URP graphics settings properties that don't have built-in getters and setters.
@phi-lira
phi-lira / UnlitTexture.shader
Last active Nov 30, 2021
URP Unlit Texture example
View UnlitTexture.shader
Shader "Custom/UnlitTexture"
{
Properties
{
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1)
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {}
}
// Universal Render Pipeline subshader. If URP is installed this will be used.
SubShader
View DepthNormalsFeature.cs
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class DepthNormalsFeature : ScriptableRendererFeature
{
class DepthNormalsPass : ScriptableRenderPass
{
int kDepthBufferBits = 32;
private RenderTargetHandle depthAttachmentHandle { get; set; }
@CarlLee
CarlLee / Bloom.shader
Last active Nov 24, 2021
UE4 bloom for unity
View Bloom.shader
Shader "Hidden/Bloom"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
struct appdata
@phi-lira
phi-lira / FullScreenQuad.cs
Created Mar 19, 2019
LWRP FullScreenQuad feature example. This can be used to extend LWRP render to render a full screen quad.
View FullScreenQuad.cs
namespace UnityEngine.Rendering.LWRP
{
// A renderer feature contains data and logic to enqueue one or more render passes in the LWRP renderer.
// In order to add a render feature to a LWRP renderer, click on the renderer asset and then on the + icon in
// the renderer features list. LWRP uses reflection to list all renderer features in the project as available to be
// added as renderer features.
public class FullScreenQuad : ScriptableRendererFeature
{
[System.Serializable]
public struct FullScreenQuadSettings
View UnityShadersCheatSheet.shader
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)
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active Oct 10, 2021
UPM: How to make a custom package
View 1.md

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!