This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DebugUtil | |
{ | |
public static void DumpRenderTexture(RenderTexture rt, string pngOutPath) | |
{ | |
var oldRT = RenderTexture.active; | |
var tex = new Texture2D(rt.width, rt.height); | |
RenderTexture.active = rt; | |
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @creator: Slipp Douglas Thompson | |
/// @license: Public Domain per The Unlicense. See <http://unlicense.org/>. | |
/// @purpose: A UnityEngine.UI.Graphic subclass that provides only raycast targeting, skipping all drawing. | |
/// @why: Because this functionality should be built-into Unity. | |
/// @usage: Add a `NonDrawingGraphic` component to the GameObject you want clickable, but without its own image/graphics. | |
/// @intended project path: Assets/Plugins/UnityEngine UI Extensions/NonDrawingGraphic.cs | |
/// @interwebsouce: https://gist.github.com/capnslipp/349c18283f2fea316369 | |
using UnityEngine; | |
using UnityEngine.UI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When creating shaders for Universal 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 necessarily match perfomance of the built-in URP Lit shader. | |
// This shader works with URP 7.1.x and above | |
Shader "Universal Render Pipeline/Custom/Physically Based Example" | |
{ | |
Properties | |
{ | |
// Specular vs Metallic workflow | |
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class MeshBlit : MonoBehaviour | |
{ | |
public RenderTexture rt; | |
public Mesh mesh; | |
public Material material; | |
public Vector3 meshPosition = new Vector3(0.5f, 0.5f, -1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
public static class ObjectPreviewer | |
{ | |
struct Node | |
{ | |
public Matrix4x4 transform; | |
public Mesh mesh; | |
public Material[] mats; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
using Object = UnityEngine.Object; | |
public class MaterialGradientDrawer : MaterialPropertyDrawer { | |
private int resolution; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Mobile VR Highlight" { | |
Properties { | |
_ColorOutline ("Outline", Color) = (1,1,1,1) | |
_ColorInterior ("Interior", Color) = (0.25,0.25,0.25,0.25) | |
_ColorInteriorFaded ("Interior Faded", Color) = (0.1,0.1,0.1,0.1) | |
_ColorInteriorOcc ("Interior Occluded", Color) = (0.15,0.15,0.15,0.15) | |
_ColorInteriorOccFaded ("Interior Occluded Faded", Color) = (0.05,0.05,0.05,0.05) | |
_PulseRateMod ("Pulse Rate Modifier", Float) = 4.0 | |
_OutlneWidth ("Outline Pixel Width", Float) = 1.0 | |
} |