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 / LightweightPipelineTemplateShader.shader
Created January 31, 2020 10:44 — forked from andybak/LightweightPipelineTemplateShader.shader
Template shader to use as guide to create Lightweight Pipeline ready shaders.
// When creating shaders for Lightweight Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this simplified version as a base.
// Please not this should be only use for reference only.
// It doesn't match neither performance not feature completeness of Lightweight Pipeline Standard shader.
Shader "LightweightPipeline/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@smkplus
smkplus / 0 design-pattern.md
Created October 27, 2019 16:51 — forked from rain1024/0 design-pattern.md
design pattern

Design Pattern

  • name
  • intent
  • problem/motivation
  • solution
  • structure
  • code
  • consequences & trade-offs

Creational

@smkplus
smkplus / Colors
Created October 25, 2019 06:20 — forked from louisvalet/Colors
I heard you needed colors
using UnityEngine;
public static class Colors
{
public static readonly Color AbsoluteZero = new Color32( 0, 72, 186, 255 );
public static readonly Color Acajou = new Color32( 76, 47, 39, 255 );
public static readonly Color AcidGreen = new Color32( 176, 191, 26, 255 );
public static readonly Color Aero = new Color32( 124, 185, 232, 255 );
public static readonly Color AeroBlue = new Color32( 201, 255, 229, 255 );
public static readonly Color AfricanViolet = new Color32( 178, 132, 190, 255 );
@smkplus
smkplus / ConvertToSprite.cs
Last active August 3, 2019 08:24 — forked from nnm-t/ConvertToSprite.cs
Convert Texture2D To Sprite
using UnityEngine;
public static class SpriteExtensiton
{
/// <summary>
/// Convert Texture2D To Sprite
/// </summary>
/// <param name="texture"></param>
/// <returns></returns>
public static Sprite Texture2DToSprite(this Texture2D texture)
@smkplus
smkplus / SimpleInkPaint.cs
Created April 18, 2019 18:14
Unity Simple Ink Paint Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//-------------------------------------
// simple ink paintスクリプト
// ColliderとRendererは必要
[RequireComponent(typeof(Renderer))]
[RequireComponent(typeof(Collider))]
public class SimpleInkPaint : MonoBehaviour {
@smkplus
smkplus / SimpleInkPaint.shader
Created April 18, 2019 18:13
Unity Simple Ink Paint Shader
Shader "Unlit/SimpleInkPaint"
{
Properties{
_MainTex("MainTex", 2D) = "white" // メインテクスチャ
_Brush("Brush", 2D) = "white" // ブラシテクスチャ
_BrushScale("BrushScale", FLOAT) = 0.1 // ブラシサイズ
_ControlColor("ControlColor", VECTOR) = (0, 0, 0, 0) // ブラシの色
_PaintUV("Hit UV Position", VECTOR) = (0, 0, 0, 0) // ブラシで塗りたい位置
}
Shader "Custom/Cook-Torrance" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Normal Map", 2D) = "bump" {}
_Metallic("Metallic", Range(0,1)) = 0.5
_MetallicTex("Metallic", 2D) = "white" {}
_Roughness("Roughness", Range(0.000000001,1)) = 0.5
_RoughnessTex("Roughness", 2D) = "white" {}
_Fresnel("Fresnel Value", Float) = 0.028
@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 {
@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 / 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
}