Code Snippets ShaderLab

Short texts ShaderLab πŸ§‘β€πŸ’» Code snippets ShaderLab ✍️ Reading lists ShaderLab πŸ‘€

Scrolling Text Effect Shaders

// https://unitycoder.com/blog/2021/10/19/old-school-scrolling-text-with-shaders-rendertexture/ // this is for text mesh Shader “Unlit/TextFx” { Properties { _MainTex (“Texture”, 2D) = “white” { } _Col1 (“Color 1”, Color) = (1, 0.0, 0.0, 1.0) _Col2 (“Color 2”, Color) = (0, 1, 0.0, 1.0) _Col3 (“Color 3”, Color) = (0, 0, 1, 1.0) _Scale (“Scale”, Float) = 1 } SubShader { […]

Scrolling Text Effect Shaders

// https://unitycoder.com/blog/2021/10/19/old-school-scrolling-text-with-shaders-rendertexture/ // this is for text mesh Shader “Unlit/TextFx” { Properties { _MainTex (“Texture”, 2D) = “white” { } _Col1 (“Color 1”, Color) = (1, 0.0, 0.0, 1.0) _Col2 (“Color 2”, Color) = (0, 1, 0.0, 1.0) _Col3 (“Color 3”, Color) = (0, 0, 1, 1.0) _Scale (“Scale”, Float) = 1 } SubShader { […]

urp-basic-unlit-structure_sample.shader

// Copied from https://docs.unity3d.com/Packages/[email protected]/manual/writing-shaders-urp-basic-unlit-structure.html and translated by sungkukpark. // 이 μ…°μ΄λ”λŠ” λ©”μ‹œ ν˜•νƒœλ₯Ό μ½”λ“œμ— 미리 μ§€μ •λœ 컬러둜 μ±„μš°λŠ” 셰이더이닀. Shader “Example/URPUnlitShaderBasic” { // μœ λ‹ˆν‹° μ…°μ΄λ”μ˜ ν”„λ‘œνΌν‹° 블둝이닀. λ³Έ μ˜ˆμ œμ—μ„œ 이 블둝은 λΉ„μ–΄μžˆλ‹€. // μ™œλƒν•˜λ©΄ ν”„λž˜κ·Έλ¨ΌνŠΈ(fragment) 셰이더에 좜λ ₯ μ»¬λŸ¬κ°€ 미리 μ§€μ •λ˜μ–΄ 있기 λ•Œλ¬Έμ΄λ‹€. Properties { } // μ„œλΈŒμ…°μ΄λ”(SubShader) 블둝은 셰이더 μ½”λ“œλ₯Ό λ‹΄κ³  μžˆλ‹€. SubShader { // […]

URP Unlit Color Fade example

Shader “Custom/UnlitTexture” { Properties { [MainColor] _BaseColor(“BaseColor”, Color) = (1,1,1,1) [MainTexture] _BaseMap(“BaseMap”, 2D) = “white” {} } // Universal Render Pipeline subshader. If URP is installed this will be used. SubShader { Tags { “RenderType”=”Fade” “RenderPipeline”=”UniversalRenderPipeline”} Pass { ZWrite On Tags { “LightMode”=”UniversalForward” } HLSLPROGRAM #pragma vertex vert #pragma fragment frag #include “Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl” struct Attributes […]

Blur the background behind UI

// blur shader from https://stackoverflow.com/questions/29030321/unity3d-blur-the-background-of-a-ui-canvas // added toggle https://forum.unity.com/threads/shader-properties-no-bool-support.157580/#post-3013337 Shader “Custom/TintedUIBlur” { Properties { _Size(“Blur”, Range(0, 30)) = 3 [HideInInspector] _MainTex(“Masking Texture”, 2D) = “white” {} _AdditiveColor(“Additive Tint color”, Color) = (0, 0, 0, 0) _MultiplyColor(“Multiply Tint color”, Color) = (1, 1, 1, 1) [Toggle(MAKE_DESATURATED)] _MakeDesaturated (“Desaturate”, Float) = 0 } Category { // We […]