Skip to content

Instantly share code, notes, and snippets.

View OwenMagelssen's full-sized avatar

Owen Magelssen OwenMagelssen

View GitHub Profile
Shader "Custom/Cook-Torrance" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Normal Map", 2D) = "bump" {}
_Metallic("Metallic", Range(0,1)) = 0.5
_MetallicTex("Metallic", 2D) = "white" {}
_Roughness("Roughness", Range(0.000000001,1)) = 0.5
_RoughnessTex("Roughness", 2D) = "white" {}
_Fresnel("Fresnel Value", Float) = 0.028
@nothke
nothke / Draw.cs
Last active January 20, 2024 06:58
///
/// Draw lines at runtime
/// by Nothke
/// unlicensed, aka do whatever you want with it
/// made during Stugan 2016 :)
/// ..(it's midnight, and Robbie clicks A LOT, LOUDLY!)
///
/// Important:
/// - Should be called in OnPostRender() (after everything else has been drawn)
/// therefore the script that calls it must be attached to the camera
@TarasOsiris
TarasOsiris / DumpEditorTextures.cs
Last active February 15, 2023 10:07
Dump all Unity3d Editor GUI skin textures as images
using UnityEngine;
using System.IO;
using UnityEditor;
public static class DumpEditorTextures
{
const string AssetsFolder = "Assets";
const string TexturesDestFolderNamePro = "TexturesPro";
const string TexturesDestFolderNameNormal = "TexturesNormal";
static readonly string TexturesDestPathPro = Path.Combine(AssetsFolder, TexturesDestFolderNamePro);
@andreibosco
andreibosco / creative-cloud-disable.md
Last active June 26, 2024 09:36
disable creative cloud startup on mac
@dhilowitz
dhilowitz / wavecuepoint.c
Last active April 29, 2023 22:01 — forked from jimmcgowan/wavecuepoint.c
This code reads a .wav file and a text file containing marker locations (specified as frame indexes, one per line) and creates a new .wav file with embedded cue points for each location. The code is standard, portable C.
//
// wavecuepoint.c
// Created by Jim McGowan on 29/11/12.
// Turned into command-line utility by David Hilowitz on 19/11/16.
// jim@bleepsandpops.com
// jim@malkinware.com
//
// This function reads a .wav file and a text file containing marker locations (specified as frame indexes, one per line)
// and creates a new .wav file with embedded cue points for each location. The code is standard, portable C.
//
@tomkail
tomkail / ExtendedScriptableObjectDrawer.cs
Last active July 1, 2024 03:14
Displays the fields of a ScriptableObject in the inspector
// Developed by Tom Kail at Inkle
// Released under the MIT Licence as held at https://opensource.org/licenses/MIT
// Must be placed within a folder named "Editor"
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active June 15, 2024 02:13
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// 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
@mattatz
mattatz / Matrix.hlsl
Last active July 2, 2024 13:45
Matrix operations for HLSL
#ifndef __MATRIX_INCLUDED__
#define __MATRIX_INCLUDED__
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
float4x4 inverse(float4x4 m) {
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0];
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1];
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2];
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3];
@simonbroggi
simonbroggi / MainLightNode.hlsl
Last active May 14, 2024 14:09
Unity Shadergraph custom function node for main light data
#ifndef MAINLIGHT_INCLUDED
#define MAINLIGHT_INCLUDED
void GetMainLightData_float(out half3 direction, out half3 color, out half distanceAttenuation, out half shadowAttenuation)
{
#ifdef SHADERGRAPH_PREVIEW
// In Shader Graph Preview we will assume a default light direction and white color
direction = half3(-0.3, -0.8, 0.6);
color = half3(1, 1, 1);
distanceAttenuation = 1.0;
@Ragueel
Ragueel / Mesh Helper C#
Created August 17, 2020 07:37
For subdividing meshes in Unity
public class MeshHelper
{
static List<Vector3> vertices;
static List<Vector3> normals;
// [... all other vertex data arrays you need]
static List<int> indices;
static Dictionary<uint, int> newVectices;