Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / FeaturesAcceleratedSegmentTest.cs
Last active January 16, 2025 06:40
FAST Algorithm for Corner Detection (Unity)
// unity version : https://unitycoder.com/blog/2019/05/09/fast-algorithm-for-corner-detection-in-unity/
// NOTE this is not optimized in any way
// original source https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_fast/py_fast.html
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FeaturesAcceleratedSegmentTest : MonoBehaviour
@unitycoder
unitycoder / D3D11.hlsl
Created May 9, 2019 06:54
Unity Shader Macros
// https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl
// This file assume SHADER_API_D3D11 is defined
#define UNITY_UV_STARTS_AT_TOP 1
#define UNITY_REVERSED_Z 1
#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection conversion
#define UNITY_RAW_FAR_CLIP_VALUE (0.0)
#define VERTEXID_SEMANTIC SV_VertexID
#define INSTANCEID_SEMANTIC SV_InstanceID
@unitycoder
unitycoder / SharpCompressTest.cs
Last active May 16, 2019 11:21
Unity SharpCompress Test - Create Zip package from files in folder
// unity sharpcompress example : https://unitycoder.com/blog/2019/05/12/using-sharpcompress-in-unity/
// https://github.com/adamhathcock/sharpcompress
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
using System.IO;
using UnityEngine;
public class SharpCompressTest : MonoBehaviour
{
@unitycoder
unitycoder / Standard-Tesselated2.shader
Last active May 20, 2021 11:53
Standard Tesselation Shader
// source https://forum.unity.com/threads/unity-5-standart-shader-with-tesselation.318751/#post-2082612
Shader "Custom/Standard-Tesselated" {
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
_Height("Height", 2D) = "black"{}
_HeightmapTiling("Heightmap tiling", Float) = 1.0
@unitycoder
unitycoder / hostgator.txt
Created May 22, 2019 23:02
mysqli_query : Got error 28 from storage engine (HostGator)
ERROR
Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/edna/public_html/geocities/wp-includes/wp-db.php on line 2007
SOLUTION
contact support, cause is:
"mysqltmp directory filling up. Normally our system monitors are able to resolve this before it becomes a live issue."
@unitycoder
unitycoder / prop.cs
Created May 23, 2019 09:45
using property in inspector
public Color Col {
get { return col; }
set {
col = value;
colChanged = true;
}
}
[SerializeField]
@unitycoder
unitycoder / ConstantScaleQuadBillboard.shader
Created June 1, 2019 23:52
Constant Scale Quad Billboard
// https://forum.unity.com/threads/need-help-fixed-size-billboard.688054/#post-4604032
Shader "Unlit/Constant Scale Quad Billboard"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
@unitycoder
unitycoder / 3ds-max.md
Last active September 17, 2025 11:11
3ds max notes

import multiple fbx files

https://www.scriptspot.com/3ds-max/scripts/batch-exportimport

assign random color to all selected objects

F11 > for obj in objects do (obj.wirecolor = color (random 0 255) (random 0 255) (random 0 255))

create standard mats

for obj in objects do obj.material = copy (StandardMaterial name:("Mat_" + obj.name) diffuse:(color (random 0 255) (random 0 255) (random 0 255)))

explode object to elements/objects

@unitycoder
unitycoder / using-shadowmap.shader
Created June 5, 2019 11:34
ShadowMapping With Outline - Custom shadows shader
// https://pastebin.com/0HYnXKLC
Shader "Unlit/recieveShadowMapWithOutline"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "LightMode" = "ForwardBase"