Skip to content

Instantly share code, notes, and snippets.

View hammanandre's full-sized avatar

Andre Hamman hammanandre

View GitHub Profile
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
using System;
using System.Text.RegularExpressions;
using System.Linq;
// Original code by PlayItSafe_Fries
@billw2012
billw2012 / PBR_ZeroAttenuation.hlsl
Last active September 29, 2022 22:52
Remove point light attenuation in URP
// Drop this into a custom Shader Graph node, then output it to Unlit master Color and Alpha.
// If you want the point light to also behave as a directional light then instead of passing
// the Vertex world position pass the last column of the model Transformation matrix (Transformation node)
// instead.
// NOTE: this function removes GI feature entirely, as it wasn't necessary for my purpose.
void PBR_ZeroAttenuation_half(half3 Albedo,
half Metallic,
half3 Specular,
half Smoothness,
half3 Emission,
@smkplus
smkplus / UniversalPipelineTemplateShader.shader
Created September 9, 2020 15:51 — forked from phi-lira/UniversalPipelineTemplateShader.shader
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
@abstractalgo
abstractalgo / proxy-deployment-ubuntu-18.04-tutorial.md
Created January 26, 2020 23:39
A complete walkthrough on setting up hosting for a web app and a deployment pipeline.

This is a complete walkthrough on setting up hosting for a web app and a deployment pipeline. Some things can be imporoved, but this can be used as well.

Our app is monolithic JS app: React frontend, Express backend, managed by yarn. PM2 process manager. Database is out of scope currently, but some notes will be added later. We use nginx as reverse proxy. We will set up SSL via "Let's Encrypt" for free.

All this is hosted on DigitalOcean (that can also be changed). In DigitalOcean's terms, we will setup two droplets (i.e. two machines) that will be used for staging and production. We also added a space (object storage) that is used to store large files (this is out of scope and doesn't change any portion of this setup).

We will use Github and Github Actions to hook into events that happen within our code repository.

The flow is as follows: once this setup is complete, our repo will have activated actions. On each push to the dev branch - newest version of that branch will be pulled and transfered into a

@gcatlin
gcatlin / sdl-metal-example.m
Last active February 24, 2025 15:11
Minimal C SDL2 Metal example
//
// cc sdl-metal-example.m `sdl2-config --cflags --libs` -framework Metal -framework QuartzCore && ./a.out
//
#include <SDL.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
int main (int argc, char *args[])
{
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal");
// This one is tied up with JMO toon shading, so I can't just past the shader :/
half _SmushMinZ;
half _SmushXYOffset;
half4 _SmushCenterPos;
half4 initWorldPos;
// Vert
o.initWorldPos = worldPos;
half dist = _SmushMinZ - o.initWorldPos.z;
if(worldPos.z < _SmushMinZ)
import { google } from 'googleapis';
/*******************/
/** CONFIGURATION **/
/*******************/
const googleConfig = {
clientId: process.env.GOOGLE_CLIENT_ID, // e.g. asdfghjkljhgfdsghjk.apps.googleusercontent.com
clientSecret: process.env.GOOGLE_CLIENT_SECRET, // e.g. _ASDFA%DFASDFASDFASD#FAD-
redirect: process.env.GOOGLE_REDIRECT_URL, // this must match your google api settings
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@LotteMakesStuff
LotteMakesStuff / EditorCoroutineRunner.cs
Last active August 28, 2024 19:09
Run stuff in the editor with all the convenience of co-routines! Add a status UI super easily to see readouts what your long running code is actually doing! nice~ There is a short API demo at the top of the class. This is a prefect companion for my inspector buttons https://gist.github.com/LotteMakesStuff/dd785ff49b2a5048bb60333a6a125187
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class EditorCoroutineRunner
{
[MenuItem("Window/Lotte's Coroutine Runner: Demo")]
@LotteMakesStuff
LotteMakesStuff / HighlightAttribute.cs
Last active January 23, 2025 01:55
Having trouble finding the right property on a component cos theres just so many identical looking fields? Add some color to you inspectors! mark important property with a bright color so it always stands out, or supply a validation function so highlights show on values that would effect the current ingame logic!
// NOTE DONT put in an editor folder
using UnityEngine;
public class HighlightAttribute : PropertyAttribute
{
public HighlightColor Color;
public string ValidateMethod;
public object Value;