Skip to content

Instantly share code, notes, and snippets.

@bgolus
bgolus / CameraFacingBoxRaycast.shader
Created July 6, 2020 00:07
A "single triangle" cube shader. Really a shader that orients a flat mesh towards the camera and uses a box ray intersection to draw a cube in the interior.
Shader "Unlit/CameraFacingBoxRaycast"
{
Properties
{
_Cube ("Texture", Cube) = "" {}
_MeshScale ("Mesh Scale", Float) = 1.0
[Toggle] _DisableCameraFacing ("Disable Camera Facing", Float) = 0.0
}
SubShader
{
Shader "Custom/ACNH_SewingCloth"
{
Properties
{
[NoScaleOffset] _MainTex ("Albedo (RGB)", 2D) = "white" {}
[NoScaleOffset] _BumpMap ("Normal Map", 2D) = "bump" {}
[NoScaleOffset] _EdgeAlpha ("Alpha", 2D) = "white" {}
_Cutoff ("Alpha Test Cutoff", Range(0,1)) = 0.5
_Offset ("Offset (XY)", Vector) = (0,0,0,0)
@bgolus
bgolus / StereographicProjectionBubble.shader
Created February 28, 2020 06:33
Modifying UVs using stereographic projection to create the illusion of a sphere.
Shader "Unlit/StereographicProjectionBubble"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_PanSpeed ("Pan Speed", Float) = 0.1
_Spherify ("Spherify", Range(0,1)) = 1
}
SubShader
{
@bgolus
bgolus / HatchBlend6_DistanceAndFOVCorrected.shader
Created December 11, 2019 08:18
A modification of Kyle Halladay's Pencil Sketch Effect shader from his blog post here: http://kylehalladay.com/blog/tutorial/2017/02/21/Pencil-Sketch-Effect.html
// A modification of Kyle Halladay's Pencil Sketch Effect shader
// http://kylehalladay.com/blog/tutorial/2017/02/21/Pencil-Sketch-Effect.html
// Blends between two scales of hatching based on distance and camera fov to
// keep a perceptually constant hatching scale (assuming consistent mesh UVs).
Shader "Unlit/SingleObjectHatch_DistanceAndFOVCorrected"
{
Properties
{
@bgolus
bgolus / StableConstantTextureSize.shader
Created April 6, 2019 18:50
Visually stable constant screen space sized texture shader for Unity
Shader "Unlit/Stable Constant Texture Size"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100