chore: update readme

This commit is contained in:
mob-sakai
2026-06-20 16:14:22 +09:00
parent c7696c09c0
commit ae7ffad789
2 changed files with 26 additions and 3 deletions
+20
View File
@@ -60,6 +60,7 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
- [Usage with SoftMaskForUGUI](#usage-with-softmaskforugui)
- [Usage with ShaderGraph](#usage-with-shadergraph)
- [Usage with Timeline](#usage-with-timeline)
- [Usage with Custom Shader](#usage-with-custom-shader)
- [Runtime/Editor Preset for UIEffect](#runtimeeditor-preset-for-uieffect)
- [Usage with Code](#usage-with-code)
- [Project Settings](#project-settings)
@@ -545,6 +546,25 @@ Timeline is a powerful animation tool that can control UIEffect using `ControlTr
<br><br>
### Usage with Custom Shader
To make your custom shader support UIEffect, it must satisfy the following requirements.
Refer to the sections enclosed by `==== UIEFFECT START ===` and `==== UIEFFECT END ====` in the built-in `Hidden/UI/Default (UIEffect)` shader included in the package.
https://github.com/mob-sakai/UIEffect/blob/main/Packages/src/Shaders/UIEffect.shader
- Blend: `Blend [_SrcBlend] [_DstBlend]`
- Shader variants: `#pragma shader_feature_local_fragment ***`
- Vertex shader input structure: `float4 uvMask : TEXCOORD***;`
- Vertex shader: `OUT.uvMask = v.uvMask;` and `OUT.worldPosition = v.vertex;`
- Pixel shader input structure: `float4 uvMask : TEXCOORD***;` and `float4 worldPosition : TEXCOORD***;`
- UIEffect micro pixel shader: a function that returns the color of the specified pixel and has the signature `half4 uieffect_frag(v2f IN, float2 uv)`.
- Pixel shader input structure name definition: `#define UIEFFECT_FRAG_STRUCT v2f`
- Include the UIEffect library: `#include "Packages/com.coffee.ui-effect/Shaders/UIEffect.cginc"`
- Pixel shader: `half4 c = uieffect(IN.texcoord, IN.uvMask, IN.worldPosition, IN);`
<br><br>
### Runtime/Editor Preset for UIEffect
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-preset.png)
+6 -3
View File
@@ -42,7 +42,9 @@ Shader "Hidden/UI/Default (UIEffect)"
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
// ==== UIEFFECT START ====
Blend [_SrcBlend] [_DstBlend]
// ==== UIEFFECT END ====
ColorMask [_ColorMask]
Pass
@@ -117,7 +119,6 @@ Shader "Hidden/UI/Default (UIEffect)"
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
float4 vPosition = UnityObjectToClipPos(v.vertex);
OUT.worldPosition = v.vertex;
OUT.vertex = vPosition;
float2 pixelSize = vPosition.w;
@@ -141,20 +142,20 @@ Shader "Hidden/UI/Default (UIEffect)"
// ==== UIEFFECT START ====
OUT.uvMask = v.uvMask;
OUT.worldPosition = v.vertex;
// ==== UIEFFECT END ====
return OUT;
}
// ==== UIEFFECT START ====
fixed4 uieffect_frag(v2f IN, float2 uv)
half4 uieffect_frag(v2f IN, float2 uv)
{
half4 color = (tex2D(_MainTex, uv) + _TextureSampleAdd);
color.rgb *= IN.color.rgb;
color.rgb *= color.a;
return color;
}
#define UIEFFECT_FRAG_STRUCT v2f
#include "Packages/com.coffee.ui-effect/Shaders/UIEffect.cginc"
// ==== UIEFFECT END ====
@@ -168,7 +169,9 @@ Shader "Hidden/UI/Default (UIEffect)"
const half invAlphaPrecision = half(1.0 / alphaPrecision);
IN.color.a = round(IN.color.a * alphaPrecision) * invAlphaPrecision;
// ==== UIEFFECT START ====
half4 c = uieffect(IN.texcoord, IN.uvMask, IN.worldPosition, IN);
// ==== UIEFFECT END ====
c *= IN.color.a;
#ifdef UNITY_UI_CLIP_RECT