Skip to content

Instantly share code, notes, and snippets.

View alexanderameye's full-sized avatar
🦀
Learning

alexander ameye alexanderameye

🦀
Learning
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; }
@alexanderameye
alexanderameye / Outline.hlsl
Last active March 6, 2024 16:22
Outline shader
TEXTURE2D(_CameraColorTexture);
SAMPLER(sampler_CameraColorTexture);
float4 _CameraColorTexture_TexelSize;
TEXTURE2D(_CameraDepthTexture);
SAMPLER(sampler_CameraDepthTexture);
TEXTURE2D(_CameraDepthNormalsTexture);
SAMPLER(sampler_CameraDepthNormalsTexture);
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class OutlineFeature : ScriptableRendererFeature
{
class OutlinePass : ScriptableRenderPass
{
private RenderTargetIdentifier source { get; set; }
private RenderTargetHandle destination { get; set; }
@alexanderameye
alexanderameye / OutlineObject.hlsl
Created January 13, 2020 14:30
OutlineObject.hlsl
TEXTURE2D(_CameraDepthTexture);
SAMPLER(sampler_CameraDepthTexture);
float4 _CameraDepthTexture_TexelSize;
TEXTURE2D(_CameraDepthNormalsTexture);
SAMPLER(sampler_CameraDepthNormalsTexture);
float3 DecodeNormal(float4 enc)
{
float kScale = 1.7777;
@alexanderameye
alexanderameye / TemplatePass.cs
Last active August 8, 2023 17:24
URP 12 ScriptableRenderPass Template
// ScriptableRenderPass template created for URP 12 and Unity 2021.2
// Made by Alexander Ameye
// https://alexanderameye.github.io/
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class TemplatePass : ScriptableRenderPass
@alexanderameye
alexanderameye / TemplateFeature.cs
Last active July 19, 2023 10:29
URP 12 ScriptableRendererFeature Template
// ScriptableRendererFeature template created for URP 12 and Unity 2021.2
// Made by Alexander Ameye
// https://alexanderameye.github.io/
using UnityEngine;
using UnityEngine.Rendering.Universal;
public class TemplateFeature : ScriptableRendererFeature
{
[System.Serializable]
@alexanderameye
alexanderameye / Blur.shader
Last active May 25, 2023 08:49
Two-pass box blur shader
// Two-pass box blur shader created for URP 12 and Unity 2021.2
// Made by Alexander Ameye
// https://alexanderameye.github.io/
Shader "Hidden/Blur"
{
Properties
{
_MainTex ("Texture", 2D) = "white"
}
@alexanderameye
alexanderameye / VertexExtrusionFeature.cs
Created April 13, 2021 06:48
VertexExtrusionFeature.cs
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public enum ExtrusionMethod
{
ScaleObject,
ScaleObjectNormalized,
ExtrudeAlongNormal1,
@alexanderameye
alexanderameye / VertexExtrusionPass.cs
Created April 13, 2021 06:48
VertexExtrusionPass.cs
// DRAWING MODES
// OUTLINE ALWAYS: STENCIL NOTEQUAL, ZTEST ALWAYS
// HIDDEN SURFACES: STENCIL OFF, ZTEST GREATER, OUTLINE WIDTH 0
using System;
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
@alexanderameye
alexanderameye / VertexExtrusion.shader
Created April 13, 2021 06:49
VertexExtrusion.shader
Shader "Hidden/Vertex Extrusion"
{
Properties
{
_Color ("_Color", Color) = (1, 1, 1, 1)
_Width ("_Width", Float) = 1
_SrcBlend ("_SrcBlend", Int) = 0
_DstBlend ("_DstBlend", Int) = 0
}