@@ -48,6 +48,7 @@ public class SmoothnessGui : MonoBehaviour
4848 private static readonly int FinalBias = Shader . PropertyToID ( "_FinalBias" ) ;
4949 private static readonly int MainTex = Shader . PropertyToID ( "_MainTex" ) ;
5050 private static readonly int MetallicTex = Shader . PropertyToID ( "_MetallicTex" ) ;
51+ private static readonly int Invert = Shader . PropertyToID ( "_Invert" ) ;
5152 private Material _blitMaterial ;
5253 private RenderTexture _blurMap ;
5354 private Camera _camera ;
@@ -72,6 +73,7 @@ public class SmoothnessGui : MonoBehaviour
7273 private Texture2D _sampleColorMap3 ;
7374
7475 private bool _selectingColor ;
76+ private bool _invert ;
7577
7678 private SmoothnessSettings _settings ;
7779
@@ -228,7 +230,12 @@ private void Update()
228230 ThisMaterial . SetFloat ( MaskLow3 , _settings . MaskLow3 ) ;
229231 ThisMaterial . SetFloat ( MaskHigh3 , _settings . MaskHigh3 ) ;
230232 ThisMaterial . SetFloat ( Sample3Smoothness , _settings . Sample3Smoothness ) ;
231-
233+ int invert = 0 ;
234+ if ( _settings . Invert )
235+ {
236+ invert = 1 ;
237+ }
238+ ThisMaterial . SetInt ( Invert , invert ) ;
232239 ThisMaterial . SetFloat ( BaseSmoothness , _settings . BaseSmoothness ) ;
233240
234241 ThisMaterial . SetFloat ( Slider , _slider ) ;
@@ -457,6 +464,10 @@ private void DoMyWindow(int windowId)
457464 GuiHelper . Slider ( new Rect ( offsetX , offsetY , 280 , 50 ) , "Final Bias" , _settings . FinalBias ,
458465 _settings . FinalBiasText ,
459466 out _settings . FinalBias , out _settings . FinalBiasText , - 0.5f , 0.5f ) ;
467+ offsetY += 40 ;
468+
469+ _settings . Invert = GUI . Toggle ( new Rect ( offsetX , offsetY , 150 , 20 ) , _settings . Invert , "Invert Smoothness" ) ;
470+
460471 offsetY += 50 ;
461472
462473 if ( GUI . Button ( new Rect ( offsetX + 10 , offsetY , 130 , 30 ) , "Reset to Defaults" ) )
@@ -477,7 +488,7 @@ private void OnGUI()
477488 if ( ! _settingsInitialized ) return ;
478489
479490 _windowRect . width = 300 ;
480- _windowRect . height = 490 ;
491+ _windowRect . height = 550 ;
481492
482493 if ( _settings . UseSample1 ) _windowRect . height += 110 ;
483494
@@ -596,7 +607,12 @@ public IEnumerator ProcessSmoothness()
596607 _blitMaterial . SetFloat ( "_MaskLow3" , _settings . MaskLow3 ) ;
597608 _blitMaterial . SetFloat ( "_MaskHigh3" , _settings . MaskHigh3 ) ;
598609 _blitMaterial . SetFloat ( "_Sample3Smoothness" , _settings . Sample3Smoothness ) ;
599-
610+ int invert = 0 ;
611+ if ( _settings . Invert )
612+ {
613+ invert = 1 ;
614+ }
615+ _blitMaterial . SetInt ( "_Invert" , invert ) ;
600616 _blitMaterial . SetFloat ( "_BaseSmoothness" , _settings . BaseSmoothness ) ;
601617
602618 _blitMaterial . SetFloat ( "_BlurOverlay" , _settings . BlurOverlay ) ;
0 commit comments