Skip to content

Instantly share code, notes, and snippets.

View smkplus's full-sized avatar
😍
Curios

Seyed Morteza Kamali smkplus

😍
Curios
View GitHub Profile
@smkplus
smkplus / spriteGlitch.shader
Created April 20, 2017 15:14 — forked from KeyMaster-/spriteGlitch.shader
A glitch effect shader for Sprites in Unity3D
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_)
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in
@smkplus
smkplus / foo.md
Created July 25, 2017 17:40 — forked from aras-p/foo.md
Controlling fixed function states from materials/scripts in Unity

(typing off the top of my head, might not compile)

Since Unity 4.3:

In the shader, instead of writing Cull Off, write Cull [_MyCullVariable], the value will be fetched from the material or global float/int variable _MyCullVariable then.

You could have it be part of material, e.g. inside Properties block:

[Enum(Off,0,Front,1,Back,2)] _MyCullVariable ("Cull", Int) = 1
@smkplus
smkplus / VertexBlendMasked
Created August 4, 2017 06:57 — forked from Petethegoat/VertexBlendMasked
Shader for Unity that vertex blends two textures with a mask. Imperfect.
Shader "Custom/VertexBlendMaskedCleanEdges" {
Properties
{
_Over ("Over", 2D) = "white" {}
_Under ("Under", 2D) = "white" {}
_Mask ("Mask", 2D) = "white" {}
_Bias ("Edge Bias", Range(0.5, 30.0)) = 4.0
_Edge ("Edge Sharpness", Float) = 10.0
_Fall ("Blend Falloff", Float) = 1.0
}
@smkplus
smkplus / UnityShaderCheatSheet.md
Last active May 7, 2024 07:34
Controlling fixed function states from materials/scripts in Unity

16999105_467532653370479_4085466863356780898_n

Shader "MaterialPropertyDrawer"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
 
[HideInInspector] _MainTex2("Hide Texture", 2D) = "white" {}
@smkplus
smkplus / ImageEffectBase.shader
Created December 12, 2017 08:47 — forked from sugi-cho/ImageEffectBase.shader
use vertex shader in surface shader
Shader "Custom/ImageEffectBase" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
CGINCLUDE
#include "UnityCG.cginc"
sampler2D _MainTex;
half4 _MainTex_TexelSize;
@smkplus
smkplus / GetAngle.md
Last active January 22, 2018 08:56
Get Angle between two vector and debug it

directions

 using UnityEngine;
 using System.Collections;
 
 public class AngleDebugger : MonoBehaviour
@smkplus
smkplus / ExcelForUnity
Last active March 24, 2018 16:37
ExcelForUnity
How to write data to CSV file in UNITY
Hi Guys, if any one is facing problem to save data in csv file can use this solution. If you have any questions, you can ask me through comments.
Things to remember :
Never ever add any commas to your data otherwise, cells will get messed up completely.
Saving Your Spreadsheet as a CSV
@smkplus
smkplus / White Noise Unity
Last active December 21, 2023 17:23
Unity ,Shader,white noise
Shader "Noise/WhiteNoise"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color("Color",Color) = (1,1,1,1)
}
SubShader
{
@smkplus
smkplus / WorldPosition In PostProcessing Stack 2
Last active June 28, 2019 21:08
WorldPosition In PostProcessing Stack 2.shader
// Because this framework is supposed to work with the legacy render pipelines AND scriptable render
// pipelines we can't use Unity's shader libraries (some scriptable pipelines come with their own
// shader lib). So here goes a minimal shader lib only used for post-processing to ensure good
// compatibility with all pipelines.
#ifndef UNITY_POSTFX_STDLIB
#define UNITY_POSTFX_STDLIB
// -----------------------------------------------------------------------------
// API macros
@smkplus
smkplus / UnityDiffuseLightmap.shader
Created April 19, 2018 17:04 — forked from jimfleming/UnityDiffuseLightmap.shader
Example depicting applying Unity lightmapping data to a simple diffuse shader.
Shader "Diffuse Lightmap" {
Properties {
_MainTex ("Texture 1", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
Pass {