Skip to content

Instantly share code, notes, and snippets.

@yumayanagisawa
yumayanagisawa / First.compute
Last active November 20, 2021 23:33
Unity | Compute Shader Particle System
#pragma kernel CSParticle
// Particle's data
struct Particle
{
float3 position;
float3 velocity;
float life;
};
@yumayanagisawa
yumayanagisawa / Artificial.shader
Created November 12, 2017 14:28
Unity | Fragment Shader Template
Shader "Custom/Artificial" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
@yumayanagisawa
yumayanagisawa / Procedural.shader
Created November 11, 2017 13:41
Shadertoy to Unity | Julia - Quaternion
// The code is based on the shader on Shadertoy(https://www.shadertoy.com/view/MsfGRr), and tweaked for use in Unity3D
// Original shader is...
// Created by inigo quilez - iq/2013
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Shader "Custom/Procedural" {
Properties
{
_MainTex("Texture", 2D) = "white" {}
@yumayanagisawa
yumayanagisawa / DrawStar.shader
Last active November 10, 2017 11:32
Star Fragment Shader | Shadertoy to Unity
Shader "Custom/DrawStar" {
SubShader
{
Pass
{
Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
LOD 100
ZWrite Off
@yumayanagisawa
yumayanagisawa / Interactive.shader
Last active November 7, 2017 09:53
Unity | Show/Hide texture, Mouse Input
Shader "Custom/Interactive" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
targetTexCoordx("targetTexCoordx", Range(0,1)) = 0.0
targetTexCoordy("targetTexCoordy", Range(0,1)) = 0.0
}
SubShader {
@yumayanagisawa
yumayanagisawa / swirl.shader
Created November 1, 2017 15:43
Unity | Swirl Shader
// Ref: http://www.geeks3d.com/20110428/shader-library-swirl-post-processing-filter-in-glsl/
// Swirl Effect for Unity
Shader "Custom/swirl" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
@yumayanagisawa
yumayanagisawa / aurora.shader
Last active January 31, 2023 19:36
Aurora Shader
//Code is converted to use in Unity(ShaderLab) from
//Auroras by nimitz 2017 (twitter: @stormoid)
//on Shadertoy(https://www.shadertoy.com/view/XtGGRt)
Shader "Aurora/aurora"
{
Properties
{
@yumayanagisawa
yumayanagisawa / TerrainGenerator.cs
Created October 19, 2017 08:06
Unity | Procedural Terrain
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TerrainGenerator : MonoBehaviour {
public int depth = 20;
public int width = 256;
public int height = 256;
@yumayanagisawa
yumayanagisawa / file0.cs
Created October 19, 2017 05:07
Unity | 逆さま(Upside down)に表示されるオブジェクトのMVPを変更(Matrix4x4) ref: http://qiita.com/ya7gisa0/items/b33c119081f4be867e6c
private Matrix4x4 q1; // identity
public void Update(Camera cam, Matrix4x4 m)
{
/*
some code...
*/
// matrix stuff
Matrix4x4 v = cam.worldToCameraMatrix;
@yumayanagisawa
yumayanagisawa / warp_shadertoy.shader
Last active August 27, 2021 02:20
Shadertoy to Unity (GLSL to HLSL)
Shader "Custom/warp_shadertoy" {
Properties{
/*
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
*/
}
SubShader{