diff --git a/Cancerspace.shader b/Cancerspace.shader index 5761676..0eac1cb 100644 --- a/Cancerspace.shader +++ b/Cancerspace.shader @@ -35,6 +35,7 @@ [PowerSlider(2.0)]_YShake ("Y Shake", Range(0, 1)) = 0 _XShakeSpeed ("X Shake Speed", Range(0, 300)) = 200 _YShakeSpeed ("Y Shake Speed", Range(0, 300)) = 300 + _ShakeAmplitude ("Shake Amplitude", Range(0, 2)) = 1 _MainTex ("Image Overlay", 2D) = "white" {} [HDR] _OverlayColor ("Overlay Color", Color) = (1,1,1,1) @@ -148,10 +149,9 @@ float4 _OverlayColor; float4 _Color; - float _XShake; - float _YShake; - float _XShakeSpeed; - float _YShakeSpeed; + float _XShake, _YShake; + float _XShakeSpeed, _YShakeSpeed; + float _ShakeAmplitude; float _XWobbleAmount, _YWobbleAmount, _XWobbleTiling, _YWobbleTiling, _XWobbleSpeed, _YWobbleSpeed; @@ -181,8 +181,7 @@ float _ScreenXMultiplierR, _ScreenXMultiplierG, _ScreenXMultiplierB, _ScreenXMultiplierA; float _ScreenYMultiplierR, _ScreenYMultiplierG, _ScreenYMultiplierB, _ScreenYMultiplierA; - float4 _ScreenRotationOriginX; - float4 _ScreenRotationOriginY; + float4 _ScreenRotationOriginX, _ScreenRotationOriginY; float4 _RotationAngle; @@ -264,7 +263,7 @@ float4 color = tex2D(_MainTex, TRANSFORM_TEX(computeScreenSpaceOverlayUV(i.posWorld), _MainTex)) * _OverlayColor; - float2 displace = float2(_XShake * VRFix, _YShake) * sin(_Time.yy * float2(_XShakeSpeed, _YShakeSpeed)); + float2 displace = float2(_XShake * VRFix, _YShake) * sin(_Time.yy * float2(_XShakeSpeed, _YShakeSpeed)) * _ShakeAmplitude; float2 grabUV = i.projPos.xy / i.projPos.w; diff --git a/Editor/CancerspaceInspector.cs b/Editor/CancerspaceInspector.cs index 188f06c..51d2ae1 100644 --- a/Editor/CancerspaceInspector.cs +++ b/Editor/CancerspaceInspector.cs @@ -95,6 +95,7 @@ public CSCategory(string nname, GUIStyle sstyle, CSCategorySetup ssetupDelegate) protected MaterialProperty shakeYAmount; protected MaterialProperty shakeXSpeed; protected MaterialProperty shakeYSpeed; + protected MaterialProperty shakeAmplitude; protected MaterialProperty overlayImage; protected MaterialProperty overlayColor; @@ -161,6 +162,7 @@ public void FindProperties(MaterialProperty[] props) { shakeYAmount = FindProperty("_YShake", props); shakeXSpeed = FindProperty("_XShakeSpeed", props); shakeYSpeed = FindProperty("_YShakeSpeed", props); + shakeAmplitude = FindProperty("_ShakeAmplitude", props); overlayImage = FindProperty("_MainTex", props); overlayColor = FindProperty("_OverlayColor", props); @@ -252,11 +254,13 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro me.ShaderProperty(shakeYAmount, shakeYAmount.displayName); me.ShaderProperty(shakeXSpeed, shakeXSpeed.displayName); me.ShaderProperty(shakeYSpeed, shakeYSpeed.displayName); + me.ShaderProperty(shakeAmplitude, shakeAmplitude.displayName); } else { me.FloatProperty(shakeXAmount, shakeXAmount.displayName); me.FloatProperty(shakeYAmount, shakeYAmount.displayName); me.FloatProperty(shakeXSpeed, shakeXSpeed.displayName); me.FloatProperty(shakeYSpeed, shakeYSpeed.displayName); + me.FloatProperty(shakeAmplitude, shakeAmplitude.displayName); } }),