Skip to content

Instantly share code, notes, and snippets.

@HAliss
HAliss / BezierTest.cs
Created July 25, 2022 09:16
Bezier visualization script for grass blade generation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteAlways]
public class BezierTest : MonoBehaviour {
public int numOfPoints;
public float height = 1;
// Each #kernel tells which function to compile; you can have many kernels
#pragma kernel GrassGeneration
struct InputData {
float3 position;
float3 normal;
float3 tangent;
};
struct IndirectArgs {
//Shader imported from https://docs.chaosgroup.com/display/OSLShaders/Thin+Film+Shader
Shader "Custom/ThinFilmIridescence" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
[Normal]_Normal("Normal", 2D) = "bump" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_ThicknessMin("ThicknessMin", float) = 250
_ThicknessMax("ThicknessMax", float) = 400
@HAliss
HAliss / CurveDissolve.shader
Last active June 7, 2022 17:26
Creates a monochromatic texture with color values from a given animation curve
Shader "Custom/CurveDissolve"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Noise("Noise", 2D) = "white" {}
_CurveTexture("Curve texture", 2D) = "white" {}
_Cutoff("Cutoff", Range(0,1)) = 0
_Glossiness ("Smoothness", Range(0,1)) = 0.5
"Sampler2D" : {
"prefix": "sampl",
"body": [
"$1(\"$2\", 2D) = \"white\" {}",
"sampler2D $1;"
],
"description": "Makes a sampler2D property"
},
"Float" : {
@HAliss
HAliss / ShaderTextureCombiner.cs
Created March 6, 2019 10:25
Texture combiner tool that uses a shader to combine different textures to specific color channels.
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
public class ShaderTextureCombiner : EditorWindow {
//Input textures
@HAliss
HAliss / TextureCombiner.cs
Last active January 8, 2023 21:08
Texture combiner for Unity 3D
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
public class TextureCombiner : EditorWindow {
//Input textures
private Texture2D[] textures = new Texture2D[4];