Skip to content

Instantly share code, notes, and snippets.

View KenneyNL's full-sized avatar

Kenney KenneyNL

View GitHub Profile
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Unlit/Directional Tint"
{
Properties
{
_MainTex("MainTex", 2D) = "white" {}
_Color("Color", Color) = (1,1,1,1)
_ColorA("ColorA", Color) = (1,1,1,1)
_ColorB("ColorB", Color) = (1,1,1,1)

Creating a Mac build with permissions set on Windows

In order for Mac users to be able to open a build created on Windows (using Unity) some permissions will have to be set. If you create a ZIP archive of your build you'll lose permissions. Instead;

  1. Download or purchase MobaXTerm XServer; https://mobaxterm.mobatek.net/download.html
  2. Install and open, click on 'Start local terminal'
  3. Type 'cd ' and drag the folder of your project into the terminal, press enter.
  4. Type; chmod -x [your app name].app, press enter.
  5. Type; chmod 777 [your app name].app, press enter.
  6. (Optional) Type ls -l to check if the permissions were set, it should look something like drwxrwxrwx.
Shader "Custom/Grass Geometry Shader" {
Properties{
[NoScaleOffset] _MainTex("Grass A", 2D) = "white" {}
[NoScaleOffset] _GrassTwo("Grass B", 2D) = "white" {}
_Splat("Splat", 2D) = "white" {}
_Cutoff("Cutoff", Range(0,1)) = 0.25
@KenneyNL
KenneyNL / CircularMenu.cs
Last active June 23, 2022 19:41
Circular menu sample code for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CircularMenu : MonoBehaviour{
public float radius = 100.0f;
public float offset = 0.0f;
void Start(){
Shader "Unlit/Billboard"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "DisableBatching" = "True" }
Shader "Custom/Billboard" {
Properties{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
}
Texture2D[] layers;
Texture2D compiledTexture = new Texture2D(layers[0].width, layers[0].height);
foreach(Texture2D layer in layers){
Color[] baseColors = compiledTexture.GetPixels();
Color[] layerColors = layer.GetPixels();
for(int p = 0; p < baseColors.Length; p++){
@KenneyNL
KenneyNL / applyColorPalette.as
Created April 1, 2018 01:18
Flash ActionScript 3.0 apply color palette to BitmapData
var colorPalette = [0xFF5a3921, 0xFF6b8c42, 0xFF7bc67b, 0xFFffffb5];
function applyPalette(bitmap:BitmapData, palette:Array){
bitmap.lock();
for(var x = 0; x < bitmap.width; x++){
for(var y = 0; y < bitmap.height; y++){
var pixel = bitmap.getPixel(x, y);
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.Collections.Generic;
using System.IO;
// Scene selection
// Shader created with Shader Forge v1.38
// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
// Note: Manually altering this data may prevent you from opening it in Shader Forge
/*SF_DATA;ver:1.38;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,cgin:,lico:1,lgpr:1,limd:1,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,imps:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,atcv:False,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:2,rntp:3,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:1,fgcg:1,fgcb:1,fgca:1,fgde:0.01,fgrn:5,fgrf:15,stcl:False,atwp:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False,fsmp:False;n:type:ShaderForge.SFN_Final,id:4904,x:33076,y:32617,varname:node_4904,prsc:2|diff-5996-OUT,clip-8651-A;n:type:ShaderForge.SFN_Color,id:848,x:32