Skip to content

Instantly share code, notes, and snippets.

View EricHu33's full-sized avatar

EricHu EricHu33

View GitHub Profile
@alexanderameye
alexanderameye / DepthNormalsFeature.cs
Created December 23, 2019 11:04
DepthNormalsFeature
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class DepthNormalsFeature : ScriptableRendererFeature
{
class DepthNormalsPass : ScriptableRenderPass
{
int kDepthBufferBits = 32;
private RenderTargetHandle depthAttachmentHandle { get; set; }
@totallyRonja
totallyRonja / MaterialGradientDrawer.cs
Last active September 26, 2023 09:46
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;
@Cyanilux
Cyanilux / UnlitDepthNormalsFeature.cs
Last active August 14, 2022 13:04
Renders Unlit Opaque objects into CameraNormalsTexture for SSAO Depth Normals mode
/*
Render Unlit Opaque objects into CameraNormalsTexture for SSAO Depth Normals mode.
If you need Alpha clipping or vertex displacement, you'll need to use Depth mode,
or edit the generated shader code to add in the DepthNormals pass instead.
This is meant as an alternative if you don't need those.
For depthNormalsMat, I'm using a blank PBR/Lit SG with passIndex set to 4 (corresponds to it's DepthNormals pass).
*/
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
Shader "URP/CustomLighting"
{
Properties
{
_BaseColor ("Base Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "UniversalMaterialType" = "SimpleLit" "IgnoreProjector" = "True" "ShaderModel" = "4.5" }