shader参数开放

This commit is contained in:
ALIENJACK\alien 2024-11-08 14:56:33 +08:00
parent 12421d4de1
commit 027fcbea53
4 changed files with 53 additions and 19 deletions

View File

@ -194,7 +194,7 @@ namespace AxibugEmuOnline.Client.Event
} }
catch (Exception e) catch (Exception e)
{ {
App.log.Error(e.Message + ", method name : " + callback.Method); App.log.Error(e.ToString());
} }
} }
} }

View File

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: -20
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:

View File

@ -69,6 +69,7 @@ Material:
- _Glossiness: 0.5 - _Glossiness: 0.5
- _GlossyReflections: 1 - _GlossyReflections: 1
- _Metallic: 0 - _Metallic: 0
- _MidHeight1: 0.4
- _Mode: 0 - _Mode: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.02 - _Parallax: 0.02
@ -85,5 +86,7 @@ Material:
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color1: {r: 0, g: 0.4, b: 1, a: 1}
- _Color2: {r: 0, g: 0.7, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

View File

@ -2,8 +2,7 @@
{ {
Properties Properties
{ {
_Color ("Tint", Color) = (1,1,1,1) _MainTex ("Sprite Texture", 2D) = "white" {}
_StencilComp ("Stencil Comparison", Float) = 8 _StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0 _Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0
@ -14,6 +13,24 @@
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
[Space(10)]
_Color1("Color1",Color) = (0,0.4,1,1)
_Color2("Color2",Color) = (0,0.7,1,1)
[Header(Wave1)]
_MidHeight1("MidHeight",Float) = 0.4
_MaxHeight1("MaxHeigh",Float) = 0.5
_Power1("Power",Float)=50.0
_Frequency1("Frequency",Float)=2.0
_Speed1("Speed",Float)=0.4
[Header(Wave2)]
_MidHeight2("MidHeight",Float) = 0.42
_MaxHeight2("MaxHeigh",Float) = 0.54
_Power2("Power",Float)=50.0
_Frequency2("Frequency",Float)=2.1
_Speed2("Speed",Float)=0.3
} }
SubShader SubShader
@ -76,7 +93,8 @@
fixed4 _Color; fixed4 _Color;
fixed4 _TextureSampleAdd; fixed4 _TextureSampleAdd;
float4 _ClipRect; float4 _ClipRect;
sampler2D _MainTex;
float wave(float x, float frequency, float speed, float midHeight, float maxHeight) float wave(float x, float frequency, float speed, float midHeight, float maxHeight)
{ {
@ -107,29 +125,42 @@
return OUT; return OUT;
} }
float3 _Color1;
float3 _Color2;
float _MidHeight1;
float _MaxHeight1;
float _Power1;
float _Frequency1;
float _Speed1;
float _MidHeight2;
float _MaxHeight2;
float _Power2;
float _Frequency2;
float _Speed2;
fixed4 frag(v2f IN) : SV_Target fixed4 frag(v2f IN) : SV_Target
{ {
float2 uv= IN.texcoord; float2 uv= IN.texcoord;
// Lerped background // Lerped background
float3 blue = float3(0, 0.4, 1);
float3 blue2 = float3(0, 0.7, 1);
float amount = (uv.x + uv.y) / 2.0; float amount = (uv.x + uv.y) / 2.0;
float3 bg = lerp(blue2, blue, amount); float3 bg = lerp(_Color2, _Color1, amount);
// Overlayed sine waves // Overlayed sine waves
float midHeight1 = 0.4; float maxHeight1 = _MaxHeight1 + wave(0, 4.0,0.02, 0.0, 0.02);
float maxHeight1 = 0.5 + wave(0.0, 4.0, 0.02, 0.0, 0.02); float power1 = _Power1; //Higher power means thinner line
float power1 = 50.0; //Higher power means thinner line float frequency1 = _Frequency1 + wave(0.0, 3.0, 0.03, 0.0, 0.02);
float frequency1 = 2.0 + wave(0.0, 3.0, 0.03, 0.0, 0.02); float speed1 = _Speed1 + wave(0.0, 2.2, 0.04, 0.0, 0.01);
float speed1 = 0.4 + wave(0.0, 2.2, 0.04, 0.0, 0.01); float waveHeight1 = wave(uv.x, frequency1, speed1, _MidHeight1, maxHeight1);
float waveHeight1 = wave(uv.x, frequency1, speed1, midHeight1, maxHeight1);
float waveCol1 = waveColor(uv, waveHeight1, maxHeight1, frequency1, power1); float waveCol1 = waveColor(uv, waveHeight1, maxHeight1, frequency1, power1);
float midHeight2 = 0.42; float midHeight2 = _MidHeight2;
float maxHeight2 = 0.54 + wave(0.0, 3.0, 0.04, 0.0, 0.02); float maxHeight2 = _MaxHeight2 + wave(0.0, 3.0, 0.04, 0.0, 0.02);
float power2 = 50.0; //Higher power means thinner line float power2 = _Power2; //Higher power means thinner line
float frequency2 = 2.1 + wave(0.0, 4.0, 0.05, 0.0, 0.02); float frequency2 = _Frequency2 + wave(0.0, 4.0, 0.05, 0.0, 0.02);
float speed2 = 0.3 + wave(0.0, 2.0, 0.02, 0.0, 0.01); float speed2 = _Speed2 + wave(0.0, 2.0, 0.02, 0.0, 0.01);
float waveHeight2 = wave(uv.x, frequency2, speed2, midHeight2, maxHeight2); float waveHeight2 = wave(uv.x, frequency2, speed2, midHeight2, maxHeight2);
float waveCol2 = waveColor(uv, waveHeight2, maxHeight2, frequency2, power2); float waveCol2 = waveColor(uv, waveHeight2, maxHeight2, frequency2, power2);