summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-23 13:08:43 +0800
committerchai <chaifix@163.com>2020-10-23 13:08:43 +0800
commitb82da95b5181ac8bbae38efb13e950d5e88a4caa (patch)
tree48a6f3269276484bbc7cfc95f0651f40a2176aa1 /Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader
parent917e9e0b320775634dc2e710f7deac74fd0822f0 (diff)
*移动amplify shader editor到third party目录
Diffstat (limited to 'Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader')
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader37
1 files changed, 37 insertions, 0 deletions
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader
new file mode 100644
index 00000000..510fb753
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader
@@ -0,0 +1,37 @@
+Shader "Hidden/RGBToHSVNode"
+{
+ Properties
+ {
+ _A ( "_RGB", 2D ) = "white" {}
+ }
+
+ SubShader
+ {
+ Pass
+ {
+ CGPROGRAM
+ #include "UnityCG.cginc"
+ #pragma vertex vert_img
+ #pragma fragment frag
+
+ uniform sampler2D _A;
+
+ float3 RGBToHSV(float3 c)
+ {
+ float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
+ float4 p = lerp( float4( c.bg, K.wz ), float4( c.gb, K.xy ), step( c.b, c.g ) );
+ float4 q = lerp( float4( p.xyw, c.r ), float4( c.r, p.yzx ), step( p.x, c.r ) );
+ float d = q.x - min( q.w, q.y );
+ float e = 1.0e-10;
+ return float3( abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
+ }
+
+ float4 frag ( v2f_img i ) : SV_Target
+ {
+ float3 rgb = tex2D ( _A, i.uv ).rgb;
+ return float4( RGBToHSV(rgb), 1 );
+ }
+ ENDCG
+ }
+ }
+}