Skip to content

Instantly share code, notes, and snippets.

View supertask's full-sized avatar
🏖️
Chilling

Tasuku TAKAHASHI supertask

🏖️
Chilling
View GitHub Profile
@supertask
supertask / Texture2DPNGExporter.cs
Created November 10, 2023 18:46
Texture2DPNGExporter for MetaTex
using UnityEngine;
using UnityEditor;
using System.IO;
public class Texture2DPNGExporter : MonoBehaviour
{
[MenuItem("Assets/Export Selected Textures to PNG")]
public static void SaveTexturesToPNG()
{
foreach (Object selectedObject in Selection.objects)
@supertask
supertask / OSCReceiver.pde
Created October 30, 2023 08:19
OSC Receiver by Processing
import oscP5.*;
import netP5.*;
OscP5 oscP5;
void setup() {
size(400, 400);
frameRate(25);
int port = 7474;
@supertask
supertask / ShowFloatInShader.hlsl
Created July 5, 2023 17:27
ShowFloatInShader
float3 ShowFloat(float2 uv, float val, int digits){
int a[210] =
{
1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,0,1,1,1, 0,0,0,0,0,0,
1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0,0,0,1,0,0, 0,1,0,0,0,0,
1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,0,0,1,1,1, 1,1,1,1,1,1,
1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0,0,0,1,0,0, 0,1,0,0,0,0,
1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,0,0,1,1,1, 0,0,0,0,0,0
@supertask
supertask / remap.cs
Created December 8, 2022 05:14
remap on C# / HLSL
float remap(float v, float minOld, float maxOld, float minNew, float maxNew) {
return minNew + (v-minOld) * (maxNew - minNew) / (maxOld-minOld);
}
@supertask
supertask / GVoxelizerTriangleFX
Created January 18, 2022 14:15
Keijiro's GVoxelizer triangle FX
// -- Triangle fx --
// Simple scattering animation
// We use smoothstep to make naturally damped linear motion.
// Q. Why don't you use 1-pow(1-param,2)?
// A. Smoothstep is cooler than it. Forget Newtonian physics.
float ss_param = smoothstep(0, 1, param);
// Random motion
float3 move = RandomVector(seed + 1) * ss_param * 0.5;
@supertask
supertask / my_career.md
Last active November 22, 2021 20:27
My career until entering teamLab's interactive team
Year Events
1992 Born in Kyoto, Japan
H.S. 3rd year Started JS
Univ. 1st year Started a computer science course.
Implemented a game in C
Univ. 2nd year Web design and creation
Univ. 3rd year Started 3DCG with Blender
Joined a distributed systems lab
Univ. 4th year Started Unity5
M.C. First year reated my own programming language.
Break (a year) Studied abroad in USA and Vietnam for a year
@supertask
supertask / shaderGraphFunctionGen
Last active September 26, 2021 14:57
Shader functions to ShaderGraph converter
#
# Shader functions to ShaderGraph converter
#
#
# How to use
# 1. Create the file "./functions.hlsl"
# 2. Execute `python shaderGraphFunctionGen.py`
# 3. Write the input file path "#inlude ./<functions>.hlsl" on "./output_functions.hlsl"
#
# INPUT (functions.hlsl):
@supertask
supertask / debugComputeBuffer.cs
Last active April 22, 2022 03:56
Debug compute buffer
//
// Debug Compute Buffer
// When you define a struct/class,
// please use override ToString(), public override string ToString() => $"MpmParticle(position={position}, velocity={velocity})";
//
// debugging range is startIndex <= x < endIndex
// example:
// Util.PrintBuffer<uint2>(this.particlesBuffer, 1024, 1027);
//
public static void PrintBuffer<T>(ComputeBuffer buffer, int startIndex, int endIndex) where T : struct
v2f vert_inflation(appdata v) {
v2f o;
v.vertex = LeapGetLateVertexPos(v.vertex, _isLeftHand); // late-latch support
o.vertex = UnityObjectToClipPos(v.vertex + float4(_InflationAmount * v.normal, 0));
return o;
}
fixed4 frag(v2f i) : SV_Target{
return _Color;
}
@supertask
supertask / Culling_Off.shader
Last active January 27, 2020 17:14
A part of Culling_Off.shader on Project North Star
void surf (Input IN, inout SurfaceOutput o) {
fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = 0.0;
o.Gloss = 0.0;
o.Alpha = 1.0;
o.Specular = 0.0;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
o.Emission = tex.rgb;
}