diff --git a/Runtime/Cameras/CameraManager.cs b/Runtime/Cameras/CameraManager.cs index 57bde74..5a269d0 100644 --- a/Runtime/Cameras/CameraManager.cs +++ b/Runtime/Cameras/CameraManager.cs @@ -93,10 +93,11 @@ namespace Rokojori ProcessCameras( delta ); ProcessDebugCamera(); - ProcessPostProcess( delta ); + + } @@ -151,6 +152,7 @@ namespace Rokojori return; } + compositorLayout.Update(); postProcessVolumes.ForEach( v => diff --git a/Runtime/Godot/Extensions/ArrayExtensions.cs b/Runtime/Godot/Extensions/ArrayExtensions.cs index b9b7a1d..3c66ada 100644 --- a/Runtime/Godot/Extensions/ArrayExtensions.cs +++ b/Runtime/Godot/Extensions/ArrayExtensions.cs @@ -15,9 +15,9 @@ namespace Rokojori } } - public static T Find<[MustBeVariant] T>( this Godot.Collections.Array array, System.Func evaluater ) + public static T Find<[MustBeVariant] T>( this Godot.Collections.Array array, System.Func evaluater, int offset = 0 ) { - for ( int i = 0; i < array.Count; i++ ) + for ( int i = offset; i < array.Count; i++ ) { if ( evaluater( array[ i ] ) ) { @@ -27,5 +27,19 @@ namespace Rokojori return default(T); } + + public static int FindIndex<[MustBeVariant] T>( this Godot.Collections.Array array, System.Func evaluater, int offset = 0 ) + { + for ( int i = offset; i < array.Count; i++ ) + { + if ( evaluater( array[ i ] ) ) + { + return i; + } + } + + return -1; + } + } } \ No newline at end of file diff --git a/Runtime/Godot/Extensions/CurveExtensions.cs b/Runtime/Godot/Extensions/CurveExtensions.cs new file mode 100644 index 0000000..155a31f --- /dev/null +++ b/Runtime/Godot/Extensions/CurveExtensions.cs @@ -0,0 +1,30 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public static class CurveExtensions + { + public static Curve WithPoints( this Curve curve, params Vector2[] points ) + { + curve.ClearPoints(); + + points.ForEach( p => curve.AddPoint( p ) ); + + return curve; + } + + public static Curve WithValues( this Curve curve, params float[] values ) + { + curve.ClearPoints(); + + for ( int i = 0; i < values.Length; i++ ) + { + float x = i / (float) ( values.Length - 1f ); + curve.AddPoint( new Vector2( x, values[ i ] ) ); + } + + return curve; + } + } +} \ No newline at end of file diff --git a/Runtime/Godot/Extensions/CurveExtensions.cs.uid b/Runtime/Godot/Extensions/CurveExtensions.cs.uid new file mode 100644 index 0000000..fc88452 --- /dev/null +++ b/Runtime/Godot/Extensions/CurveExtensions.cs.uid @@ -0,0 +1 @@ +uid://ddws86tobuhvf diff --git a/Runtime/Godot/Extensions/CuveTextureExtensions.cs b/Runtime/Godot/Extensions/CuveTextureExtensions.cs new file mode 100644 index 0000000..14ac87a --- /dev/null +++ b/Runtime/Godot/Extensions/CuveTextureExtensions.cs @@ -0,0 +1,25 @@ +using Godot; +namespace Rokojori +{ + public static class CurveTextureExtensions + { + + public static CurveTexture WithTextureMode( this CurveTexture curveTexture, CurveTexture.TextureModeEnum textureMode ) + { + curveTexture.TextureMode = textureMode; + return curveTexture; + } + + public static CurveTexture WithResolution( this CurveTexture curveTexture, int resolution ) + { + curveTexture.Width = resolution; + return curveTexture; + } + + public static CurveTexture WithCurve( this CurveTexture curveTexture, Curve curve ) + { + curveTexture.Curve = curve; + return curveTexture; + } + } +} \ No newline at end of file diff --git a/Runtime/Godot/Extensions/CuveTextureExtensions.cs.uid b/Runtime/Godot/Extensions/CuveTextureExtensions.cs.uid new file mode 100644 index 0000000..ff0b461 --- /dev/null +++ b/Runtime/Godot/Extensions/CuveTextureExtensions.cs.uid @@ -0,0 +1 @@ +uid://c2l32j2mw3smj diff --git a/Runtime/Math/RangeI.cs b/Runtime/Math/RangeI.cs index d968c42..dc6942d 100644 --- a/Runtime/Math/RangeI.cs +++ b/Runtime/Math/RangeI.cs @@ -15,6 +15,11 @@ namespace Rokojori this.max = max; } + public override string ToString() + { + return $"RangeI(min:{min} max:{max})"; + } + public void EnsureCorrectness() { if ( max < min ) diff --git a/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs b/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs new file mode 100644 index 0000000..ade65be --- /dev/null +++ b/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs @@ -0,0 +1,51 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class CompFXMemberCurveTarget:RokojoriCompositorEffectAnimationTarget + { + [Export] + public string member; + + [Export] + public Curve curve; + + [Export] + public float curveScale = 1f; + + public enum TargetType + { + Float, + Int, + Bool + } + + [Export] + public TargetType targetType = TargetType.Float; + + public override void OnAnimationDriverChange( RokojoriCompositorEffect re, float value ) + { + var curveValue = curve == null ? value : curve.Sample( value ); + + curveValue *= curveScale; + + if ( TargetType.Float == targetType ) + { + ReflectionHelper.SetValue( re, member, curveValue ); + } + else if ( TargetType.Int == targetType ) + { + ReflectionHelper.SetValue( re, member, (int)curveValue ); + } + else if ( TargetType.Bool == targetType ) + { + ReflectionHelper.SetValue( re, member, curveValue > 0 ); + } + + } + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs.uid b/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs.uid new file mode 100644 index 0000000..334abbb --- /dev/null +++ b/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs.uid @@ -0,0 +1 @@ +uid://dvvfvlutisecy diff --git a/Runtime/Rendering/Compositor/AnimationTargets/RokojoriCompositorEffectAnimationTarget.cs b/Runtime/Rendering/Compositor/AnimationTargets/RokojoriCompositorEffectAnimationTarget.cs new file mode 100644 index 0000000..c604234 --- /dev/null +++ b/Runtime/Rendering/Compositor/AnimationTargets/RokojoriCompositorEffectAnimationTarget.cs @@ -0,0 +1,13 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public abstract partial class RokojoriCompositorEffectAnimationTarget:Resource + { + public abstract void OnAnimationDriverChange( RokojoriCompositorEffect effect, float driverValue ); + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/AnimationTargets/RokojoriCompositorEffectAnimationTarget.cs.uid b/Runtime/Rendering/Compositor/AnimationTargets/RokojoriCompositorEffectAnimationTarget.cs.uid new file mode 100644 index 0000000..54d652f --- /dev/null +++ b/Runtime/Rendering/Compositor/AnimationTargets/RokojoriCompositorEffectAnimationTarget.cs.uid @@ -0,0 +1 @@ +uid://b44sulyvbs57h diff --git a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayerSlot.cs b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayerSlot.cs new file mode 100644 index 0000000..51b1ffe --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayerSlot.cs @@ -0,0 +1,15 @@ + +using Godot; +using System.Collections.Generic; +using System.Linq; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class CompositorEffectLayerSlot:CompositorEffect + { + [Export] + public CompositorEffectLayer layer; + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayerSlot.cs.uid b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayerSlot.cs.uid new file mode 100644 index 0000000..8e4de6b --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayerSlot.cs.uid @@ -0,0 +1 @@ +uid://chqp2otobal7a diff --git a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayout.cs b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayout.cs index 9efb685..42ab8b0 100644 --- a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayout.cs +++ b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectLayout.cs @@ -7,25 +7,75 @@ namespace Rokojori [Tool] [GlobalClass] public partial class CompositorEffectLayout:Resource - { - [Export] - public CompositorEffectLayer[] layers; - + { [Export] public Compositor compositor; - public void Ensure( RokojoriCompositorEffect[] effects, bool inside ) - { - - // this.LogInfo( "Ensure effects:", inside ); + + public List activeVFX = []; + int refresh = 0; + int refreshFrames = 1000; + + public RangeI GetLayerRange( CompositorEffectLayer layer ) + { + var effects = compositor.CompositorEffects; + + var start = effects.FindIndex( e => e is CompositorEffectLayerSlot slot && slot.layer == layer ); + + if ( start == -1 ) + { + return null; + } + + var end = effects.FindIndex( e => e is CompositorEffectLayerSlot, start + 1 ); + + if ( end == -1 ) + { + end = effects.Count; + } + + end--; + + return new RangeI( start, end ); + } + + public void Update() + { + refresh--; + + if ( refresh <= 0 ) + { + refresh = refreshFrames; + + activeVFX.ForEach( + a => + { + a.DuplicateHack(); + } + ); + } + } + + public void Ensure( CompositorVFX vfx, RokojoriCompositorEffect[] effects, bool inside ) + { + if ( inside ) + { + activeVFX.AddIfNotPresent( vfx ); + } + else + { + activeVFX.Remove( vfx ); + } + + var list = new List>(); var replacements = new List>(); effects.ForEach( ( e )=> { - var el = compositor.CompositorEffects.Find( ce => ce is RokojoriCompositorEffect re && re.compositorEffectID == e.compositorEffectID ); + var el = compositor.CompositorEffects.Find( ce => ce is RokojoriCompositorEffect re && re.compositorEffectID != null && re.compositorEffectID == e.compositorEffectID ); var isInside = el != null; @@ -33,32 +83,12 @@ namespace Rokojori { if ( el != e ) { - // var fx = compositor.CompositorEffects; - // var index = fx.IndexOf( el ); - - // fx[ index ] = e; - - // compositor.CompositorEffects = fx; - replacements.Add( new System.Tuple( e, el as RokojoriCompositorEffect ) ) ; } - // this.LogInfo( "Already " + ( inside ? "inside" : "removed" ), e ); return; } - if ( inside ) - { - // this.LogInfo( "Adding:", e ); - // compositor.CompositorEffects.Add( e ); - } - else - { - // this.LogInfo( "Removing:", el ); - - // compositor.CompositorEffects.Remove( e ); - } - list.Add( new System.Tuple( e, el as RokojoriCompositorEffect ) ); @@ -88,12 +118,56 @@ namespace Rokojori if ( inside ) { + var insertionIndex = newEffects.Count; + + if ( vfx.layer != null ) + { + var range = GetLayerRange( vfx.layer ); + this.LogInfo( "Insertion Layer:", vfx.layer, ">>", range ); + + insertionIndex = range.max + 1; + + if ( range != null ) + { + var found = false; + + for ( int i = range.min; ! found && i <= range.max; i++ ) + { + this.LogInfo( "Checking:", i ); + + if ( newEffects[ i ] != null && newEffects[ i ] is RokojoriCompositorEffect r && + r.compositorEffectID != null && + r.compositorEffectID.priority > vfx.priority + ) + { + found = true; + this.LogInfo( "Found lower insertion Index:", insertionIndex, ">>", i ); + insertionIndex = i; + + } + else + { + if ( newEffects[ i ] != null && newEffects[ i ] is RokojoriCompositorEffect rfx ) + { + this.LogInfo( "Found insertion Index:", rfx.compositorEffectID ); + } + } + } + } + } + + this.LogInfo( "Insertion Index:", insertionIndex, ">>", newEffects.Count ); + list.ForEach( ( l )=> { var index = effects.IndexOf( l.Item1 ); effects[ index ] = (RokojoriCompositorEffect) effects[ index ].Duplicate(); - newEffects.Add( effects[ index ] ); + effects[ index ].compositorEffectID.layer = vfx.layer; + effects[ index ].compositorEffectID.priority = vfx.layer == null ? 0 : vfx.priority; + newEffects.Insert( insertionIndex, effects[ index ] ); + + insertionIndex ++; } ); } diff --git a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFX.cs b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFX.cs index 87d7f57..7e11409 100644 --- a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFX.cs +++ b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFX.cs @@ -11,10 +11,7 @@ namespace Rokojori { [Export] public CompositorVFXPreset preset; - - // [Export] - // public RokojoriCompositorEffect[] effects = []; - + float _driverValue = 0f; [Export( PropertyHint.Range, "0,1" ) ] @@ -29,6 +26,37 @@ namespace Rokojori } } + + [Export] + public CompositorEffectLayer layer; + + [Export] + public int priority = 0; + + + public void DuplicateHack() + { + #if TOOLS + + var selectedNodes = EditorInterface.Singleton.GetSelection().GetSelectedNodes(); + if ( selectedNodes.Contains( this ) ) + { + return; + } + + #endif + var numEffects = preset.effects.Length; + + for ( int i = 0 ; i < numEffects; i++ ) + { + preset.effects[ i ] = (RokojoriCompositorEffect) preset.effects[ i ].Duplicate(); + } + + UpdateEffects(); + } + + + public float GetDriverFloatValue() { return _driverValue; @@ -67,17 +95,20 @@ namespace Rokojori void EnsureOwnerShip() { - this.LogInfo( "EnsureOwnerShip", ownerReference ); + // this.LogInfo( "EnsureOwnerShip", ownerReference ); var undoMarker = UndoGD.Start( "Set Ownership for " + HierarchyName.Of( this ) ); if ( ownerReference == null ) { ownerReference = new CompositorEffectOwner(); - this.LogInfo( "Created ownership", ownerReference ); + // this.LogInfo( "Created ownership", ownerReference ); UndoGD.Set( this, nameof( ownerReference ), ownerReference ); } - preset.effectPresets.ForEach( ep => SetOwnerShip( ep.effect ) ); + + preset.effects.ForEach( fx => SetOwnerShip( fx ) ); + + UndoGD.End( undoMarker ); } @@ -101,7 +132,7 @@ namespace Rokojori public void UpdateValue() { - this.LogInfo( "Updating value", _driverValue ); + // this.LogInfo( "Updating value", _driverValue ); UpdateEffects(); @@ -123,35 +154,34 @@ namespace Rokojori void UpdateEffects() { - if ( preset == null || preset.effectPresets == null || preset.effectPresets.Length == 0 ) + if ( preset == null || preset.effects == null || preset.effects.Length == 0 ) { return; } - preset.effectPresets.ForEach( ep => ep.UpdateTargets( _driverValue ) ); + preset.effects.ForEach( ep => ep.UpdateAnimationTargets( _driverValue ) ); if ( managingMode != ManagingMode.None ) { EnsureOwnerShip(); - var effects = preset.effectPresets.Map( ep => ep.effect ).ToArray(); + var effects = preset.effects; var currentLayout = layout != null ? layout : Unique.Get().compositorLayout; if ( _driverValue == 0 || ( _driverValue == 1 && managingMode == ManagingMode.Remove_On_NonIntermediate_Insert_Else ) ) { - currentLayout.Ensure( effects, false ); + currentLayout.Ensure( this, effects, false ); } else { - currentLayout.Ensure( effects, true ); + currentLayout.Ensure( this, effects, true ); for ( int i = 0; i < effects.Length; i++ ) { - preset.effectPresets[ i ].effect = effects[ i ]; + preset.effects[ i ] = effects[ i ]; } } - } } diff --git a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXEffectPreset.cs b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXEffectPreset.cs index a169d3a..5fc60ed 100644 --- a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXEffectPreset.cs +++ b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXEffectPreset.cs @@ -8,16 +8,16 @@ namespace Rokojori [GlobalClass] public partial class CompositorVFXEffectPreset:Resource { - [Export] - public RokojoriCompositorEffect effect; + // [Export] + // public RokojoriCompositorEffect effect; [Export] public CompositorEffectDriverTarget[] targets; - public void UpdateTargets( float value ) - { - targets.ForEach( t => t.OnDriverChange( effect, value ) ); - } + // public void UpdateTargets( float value ) + // { + // targets.ForEach( t => t.OnDriverChange( effect, value ) ); + // } } } \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs index 588c926..2d25197 100644 --- a/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs +++ b/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs @@ -8,7 +8,42 @@ namespace Rokojori [GlobalClass] public partial class CompositorVFXPreset:Resource { + // [Export] + // public CompositorVFXEffectPreset[] effectPresets = []; + [Export] - public CompositorVFXEffectPreset[] effectPresets = []; + public RokojoriCompositorEffect[] effects = []; + + // [ExportToolButton( "Convert Old to New")] + // public Callable convertOldToNewButton => Callable.From( + // ()=> + // { + // effects = effectPresets.Map( e => e.effect ); + + // for ( int i = 0; i < effectPresets.Length; i++ ) + // { + // effects[ i ].animationTargets = effectPresets[ i ].targets.Map( + // ( et )=> + // { + // if ( et is CompositorEffectMemberCurveTarget target ) + // { + // var ct = new CompFXMemberCurveTarget(); + // ct.member = target.member; + // ct.curve = target.curve; + // ct.targetType = + // CompositorEffectMemberCurveTarget.TargetType.Int == target.targetType ? CompFXMemberCurveTarget.TargetType.Int : + // CompositorEffectMemberCurveTarget.TargetType.Bool == target.targetType ? CompFXMemberCurveTarget.TargetType.Bool : + // CompFXMemberCurveTarget.TargetType.Float; + + // return ct; + // } + + // return null; + // } + // ); + // } + + // } + // ); } } \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs b/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs index 01862da..a482314 100644 --- a/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs +++ b/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs @@ -11,10 +11,17 @@ namespace Rokojori [Export] public CompositorEffectOwner owner; + [Export] public CompositorEffectLayer layer; [Export] public int priority = 0; + + public override string ToString() + { + return ( layer == null ? "(---)" : layer.layerName ) + " priority: " + priority; + } + } } \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs index 9654005..089ac30 100644 --- a/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs @@ -17,12 +17,24 @@ namespace Rokojori [Export( PropertyHint.Range, "0,1") ] public float amount = 0.5f; - [Export( PropertyHint.Range, "1,10") ] + [Export( PropertyHint.Range, "1,16") ] public int num = 2; + public enum RotationMode + { + Half_for_Crossings, + Full_for_Uneven + } + + [Export] + public RotationMode rotationMode = RotationMode.Half_for_Crossings; + + [Export( PropertyHint.Range, "0,1") ] + public float blendMode = 0.5f; + [ExportGroup( "Distortion")] - [Export( PropertyHint.Range, "0,1") ] + [Export( PropertyHint.Range, "0,5") ] public float distortionAmount = 0.5f; [Export( PropertyHint.Range, "0,360") ] @@ -54,6 +66,19 @@ namespace Rokojori public float blueShift = 0f; [ExportGroup( "Luma")] + + [Export( PropertyHint.Range, "0,10") ] + public int blurRadiusX = 0; + + [Export( PropertyHint.Range, "0,10") ] + public int blurRadiusY = 0; + + [Export( PropertyHint.Range, "1,10") ] + public float blurSpread = 1f; + + [Export( PropertyHint.Range, "0,100") ] + public float blurNoise = 0f; + [Export] public Color lumaTint = Colors.White; @@ -76,7 +101,7 @@ namespace Rokojori public float desaturation = 1f; - int _downSampling = 16; + int _downSampling = 16; public enum DownSampling { @@ -96,10 +121,13 @@ namespace Rokojori CEG_ScreenColorTexure screenColorTexture; CEG_BufferTexture bufferTexture; + CEG_BufferTexture bufferTexture2; RG_ExtractGlow extractGlow; + RG_GaussBlur lumaBlurX; + RG_GaussBlur lumaBlurY; - int maxBlooms = 10; + int maxBlooms = 16; List _blooms = []; @@ -109,6 +137,10 @@ namespace Rokojori { screenColorTexture = new CEG_ScreenColorTexure( graph ); bufferTexture = CEG_BufferTexture.ScreenSize( graph, Vector2.One / (float) _downSampling ); + bufferTexture2 = CEG_BufferTexture.ScreenSize( graph, Vector2.One / (float) _downSampling ); + + lumaBlurX = new RG_GaussBlur( graph ); + lumaBlurY = new RG_GaussBlur( graph ); extractGlow = new RG_ExtractGlow( graph ); @@ -125,6 +157,13 @@ namespace Rokojori extractGlow.SetTextureSlotInputs( screenColorTexture, bufferTexture ); extractGlow.input.UseSampler(); + lumaBlurX.SetTextureSlotInputs( bufferTexture, bufferTexture2 ); + lumaBlurX.input.UseSampler(); + + lumaBlurY.SetTextureSlotInputs( bufferTexture2, bufferTexture ); + lumaBlurY.input.UseSampler(); + + _blooms.ForEach( ( b )=> { @@ -135,8 +174,11 @@ namespace Rokojori graph.SetProcessOrder( screenColorTexture, - bufferTexture, - extractGlow + bufferTexture, + bufferTexture2, + extractGlow, + lumaBlurX, + lumaBlurY ); } @@ -149,9 +191,12 @@ namespace Rokojori { _downSampling = downSamplingRate; ( bufferTexture.GetCreator() as CEG_TextureCreator_ScreenSize ).scale = Vector2.One / (float) _downSampling; + ( bufferTexture2.GetCreator() as CEG_TextureCreator_ScreenSize ).scale = Vector2.One / (float) _downSampling; } extractGlow.SetCustomComputeSize( context.internalSize / _downSampling ); + lumaBlurX.SetCustomComputeSize( context.internalSize / _downSampling ); + lumaBlurY.SetCustomComputeSize( context.internalSize / _downSampling ); extractGlow.constants.Set( lumaWeights.X, @@ -175,14 +220,41 @@ namespace Rokojori 0f ); + lumaBlurX.constants.Set( + 1f, + blurNoise, + blurSpread, + 0f, + + (float)Mathf.Max( 1.0, blurRadiusX ), + 0f, + 0f, + 0f + ); + + lumaBlurY.constants.Set( + 1f, + blurNoise, + blurSpread, + 0f, + + 0f, + (float)Mathf.Max( 1.0, blurRadiusY ), + 0f, + 0f + ); + if ( _lastNum != num ) { _lastNum = num; var list = new List(){ screenColorTexture, - bufferTexture, - extractGlow + bufferTexture, + bufferTexture2, + extractGlow, + lumaBlurX, + lumaBlurY }; for ( int i = 0; i < num; i++ ) @@ -202,7 +274,15 @@ namespace Rokojori for ( int i = 0; i < num; i++ ) { - float angleOffset = 180f / (float) num; + + float angleOffset = 180f; + + if ( rotationMode == RotationMode.Full_for_Uneven ) + { + angleOffset = 360f; + } + + angleOffset /= (float) num; _blooms[ i ].constants.Set( amount, @@ -217,7 +297,7 @@ namespace Rokojori distortionOffset.X, distortionOffset.Y, - 0f, + blendMode, 0f ); } diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs new file mode 100644 index 0000000..9850f51 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs @@ -0,0 +1,358 @@ + +using Godot; +using System.Collections.Generic; +using System.Linq; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class GhostBloomEffect:RDGraphCompositorEffect + { + public GhostBloomEffect():base() + { + Initialize(); + } + + [ExportGroup( "Main")] + [Export( PropertyHint.Range, "0,1") ] + public float amount = 0.5f; + + + + [ExportGroup( "Luma")] + [Export] + public Color lumaTint = Colors.White; + + [Export( PropertyHint.Range, "0,10") ] + public int blurRadius = 0; + + [Export( PropertyHint.Range, "0,10") ] + public int blurRadiusX = 0; + + [Export( PropertyHint.Range, "0,10") ] + public int blurRadiusY = 0; + + [Export( PropertyHint.Range, "1,10") ] + public float blurSpread = 1f; + + [Export( PropertyHint.Range, "0,100") ] + public float blurNoise = 0f; + + [Export] + public Vector3 lumaWeights = new Vector3( 0.3f, 0.5f, 0.2f ); + + [Export] + public float lumaWeightPower =1f; + + [Export] + public Vector2 lumaInputRange = new Vector2( 0.5f, 1.5f ); + + [Export] + public float lumaNormalizationPower = 1f; + + [Export] + public Vector2 lumaOutputRange = new Vector2( 0f, 1.5f ); + + [Export] + public float desaturation = 1f; + + + int _downSampling = 16; + + public enum DownSampling + { + _1x_, + _2x_, + _4x_, + _8x_, + _16x_, + _32x_ + } + + public int downSamplingRate => Mathf.RoundToInt( Mathf.Pow( 2, (int) downSampling ) ); + + [Export] + public DownSampling downSampling = DownSampling._4x_; + + [ExportGroup( "Ghost Layers")] + + [Export] + public Vector2 pivotOffset = Vector2.Zero; + + [Export] + public float scaleXYMultiplier = 1f; + + [Export] + public Vector2 scaleXYIndexMultiplier = new Vector2( 1f, 1f ); + + [Export] + public Vector2 scaleMultiplier = Vector2.One; + + [Export] + public Texture2D fading; + + [Export] + public Texture2D radialFading; + + [Export] + public GhostBloomSettings[] layerSettings = []; + + CEG_ScreenColorTexure screenColorTexture; + CEG_BufferTexture bufferTexture; + CEG_BufferTexture bufferTexture2; + RG_ImageTexture fadingTexture; + RG_ImageTexture radialFadingTexture; + + + RG_ExtractGlow extractGlow; + RG_GaussBlur lumaBlurX; + RG_GaussBlur lumaBlurY; + + int maxBlooms = 16; + + + List _blooms = []; + + + void Initialize() + { + screenColorTexture = new CEG_ScreenColorTexure( graph ); + bufferTexture = CEG_BufferTexture.ScreenSize( graph, Vector2.One / (float) _downSampling ); + bufferTexture2 = CEG_BufferTexture.ScreenSize( graph, Vector2.One / (float) _downSampling ); + fadingTexture = new RG_ImageTexture( graph ); + radialFadingTexture = new RG_ImageTexture( graph ); + + lumaBlurX = new RG_GaussBlur( graph ); + lumaBlurY = new RG_GaussBlur( graph ); + + extractGlow = new RG_ExtractGlow( graph ); + + _blooms = new List(); + + for ( int i = 0; i < maxBlooms; i++ ) + { + var b = new RG_GhostBloom( graph ); + _blooms.Add( b ); + } + + graph.InitializeNodes(); + + extractGlow.SetTextureSlotInputs( screenColorTexture, bufferTexture ); + extractGlow.input.UseSampler(); + + lumaBlurX.SetTextureSlotInputs( bufferTexture, bufferTexture2 ); + lumaBlurX.input.UseSampler(); + + lumaBlurY.SetTextureSlotInputs( bufferTexture2, bufferTexture ); + lumaBlurY.input.UseSampler(); + + _blooms.ForEach( + ( b )=> + { + b.SetTextureSlotInputs( bufferTexture, screenColorTexture ); + b.input.UseSampler(); + + b.AddSampledTextureSlotInput( fadingTexture ); + b.AddSampledTextureSlotInput( radialFadingTexture ); + } + ); + + graph.SetProcessOrder( + screenColorTexture, + bufferTexture, + bufferTexture2, + fadingTexture, + radialFadingTexture, + extractGlow, + lumaBlurX, + lumaBlurY + ); + + } + + int _lastNum = -1; + + void IterateLayers( System.Action callback ) + { + if ( layerSettings == null ) + { + return; + } + + var index = 0; + + for ( int i = 0; i < layerSettings.Length; i++ ) + { + if ( layerSettings[ i ] == null ) + { + continue; + } + + for ( int j = 0; j < layerSettings[ i ].numInstances; j++ ) + { + callback( layerSettings[ i ], index ); + index++; + } + } + } + + int NumLayers() + { + var num = 0; + + IterateLayers( ( l, i ) => num ++ ); + + return num; + } + + + protected override void ForAllViews() + { + fadingTexture.SetImageTexture( fading ); + radialFadingTexture.SetImageTexture( radialFading ); + + if ( downSamplingRate != _downSampling ) + { + _downSampling = downSamplingRate; + ( bufferTexture.GetCreator() as CEG_TextureCreator_ScreenSize ).scale = Vector2.One / (float) _downSampling; + ( bufferTexture2.GetCreator() as CEG_TextureCreator_ScreenSize ).scale = Vector2.One / (float) _downSampling; + } + + extractGlow.SetCustomComputeSize( context.internalSize / _downSampling ); + lumaBlurX.SetCustomComputeSize( context.internalSize / _downSampling ); + lumaBlurY.SetCustomComputeSize( context.internalSize / _downSampling ); + + + extractGlow.constants.Set( + lumaWeights.X, + lumaWeights.Y, + lumaWeights.Z, + lumaWeightPower, + + lumaInputRange.X, + lumaInputRange.Y, + lumaNormalizationPower, + lumaOutputRange.X, + + lumaOutputRange.Y, + desaturation, + lumaTint.R, + lumaTint.G, + + lumaTint.B, + 0f, + 0f, + 0f + ); + + lumaBlurX.constants.Set( + 1f, + blurNoise, + blurSpread, + 0f, + + (float)( blurRadiusX + blurRadius ), + 0f, + 0f, + 0f + ); + + lumaBlurY.constants.Set( + 1f, + blurNoise, + blurSpread, + 0f, + + 0f, + (float)( blurRadiusY + blurRadius ), + 0f, + 0f + ); + + var num = NumLayers(); + num = Mathf.Min( num, _blooms.Count ); + + if ( _lastNum != num ) + { + _lastNum = num; + + var list = new List(){ + screenColorTexture, + bufferTexture, + bufferTexture2, + fadingTexture, + radialFadingTexture, + extractGlow, + lumaBlurX, + lumaBlurY + }; + + for ( int i = 0; i < num; i++ ) + { + list.Add( _blooms[ i ] ); + } + + graph.SetProcessOrder( list.ToArray() ); + } + + + var scaleX = scaleMultiplier.X * scaleXYMultiplier; + var scaleY = scaleMultiplier.Y * scaleXYMultiplier; + + + var indexNormalizer = 1f / num; + + IterateLayers( + ( settings, i )=> + { + float t = i * indexNormalizer; + float indexScale = Mathf.Lerp( scaleXYIndexMultiplier.X, scaleXYIndexMultiplier.Y, t ); + + _blooms[ i ].constants.Set( + amount * settings.intensity, + 1.0f + settings.redShift, + 1.0f + settings.greenShift, + 1.0f + settings.blueShift, + + (float) settings.smearingSteps, + settings.smearing, + settings.distortionAmount, + settings.distortionAngle / 180f * Mathf.Pi, + + settings.offset.X, + settings.offset.Y, + indexScale * scaleX * settings.scaleXY * settings.scale.X * (settings.mirrorX ? -1f : 1f ), + indexScale * scaleY * settings.scaleXY * settings.scale.Y * ( settings.mirrorY ? -1f : 1f ), + + settings.rotation, + settings.pivot.X + pivotOffset.X, + settings.pivot.Y + pivotOffset.Y, + (float) settings.blurRadius, + + settings.blurSpread, + settings.ellipseAmount, + settings.ellipseSizeXY * settings.ellipseSize.X, + settings.ellipseSizeXY * settings.ellipseSize.Y, + + settings.ellipseMinDistance, + settings.ellipseKeepRatio, + settings.distortionAngleFromEllipse, + settings.radialFadingWrapping, + + settings.blendMode, + 0f, + 0f, + 0f + + ); + } + ); + + + + } + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs.uid new file mode 100644 index 0000000..39a87bd --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs.uid @@ -0,0 +1 @@ +uid://c3ipi4e85bp0r diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs new file mode 100644 index 0000000..8f8a1c0 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs @@ -0,0 +1,100 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class GhostBloomSettings:Resource + { + [Export] + public string info; + + [ExportGroup( "Main")] + [Export( PropertyHint.Range, "0,1") ] + public float intensity = 0.1f; + + [Export( PropertyHint.Range, "1,16") ] + public int numInstances = 1; + + [Export( PropertyHint.Range, "0,1") ] + public float blendMode = 0.5f; + + [ExportGroup( "UV Ellipse", "ellipse")] + [Export( PropertyHint.Range, "-2,2") ] + public float ellipseAmount = 0.5f; + + [Export( PropertyHint.Range, "0,10") ] + public Vector2 ellipseSize = Vector2.One * 0.5f; + + [Export( PropertyHint.Range, "0,10") ] + public float ellipseSizeXY = 1f; + + [Export( PropertyHint.Range, "-10,10") ] + public float ellipseMinDistance = 0.5f; + + [Export( PropertyHint.Range, "0,1") ] + public float ellipseKeepRatio = 0.5f; + + [Export( PropertyHint.Range, "0,100") ] + public float radialFadingWrapping; + + + [ExportGroup( "UV Transform")] + + [Export( PropertyHint.Range, "-360,360") ] + public float rotation = 0; + + [Export] + public Vector2 offset = new Vector2( 0f, 0f ); + + [Export] + public Vector2 scale = Vector2.One; + + [Export] + public float scaleXY = 1f; + + [Export] + public bool mirrorX = false; + + [Export] + public bool mirrorY = false; + + [Export] + public Vector2 pivot = new Vector2( 0.5f, 0.5f ); + + [ExportGroup( "Distortion")] + [Export( PropertyHint.Range, "0,1") ] + public float distortionAmount = 0.5f; + + [Export( PropertyHint.Range, "0,360") ] + public float distortionAngle = 0.5f; + + [Export( PropertyHint.Range, "0,1") ] + public float distortionAngleFromEllipse = 0.5f; + + [Export( PropertyHint.Range, "1,32") ] + public int smearingSteps = 5; + + [Export( PropertyHint.Range, "1,1.5") ] + public float smearing = 1.1f; + + [Export( PropertyHint.Range, "-1,1") ] + public float redShift = 0.1f; + + [Export( PropertyHint.Range, "-1,1") ] + public float greenShift = 0f; + + [Export( PropertyHint.Range, "-1,1") ] + public float blueShift = 0f; + + [Export( PropertyHint.Range, "0,5") ] + public int blurRadius = 0; + + [Export( PropertyHint.Range, "1,10") ] + public float blurSpread = 1f; + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs.uid new file mode 100644 index 0000000..9cbc2c9 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs.uid @@ -0,0 +1 @@ +uid://bmn34jsmjx7j8 diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs new file mode 100644 index 0000000..6cc0202 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs @@ -0,0 +1,455 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class MaxBloomEffect:RDGraphCompositorEffect + { + public MaxBloomEffect():base() + { + Initialize(); + } + + [ExportGroup( "Main")] + [Export( PropertyHint.Range, "0,1") ] + public float amount = 0.5f; + + public enum Direction + { + Horizontal, + Vertical + } + + [Export ] + public Direction direction = Direction.Horizontal; + + [Export( PropertyHint.Range, "0,1") ] + public float blendMode = 0.5f; + + public enum MaxBlurMode + { + Maximum_per_Component, + Average_of_All + } + + [Export] + public MaxBlurMode maxBlurMode; + + [Export] + public Texture2D inputFading; + + [Export] + public Texture2D outputFading; + + [Export] + public Texture2D tint; + + [Export] + public Vector2 tintScale = Vector2.One; + + [Export] + public float tintScaleXY = 1f; + + [Export] + public Vector2 tintOffset = Vector2.Zero; + + [ExportGroup( "Distortion")] + + [Export( PropertyHint.Range, "0,5") ] + public float distortionAmount = 0.5f; + + [Export( PropertyHint.Range, "-1,1") ] + public float offset = 0f; + + [Export( PropertyHint.Range, "1,32") ] + public int smearingSteps = 5; + + [Export( PropertyHint.Range, "1,1.5") ] + public float smearing = 1.1f; + + [Export( PropertyHint.Range, "-1,1") ] + public float redShift = 0.1f; + + [Export( PropertyHint.Range, "-1,1") ] + public float greenShift = 0f; + + [Export( PropertyHint.Range, "-1,1") ] + public float blueShift = 0f; + + [ExportGroup( "Luma")] + + // [Export( PropertyHint.Range, "0,10") ] + // public int blurRadiusX = 0; + + // [Export( PropertyHint.Range, "0,10") ] + // public int blurRadiusY = 0; + + // [Export( PropertyHint.Range, "1,10") ] + // public float blurSpread = 1f; + + // [Export( PropertyHint.Range, "0,100") ] + // public float blurNoise = 0f; + + [Export] + public Color lumaTint = Colors.White; + + [Export] + public Vector3 lumaWeights = new Vector3( 0.3f, 0.5f, 0.2f ); + + [Export] + public float lumaWeightPower =1f; + + [Export] + public Vector2 lumaInputRange = new Vector2( 0.5f, 1.5f ); + + [Export] + public float lumaNormalizationPower = 1f; + + [Export] + public Vector2 lumaOutputRange = new Vector2( 0f, 1.5f ); + + [Export] + public float desaturation = 1f; + + + // int _downSampling = 16; + + // public enum DownSampling + // { + // _1x_, + // _2x_, + // _4x_, + // _8x_, + // _16x_, + // _32x_ + // } + + // public int downSamplingRate => Mathf.RoundToInt( Mathf.Pow( 2, (int) downSampling ) ); + + // [Export] + // public DownSampling downSampling = DownSampling._4x_; + + + CEG_ScreenColorTexure screenColorTexture; + CEG_BufferTexture bufferTexture; + CEG_BufferTexture bufferTexture2; + RG_ImageTexture inputFadeTexture; + RG_ImageTexture outputFadeTexture; + RG_ImageTexture tintTexture; + + + RG_FadedMaxBlur firstMaxBlur; + RG_SwapRepeat swapRepeat; + RG_MaxBlur maxBlur; + RG_MaxBloom maxBloom; + + RG_ExtractGlowPartial extractGlow; + + + RG_Fill fill; + void Initialize() + { + screenColorTexture = new CEG_ScreenColorTexure( graph ); + bufferTexture = CEG_BufferTexture.ScreenSize( graph ); + bufferTexture2 = CEG_BufferTexture.ScreenSize( graph ); + inputFadeTexture = new RG_ImageTexture( graph ); + outputFadeTexture = new RG_ImageTexture( graph ); + tintTexture = new RG_ImageTexture( graph ); + + fill = new RG_Fill( graph ); + + firstMaxBlur = new RG_FadedMaxBlur( graph ); + + swapRepeat = new RG_SwapRepeat( graph ); + maxBlur = new RG_MaxBlur( graph ); + + extractGlow = new RG_ExtractGlowPartial( graph ); + + maxBloom = new RG_MaxBloom( graph ); + + graph.InitializeNodes(); + + fill.SetTextureSlotInput( bufferTexture ); + + firstMaxBlur.SetTextureSlotInputs( screenColorTexture, bufferTexture ); + firstMaxBlur.AddSampledTextureSlotInput( inputFadeTexture ); + + swapRepeat.SetTextureSlotInputs( bufferTexture, bufferTexture2 ); + + extractGlow.SetTextureSlotInputs( bufferTexture2, bufferTexture2 ); + + maxBloom.SetTextureSlotInputs( bufferTexture2, screenColorTexture ); + maxBloom.input.UseNearestSamplerEdgeClamped(); + + maxBloom.AddSampledTextureSlotInput( outputFadeTexture ); + maxBloom.AddSampledTextureSlotInput( tintTexture ); + + + swapRepeat.imageProcessor = maxBlur; + + + graph.SetProcessOrder( + screenColorTexture, + bufferTexture, + bufferTexture2, + inputFadeTexture, + outputFadeTexture, + tintTexture, + + fill, + firstMaxBlur, + swapRepeat, + extractGlow, + maxBloom + ); + + } + + [Export] + public bool refresh = false; + + + protected override void ForAllViews() + { + inputFadeTexture.SetImageTexture( inputFading ); + outputFadeTexture.SetImageTexture( outputFading ); + tintTexture.SetImageTexture( tint ); + + fill.constants.Set( new Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) ); + + // context.messageLogLevel = verbose ? Messages.GetLevel( MessageType.Verbose ) : Messages.GetLevel( MessageType.Info ); + + var isX = Direction.Horizontal == direction; + + var sizeX = context.internalSize.X; + var sizeY = context.internalSize.Y; + + var edge = isX ? sizeY : sizeX; + + + CreateReductionSteps( edge ); + + var size = isX ? new Vector2I( sizeX, ReducedEdgeAtStep( 0 ) ): + new Vector2I( ReducedEdgeAtStep( 0 ), sizeY ); + + var firstSize = size; + var mode = isX ? 0 : 1; + + + firstMaxBlur.SetCustomComputeSize( size ); + firstMaxBlur.constants.Set( + (float)size.X, + (float)size.Y, + (float)mode, + (float)EdgeAtStep( 0 ), + + (float)(int)maxBlurMode, + 1f, + 0f, + 0f + ); + + + swapRepeat.repeats = numRepeats; + + + if ( refresh || swapRepeat.repeats != _lastRepeats ) + { + refresh = false; + _lastRepeats = swapRepeat.repeats; + + if ( _lastRepeats % 2 == 1 ) + { + maxBloom.input.ReplaceInput( bufferTexture, bufferTexture2 ); + extractGlow.input.ReplaceInput( bufferTexture, bufferTexture2 ); + extractGlow.output.ReplaceInput( bufferTexture, bufferTexture2 ); + + } + else + { + maxBloom.input.ReplaceInput( bufferTexture2, bufferTexture ); + extractGlow.input.ReplaceInput( bufferTexture2, bufferTexture ); + extractGlow.output.ReplaceInput( bufferTexture2, bufferTexture ); + + } + } + + + swapRepeat.onPreProcess = ( int p ) => + { + var stepIndex = p + 1; + + if ( isX ) + { + size.Y = ReducedEdgeAtStep( stepIndex ); + } + else + { + size.X = ReducedEdgeAtStep( stepIndex ); + } + + maxBlur.SetCustomComputeSize( size ); + + + maxBlur.constants.Set( + (float)size.X, + (float)size.Y, + (float)mode, + (float)EdgeAtStep( stepIndex ), + + (float)(int)maxBlurMode, + 0f, + 0f, + 0f + ); + }; + + var lumaSize = isX ? new Vector2I( sizeX, 1 ) : new Vector2I( 1, sizeY ); + + // this.LogInfo( lumaSize ); + extractGlow.SetCustomComputeSize( lumaSize ); + extractGlow.constants.Set( + lumaWeights.X, + lumaWeights.Y, + lumaWeights.Z, + lumaWeightPower, + + lumaInputRange.X, + lumaInputRange.Y, + lumaNormalizationPower, + lumaOutputRange.X, + + lumaOutputRange.Y, + desaturation, + lumaTint.R, + lumaTint.G, + + lumaTint.B, + (float)lumaSize.X, + (float)lumaSize.Y, + 0f + ); + + + maxBloom.constants.Set( + amount, + 1.0f + redShift, + 1.0f + greenShift, + 1.0f + blueShift, + + (float) smearingSteps, + smearing, + distortionAmount, + blendMode, + + (float) mode, + offset, + tintOffset.X, + tintOffset.Y, + + tintScaleXY * tintScale.X, + tintScaleXY * tintScale.Y, + 0f, + 0f + + + ); + + + + + } + + + int _lastRepeats = -1; + + int ToEven( int x ) + { + if ( x % 2 == 0 ) + { + return x; + } + + return x + 1; + } + + int _lastEdge = -1; + List reductionSteps = new List(); + + public int EdgeAtStep( int i ) + { + return reductionSteps[ i ]; + } + + public int ReducedEdgeAtStep( int i ) + { + return reductionSteps[ i + 1 ]; + } + + public int numSteps => reductionSteps.Count - 1; + public int numRepeats => numSteps - 1; + + [Export] + public int testEdge = 100; + + [ExportToolButton( "Log Steps")] + public Callable logger => Callable.From( + ( )=> + { + CreateReductionSteps( testEdge ); + + this.LogInfo( reductionSteps ); + + for ( int i = 0; i < reductionSteps.Count - 1; i++ ) + { + this.LogInfo( "Input:" + EdgeAtStep( i ), "Output: " + ReducedEdgeAtStep( i ) ); + } + } + ); + + void CreateReductionSteps( int edge ) + { + if ( _lastEdge == edge && reductionSteps.Count > 1 ) + { + return; + } + + reductionSteps = []; + + var it = edge; + + reductionSteps.Add( it ); + + var b = it; + it = it / 2; + + if ( it * 2 < b ) + { + it ++; + } + + while ( it > 1 ) + { + reductionSteps.Add( it ); + + var before = it; + it = it / 2; + + if ( it * 2 < before ) + { + it ++; + } + } + + reductionSteps.Add( 1 ); + + _lastEdge = edge; + + } + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs.uid new file mode 100644 index 0000000..9a61145 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs.uid @@ -0,0 +1 @@ +uid://b7dy5mtxvj22k diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs new file mode 100644 index 0000000..6b36c48 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs @@ -0,0 +1,210 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class RingBloomEffect:RDGraphCompositorEffect + { + public RingBloomEffect():base() + { + Initialize(); + } + + [ExportGroup( "Main")] + [Export( PropertyHint.Range, "0,1") ] + public float amount = 0.25f; + + [Export( PropertyHint.Range, "0,2") ] + public float ringSizeXY = 0.05f; + + [Export( PropertyHint.Range, "0,1") ] + public Vector2 ringSizeScale = Vector2.One; + + + [Export( PropertyHint.Range, "4,64") ] + public int ringResolution; + + [Export( PropertyHint.Range, "0,1") ] + public float blendMode = 0.5f; + + [Export] + public Vector2 zRange = new Vector2( 10, 200 ); + + [Export] + public CurveTexture zMapping = new CurveTexture().WithCurve( new Curve().WithValues( 0f, 1f, 0f ) ). + WithResolution( 64 ); + + [ExportGroup( "Smearing")] + [Export( PropertyHint.Range, "0,0.5") ] + public float distortionAmount = 0.1f; + + [Export( PropertyHint.Range, "1,32") ] + public int smearingSteps = 5; + + [Export( PropertyHint.Range, "1,1.5") ] + public float smearing = 1.1f; + + [Export( PropertyHint.Range, "-1,1") ] + public float redShift = 0.1f; + + [Export( PropertyHint.Range, "-1,1") ] + public float greenShift = 0f; + + [Export( PropertyHint.Range, "-1,1") ] + public float blueShift = 0f; + + [ExportGroup( "Luma")] + [Export] + public Vector2 lumaInputRange = new Vector2( 0.5f, 1.5f ); + + [Export( PropertyHint.Range, "-1,1") ] + public float lumaNormalizationPower = 1f; + + [Export] + public Vector2 lumaOutputRange = new Vector2( 0f, 1.5f ); + + [Export] + public float desaturation = 1f; + + [Export] + public Color lumaTint = Colors.White; + + + int _downSampling = 16; + + public enum DownSampling + { + _1x_, + _2x_, + _4x_, + _8x_, + _16x_, + _32x_ + } + + public int downSamplingRate => Mathf.RoundToInt( Mathf.Pow( 2, (int) downSampling ) ); + + [Export] + public DownSampling downSampling = DownSampling._4x_; + + + CEG_ScreenColorTexure screenColorTexture; + CEG_ScreenDepthTexture screenDepthTexture; + CEG_BufferTexture bufferTexture; + RG_ImageTexture zMappingTexture; + + RG_ExtractGlowLine extractGlowLine; + + int maxBlooms = 3; + + + RG_RingBloom bloom; + + + void Initialize() + { + screenColorTexture = new CEG_ScreenColorTexure( graph ); + screenDepthTexture = new CEG_ScreenDepthTexture( graph ); + bufferTexture = CEG_BufferTexture.ScreenSize( graph, Vector2.One / (float) _downSampling ); + zMappingTexture = new RG_ImageTexture( graph ); + + extractGlowLine = new RG_ExtractGlowLine( graph ); + + bloom = new RG_RingBloom( graph ); + + + graph.InitializeNodes(); + + extractGlowLine.SetTextureSlotInputs( screenColorTexture, bufferTexture ); + extractGlowLine.AddSampledTextureSlotInput( screenDepthTexture ); + extractGlowLine.AddSampledTextureSlotInput( zMappingTexture ); + + extractGlowLine.input.UseSampler(); + + + + bloom.SetTextureSlotInputs( bufferTexture, screenColorTexture ); + bloom.input.UseSampler(); + + + + graph.SetProcessOrder( + screenColorTexture, + screenDepthTexture, + bufferTexture, + zMappingTexture, + extractGlowLine, + bloom + ); + + } + + + protected override void ForAllViews() + { + if ( downSamplingRate != _downSampling ) + { + _downSampling = downSamplingRate; + ( bufferTexture.GetCreator() as CEG_TextureCreator_ScreenSize ).scale = Vector2.One / (float) _downSampling; + } + + var projection = context.GetCameraProjection().Inverse(); + + extractGlowLine.SetCustomComputeSize( context.internalSize / _downSampling ); + zMappingTexture.SetImageTexture( zMapping ); + + extractGlowLine.constants.Set( + + projection.X, + projection.Y, + projection.Z, + projection.W, + + lumaInputRange.X, + lumaInputRange.Y, + Mathf.Pow( 10, lumaNormalizationPower ), + lumaOutputRange.X, + + lumaOutputRange.Y, + desaturation, + lumaTint.R, + lumaTint.G, + + lumaTint.B, + zRange.X, + zRange.Y, + 0f + ); + + + + bloom.constants.Set( + + amount, + 1.0f + redShift, + 1.0f + greenShift, + 1.0f + blueShift, + + (float) smearingSteps, + smearing, + (float) ringResolution, + ringSizeXY * ringSizeScale.X, + + ringSizeXY * ringSizeScale.Y, + distortionAmount, + blendMode, + 0f + + + ); + + + + } + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs.uid new file mode 100644 index 0000000..870efab --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs.uid @@ -0,0 +1 @@ +uid://di2ro5eatxy0c diff --git a/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs index fcf86c8..29082d2 100644 --- a/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs @@ -21,6 +21,15 @@ namespace Rokojori [Export] public RG_BlendModeType blendMode = RG_BlendModeType.Alpha; + public enum UVMode + { + Rectangle, + Ellipse + } + + [Export] + public UVMode uvMode = UVMode.Rectangle; + [ExportGroup("Overlay")] [Export] @@ -41,6 +50,9 @@ namespace Rokojori [Export] public Vector2 scrolling = Vector2.Zero; + [Export] + public float scrollingFPS = 60f; + [Export] public TimeLine scrollTimeline; @@ -53,7 +65,12 @@ namespace Rokojori [ExportGroup("Mask")] [Export] public Texture2D maskTexture; - + + [Export] + public CurveTexture alphaMapping = new CurveTexture().WithCurve( new Curve().WithValues( 0, 1 ) ) + .WithResolution( 256 ) + .WithTextureMode( CurveTexture.TextureModeEnum.Red ); + [Export] public ColorSpaceConversion maskOverlayConversion = ColorSpaceConversion.sRGB_to_Linear; @@ -67,6 +84,9 @@ namespace Rokojori [Export] public Vector2 maskScrolling = Vector2.Zero; + [Export] + public float maskScrollingFPS = 60f; + [Export] public TimeLine maskScrollTimeline; @@ -85,6 +105,7 @@ namespace Rokojori RG_ImageTexture _topTexture; RG_ImageTexture _maskTexture; + RG_ImageTexture _alphaMappingTexture; CEG_ScreenColorTexure _bottomTexture; CEG_ScreenColorTexure _outputTexture; @@ -103,6 +124,7 @@ namespace Rokojori { _topTexture = new RG_ImageTexture( graph ); _maskTexture = new RG_ImageTexture( graph ); + _alphaMappingTexture = new RG_ImageTexture( graph ); _bottomTexture = new CEG_ScreenColorTexure( graph ); _outputTexture = new CEG_ScreenColorTexure( graph ); @@ -113,10 +135,11 @@ namespace Rokojori _blendModes.ForEach( ( bm )=> { - bm.SetTextureSlotInputs( _topTexture, _maskTexture, _bottomTexture, _outputTexture ); + bm.SetTextureSlotInputs( _topTexture, _maskTexture, _alphaMappingTexture, _bottomTexture, _outputTexture ); bm.top.sampler = context.Sampler( assignedfilterTop, assignedRepeatModeTop ); bm.mask.sampler = context.Sampler( assignedfilterMask, assignedRepeatModeMask ); + bm.alphaMapping.sampler = context.Sampler( RenderingDevice.SamplerFilter.Linear, RenderingDevice.SamplerRepeatMode.ClampToEdge ); bm.bottom.sampler = context.Sampler( RenderingDevice.SamplerFilter.Nearest, RenderingDevice.SamplerRepeatMode.ClampToEdge ); } @@ -127,6 +150,7 @@ namespace Rokojori graph.SetProcessOrder( _topTexture, _maskTexture, + _alphaMappingTexture, _bottomTexture, _outputTexture, RG_BlendModesTool.GetCurrentBlendMode( _blendModes, _assignBlendMode ) @@ -146,6 +170,7 @@ namespace Rokojori graph.SetProcessOrder( _topTexture, _maskTexture, + _alphaMappingTexture, _bottomTexture, _outputTexture, RG_BlendModesTool.GetCurrentBlendMode( _blendModes, _assignBlendMode ) @@ -175,14 +200,32 @@ namespace Rokojori _topTexture.SetImageTexture( overlayTexture ); _maskTexture.SetImageTexture( maskTexture ); + _alphaMappingTexture.SetImageTexture( alphaMapping ); var timeLine = TimeLineManager.Ensure( scrollTimeline ); - var scrollPosition = timeLine.position * scrolling; + var timelinePosition = timeLine.position; + + if ( scrollingFPS > 0f ) + { + var step = 1f / scrollingFPS; + timelinePosition = MathX.SnapFloored( timelinePosition, step ); + } + + var scrollPosition = timelinePosition * scrolling; scrollPosition.X = MathX.Repeat( scrollPosition.X, 1.0f ); scrollPosition.Y = MathX.Repeat( scrollPosition.Y, 1.0f ); var timeLineMask = TimeLineManager.Ensure( maskScrollTimeline ); - var scrollPositionMask = timeLineMask.position * maskScrolling; + + float maskPosition = timeLineMask.position; + + if ( maskScrollingFPS > 0f ) + { + float stepTime = 1.0f / maskScrollingFPS; + maskPosition = MathX.SnapFloored( maskPosition, stepTime ); + } + + var scrollPositionMask = maskPosition * maskScrolling; scrollPositionMask.X = MathX.Repeat( scrollPositionMask.X, 1.0f ); scrollPositionMask.Y = MathX.Repeat( scrollPositionMask.Y, 1.0f ); @@ -192,12 +235,15 @@ namespace Rokojori new Vector4( maskTiling.X, maskTiling.Y, maskOffset.X + scrollPositionMask.X, maskOffset.Y + scrollPositionMask.Y ), new Vector4( 1f, 1f, 0f, 0f ), overlayTint, + opacity, (float)(int)overlayConversion, (float)(int)maskOverlayConversion, (float)(int)screenConversion, + (float)(int)outputConversion, - 1f + 1f, + (float)(int)uvMode ] ); diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Blur/Overlayed Bokeh Blur .tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Blur/Overlayed Bokeh Blur .tres new file mode 100644 index 0000000..21a72a9 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Blur/Overlayed Bokeh Blur .tres @@ -0,0 +1,202 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=37 format=3 uid="uid://cr7dvu2sqcidy"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_rjlrx"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_7bkgv"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_pjafb"] +[ext_resource type="Script" uid="uid://dqsxgtt4e6vwu" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/BoxBlur/BoxBlurEffect.cs" id="4_yrk01"] +[ext_resource type="Script" uid="uid://t5g1g1uv5yrj" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs" id="5_e4lq5"] +[ext_resource type="Script" uid="uid://bjxayoleund83" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmearSimple/TemporalSmearSimpleEffect.cs" id="6_soflx"] +[ext_resource type="Script" uid="uid://di2ro5eatxy0c" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs" id="7_be0li"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="8_h2u0p"] + +[sub_resource type="Curve" id="Curve_qrakr"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_seli3"] +script = ExtResource("1_rjlrx") +member = "intensity" +curve = SubResource("Curve_qrakr") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_008mr"] +script = ExtResource("2_7bkgv") + +[sub_resource type="Resource" id="Resource_jxdri"] +script = ExtResource("3_pjafb") +owner = SubResource("Resource_008mr") + +[sub_resource type="CompositorEffect" id="CompositorEffect_rjlrx"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_yrk01") +intensity = 0.0 +noise = 13.8889 +kernelRadius = 3 +iterations = 3 +animationTargets = [SubResource("Resource_seli3")] +compositorEffectID = SubResource("Resource_jxdri") +metadata/_custom_type_script = "uid://dqsxgtt4e6vwu" + +[sub_resource type="Curve" id="Curve_7bkgv"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_pjafb"] +texture_mode = 1 +curve = SubResource("Curve_7bkgv") + +[sub_resource type="Curve" id="Curve_008mr"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_xxny3"] +script = ExtResource("1_rjlrx") +member = "opacity" +curve = SubResource("Curve_008mr") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_tn5uv"] +script = ExtResource("3_pjafb") +owner = SubResource("Resource_008mr") + +[sub_resource type="Gradient" id="Gradient_027rg"] +offsets = PackedFloat32Array(0.098684214, 0.20394737, 0.5781818, 0.83272725, 0.9563636) +colors = PackedColorArray(0.89599997, 0.89599997, 0.89599997, 1, 0.47700718, 0.47700718, 0.47700718, 1, 0, 0, 0, 1, 0.6397059, 0.6397059, 0.6397059, 1, 1, 1, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_6kf7p"] +gradient = SubResource("Gradient_027rg") +fill_from = Vector2(0, 1) +fill_to = Vector2(0, 0) + +[sub_resource type="Gradient" id="Gradient_6xf1f"] +colors = PackedColorArray(0, 0, 0, 0, 1.6260077, 1.6260077, 1.6260077, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_gwku0"] +noise_type = 2 +frequency = 0.0066 +fractal_lacunarity = 2.4785 +fractal_gain = 0.9265 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_fy8er"] +width = 128 +height = 1024 +noise = SubResource("FastNoiseLite_gwku0") +color_ramp = SubResource("Gradient_6xf1f") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_yrk01"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_e4lq5") +opacity = 0.0 +blendMode = 1 +overlayTexture = SubResource("NoiseTexture2D_fy8er") +overlayTint = Color(0, 0.18809195, 3.8326802, 0.16470589) +tiling = Vector2(0.1, 1) +scrolling = Vector2(0.133, 0.0165) +maskTexture = SubResource("GradientTexture2D_6kf7p") +alphaMapping = SubResource("CurveTexture_pjafb") +animationTargets = [SubResource("Resource_xxny3")] +compositorEffectID = SubResource("Resource_tn5uv") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_jpti0"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_nt8a7"] +script = ExtResource("1_rjlrx") +member = "amount" +curve = SubResource("Curve_jpti0") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_0y4dn"] +script = ExtResource("3_pjafb") +owner = SubResource("Resource_008mr") + +[sub_resource type="CompositorEffect" id="CompositorEffect_e4lq5"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_soflx") +amount = 0.0 +smearingFrames = 10.0 +animationTargets = [SubResource("Resource_nt8a7")] +compositorEffectID = SubResource("Resource_0y4dn") +metadata/_custom_type_script = "uid://bjxayoleund83" + +[sub_resource type="Curve" id="Curve_adfmi"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_jvxnt"] +script = ExtResource("1_rjlrx") +member = "amount" +curve = SubResource("Curve_adfmi") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Curve" id="Curve_ade2u"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 0.16842103), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_x0p8u"] +script = ExtResource("1_rjlrx") +member = "ringSizeXY" +curve = SubResource("Curve_ade2u") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_5q01g"] +script = ExtResource("3_pjafb") +owner = SubResource("Resource_008mr") + +[sub_resource type="Curve" id="Curve_krf45"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="CurveTexture" id="CurveTexture_a4g6s"] +width = 64 +curve = SubResource("Curve_krf45") + +[sub_resource type="CompositorEffect" id="CompositorEffect_soflx"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_be0li") +amount = 0.0 +ringSizeXY = 0.0 +ringSizeScale = Vector2(1.0794, 1) +ringResolution = 32 +zMapping = SubResource("CurveTexture_a4g6s") +distortionAmount = 0.1071 +smearingSteps = 12 +smearing = 1.5 +redShift = -1.0 +greenShift = 0.0435 +blueShift = 1.0 +lumaInputRange = Vector2(0.1465, 0.2795) +lumaOutputRange = Vector2(0, 20) +desaturation = 0.0 +animationTargets = [SubResource("Resource_jvxnt"), SubResource("Resource_x0p8u")] +compositorEffectID = SubResource("Resource_5q01g") +metadata/_custom_type_script = "uid://di2ro5eatxy0c" + +[resource] +script = ExtResource("8_h2u0p") +effects = [SubResource("CompositorEffect_rjlrx"), SubResource("CompositorEffect_yrk01"), SubResource("CompositorEffect_e4lq5"), SubResource("CompositorEffect_soflx")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Character/Drunken.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Character/Drunken.tres new file mode 100644 index 0000000..859fdfc --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Character/Drunken.tres @@ -0,0 +1,186 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=32 format=3 uid="uid://ciirupc5c1rvf"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_wx28p"] +[ext_resource type="Resource" uid="uid://bwhnq7w0tpgv" path="res://VFX/Action FX Compositor Effect Layer.tres" id="2_fp4l4"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_ysy1a"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_fp4l4"] +[ext_resource type="Script" uid="uid://cjfxcl3cdhnku" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/LightnessBasedAdjustment/LightnessBasedAdjustmentEffect.cs" id="4_6uu40"] +[ext_resource type="Script" uid="uid://b2oxy6ln560ys" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/ColorQuantizer/ColorQuantizerEffect.cs" id="5_qwq32"] +[ext_resource type="Script" uid="uid://cidk0x7sb1pxl" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/NoiseDistortion/NoiseDistortionEffect.cs" id="6_kwewy"] +[ext_resource type="Script" uid="uid://bjxayoleund83" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmearSimple/TemporalSmearSimpleEffect.cs" id="7_4kq05"] +[ext_resource type="Script" uid="uid://dq0uf1bqoefv" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur2/RadialBlur2.cs" id="8_qmrs8"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="9_srrpj"] + +[sub_resource type="Curve" id="Curve_wvg34"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_72jau"] +script = ExtResource("1_wx28p") +member = "amount" +curve = SubResource("Curve_wvg34") + +[sub_resource type="Resource" id="Resource_fy8er"] +script = ExtResource("2_ysy1a") + +[sub_resource type="Resource" id="Resource_cqn6v"] +script = ExtResource("3_fp4l4") +owner = SubResource("Resource_fy8er") +layer = ExtResource("2_fp4l4") +priority = 1 + +[sub_resource type="CompositorEffect" id="CompositorEffect_6uu40"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_6uu40") +amount = 0.0 +hueShift = Vector3(-0.01, 0, 0.05) +saturationShift = Vector3(0.2225, -0.0175, -0.1) +saturationAmount = 0.7273 +lightnessShift = Vector3(0.05, -0.05, 0.0085) +animationTargets = [SubResource("Resource_72jau")] +compositorEffectID = SubResource("Resource_cqn6v") +metadata/_custom_type_script = "uid://cjfxcl3cdhnku" + +[sub_resource type="Curve" id="Curve_me2ag"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_8b3wv"] +script = ExtResource("1_wx28p") +member = "amount" +curve = SubResource("Curve_me2ag") + +[sub_resource type="Resource" id="Resource_y78fk"] +script = ExtResource("3_fp4l4") +owner = SubResource("Resource_fy8er") +layer = ExtResource("2_fp4l4") +priority = 1 + +[sub_resource type="CompositorEffect" id="CompositorEffect_qwq32"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_qwq32") +amount = 0.0 +redAmount = 0.0 +greenAmount = 0.0 +blueAmount = 0.0 +rgbAmount = 0.0 +hueAmount = 1.0 +hueSteps = 50.0 +saturationAmount = 0.0 +luminanceAmount = 0.2981 +luminanceSteps = 50.9327 +luminanceGamma = -0.4423 +luminanceOffset = 0.8461 +animationTargets = [SubResource("Resource_8b3wv")] +compositorEffectID = SubResource("Resource_y78fk") +metadata/_custom_type_script = "uid://b2oxy6ln560ys" + +[sub_resource type="Curve" id="Curve_yd2p7"] +_limits = [0.0, 0.1, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.026315786, 0, 1, Vector2(1, 0.026315786), 0.026315786, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_ch4em"] +script = ExtResource("1_wx28p") +member = "amount" +curve = SubResource("Curve_yd2p7") + +[sub_resource type="Resource" id="Resource_71075"] +script = ExtResource("3_fp4l4") +owner = SubResource("Resource_fy8er") +layer = ExtResource("2_fp4l4") +priority = 1 + +[sub_resource type="CompositorEffect" id="CompositorEffect_kwewy"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_kwewy") +amount = 0.0 +scale = 5.5463 +smearingSteps = 4 +smearing = 1.1337 +xU = Vector3(0.078, 0.29, 3) +xV = Vector3(0.149, 0.132, 10) +yU = Vector3(0.4285, 0.192, 3) +yV = Vector3(0.0425, 0.042, 6) +animationTargets = [SubResource("Resource_ch4em")] +compositorEffectID = SubResource("Resource_71075") +metadata/_custom_type_script = "uid://cidk0x7sb1pxl" + +[sub_resource type="Curve" id="Curve_uyccs"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 0.5010811), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_uyccs"] +script = ExtResource("1_wx28p") +member = "amount" +curve = SubResource("Curve_uyccs") + +[sub_resource type="Resource" id="Resource_0xdfm"] +script = ExtResource("3_fp4l4") +owner = SubResource("Resource_fy8er") +layer = ExtResource("2_fp4l4") +priority = 1 + +[sub_resource type="CompositorEffect" id="CompositorEffect_4kq05"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_4kq05") +amount = 0.0 +smearingFrames = 32.0 +animationTargets = [SubResource("Resource_uyccs")] +compositorEffectID = SubResource("Resource_0xdfm") +metadata/_custom_type_script = "uid://bjxayoleund83" + +[sub_resource type="Curve" id="Curve_7kss3"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_7kss3"] +script = ExtResource("1_wx28p") +member = "intensity" +curve = SubResource("Curve_7kss3") + +[sub_resource type="Resource" id="Resource_tgjf5"] +script = ExtResource("3_fp4l4") +owner = SubResource("Resource_fy8er") +layer = ExtResource("2_fp4l4") +priority = 1 + +[sub_resource type="CompositorEffect" id="CompositorEffect_qmrs8"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("8_qmrs8") +radius = -0.0045 +intensity = 0.0 +samples = 16.0 +animationTargets = [SubResource("Resource_7kss3")] +compositorEffectID = SubResource("Resource_tgjf5") +metadata/_custom_type_script = "uid://dq0uf1bqoefv" + +[resource] +script = ExtResource("9_srrpj") +effects = [SubResource("CompositorEffect_6uu40"), SubResource("CompositorEffect_qwq32"), SubResource("CompositorEffect_kwewy"), SubResource("CompositorEffect_4kq05"), SubResource("CompositorEffect_qmrs8")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Blue Cinematic Bloom.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Blue Cinematic Bloom.tres new file mode 100644 index 0000000..f349da1 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Blue Cinematic Bloom.tres @@ -0,0 +1,363 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=52 format=3 uid="uid://dke01q2ndmvxe"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_nq6ls"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_k18aw"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_oydfn"] +[ext_resource type="Script" uid="uid://di2ro5eatxy0c" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/RingBloom/RingBloomEffect.cs" id="4_hei5s"] +[ext_resource type="Script" uid="uid://6jkixa201wux" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs" id="5_gfw2j"] +[ext_resource type="Script" uid="uid://bmn34jsmjx7j8" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs" id="6_ll4h8"] +[ext_resource type="Script" uid="uid://c3ipi4e85bp0r" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs" id="7_ruaxh"] +[ext_resource type="Script" uid="uid://cjfxcl3cdhnku" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/LightnessBasedAdjustment/LightnessBasedAdjustmentEffect.cs" id="8_7khkw"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="9_1yxhd"] + +[sub_resource type="Curve" id="Curve_sdunf"] +_limits = [0.0, 0.32, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.2407038, 0, 1, Vector2(1, 0.2407038), 0.2407038, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_p64cs"] +script = ExtResource("1_nq6ls") +member = "amount" +curve = SubResource("Curve_sdunf") + +[sub_resource type="Resource" id="Resource_0c48d"] +script = ExtResource("2_k18aw") + +[sub_resource type="Resource" id="Resource_3tnad"] +script = ExtResource("3_oydfn") +owner = SubResource("Resource_0c48d") + +[sub_resource type="Curve" id="Curve_y3g14"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.087378636, 0.16842103), 8.476556, 8.476556, 0, 0, Vector2(0.17475727, 1), 0.0, 0.0, 0, 0, Vector2(0.43203884, 0.2842105), -1.1083043, -1.1083043, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 5 + +[sub_resource type="CurveTexture" id="CurveTexture_cxc3f"] +width = 64 +curve = SubResource("Curve_y3g14") + +[sub_resource type="CompositorEffect" id="CompositorEffect_nq6ls"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_hei5s") +amount = 0.0 +ringSizeXY = 0.2539 +ringSizeScale = Vector2(1, 0.4915) +ringResolution = 32 +zMapping = SubResource("CurveTexture_cxc3f") +distortionAmount = 0.0824 +smearingSteps = 11 +smearing = 1.5 +redShift = -0.3905 +greenShift = 0.2497 +blueShift = 0.0726 +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 20) +lumaTint = Color(0.28098157, 0.34648013, 1.866067, 1) +downSampling = 1 +animationTargets = [SubResource("Resource_p64cs")] +compositorEffectID = SubResource("Resource_3tnad") +metadata/_custom_type_script = "uid://di2ro5eatxy0c" + +[sub_resource type="Curve" id="Curve_seli3"] +_limits = [0.0, 0.2, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.049413502, 0, 1, Vector2(1, 0.049413502), 0.049413502, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_hpfyh"] +script = ExtResource("1_nq6ls") +member = "amount" +curve = SubResource("Curve_seli3") + +[sub_resource type="Resource" id="Resource_qrakr"] +script = ExtResource("3_oydfn") +owner = SubResource("Resource_0c48d") + +[sub_resource type="CompositorEffect" id="CompositorEffect_k18aw"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_gfw2j") +amount = 0.0 +num = 1 +distortionAmount = 1.0 +distortionAngle = 0.0 +distortionAngleSpeed = 0.0 +distortionOffset = Vector2(0, 0.003) +smearing = 1.1055 +redShift = 0.109 +greenShift = 0.1046 +blueShift = -0.0055 +blurRadiusX = 7 +blurSpread = 2.0 +lumaTint = Color(0, 1.5053356, 4.017721, 1) +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 20) +downSampling = 1 +animationTargets = [SubResource("Resource_hpfyh")] +compositorEffectID = SubResource("Resource_qrakr") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[sub_resource type="Curve" id="Curve_ymqbv"] +_limits = [0.0, 0.25, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 0.18090177), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_cxc3f"] +script = ExtResource("1_nq6ls") +member = "amount" +curve = SubResource("Curve_ymqbv") +curveScale = 4.0 + +[sub_resource type="Resource" id="Resource_6a7ab"] +script = ExtResource("3_oydfn") +owner = SubResource("Resource_0c48d") + +[sub_resource type="Gradient" id="Gradient_jpti0"] +offsets = PackedFloat32Array(0.16666667, 0.54901963, 0.79617834, 1) +colors = PackedColorArray(0, 0, 0, 1, 0.6018299, 0.6018299, 0.6018299, 1, 1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_nt8a7"] +gradient = SubResource("Gradient_jpti0") +fill = 1 +fill_from = Vector2(0.5, 0.50427353) + +[sub_resource type="Resource" id="Resource_nuxa8"] +script = ExtResource("6_ll4h8") +intensity = 1.0 +numInstances = 3 +ellipseAmount = 1.0247 +ellipseSize = Vector2(1, 0.4) +ellipseSizeXY = 1.7378 +ellipseMinDistance = 0.0 +ellipseKeepRatio = 1.0 +radialFadingWrapping = 5.5983 +scale = Vector2(1, 0.7205) +distortionAmount = 0.6132 +distortionAngle = 173.3332 +distortionAngleFromEllipse = 1.0 +smearingSteps = 2 +smearing = 1.0714 +redShift = 0.0301 +greenShift = 0.0602 +blueShift = 0.1546 +blurRadius = 1 +blurSpread = 6.7519 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="Gradient" id="Gradient_ixqtu"] +offsets = PackedFloat32Array(0.2857143, 0.72689074) +colors = PackedColorArray(0.7443918, 0.7443918, 0.7443918, 1, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_m7r8b"] +noise_type = 2 +frequency = 0.0675 +fractal_octaves = 2 +fractal_lacunarity = 2.879 +fractal_gain = 0.53 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_sw5v3"] +height = 1 +noise = SubResource("FastNoiseLite_m7r8b") +color_ramp = SubResource("Gradient_ixqtu") + +[sub_resource type="CompositorEffect" id="CompositorEffect_oydfn"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_ruaxh") +amount = 0.0 +lumaTint = Color(0, 0.22131784, 2.2740524, 1) +blurRadius = 3 +blurSpread = 2.5402 +blurNoise = 10.125 +lumaWeights = Vector3(0.3333, 0.3333, 0.3333) +lumaWeightPower = 0.5795 +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 20) +desaturation = 0.5 +scaleXYMultiplier = 0.6225 +scaleXYIndexMultiplier = Vector2(-0.5055, 3.8115) +fading = SubResource("GradientTexture2D_nt8a7") +radialFading = SubResource("NoiseTexture2D_sw5v3") +layerSettings = [SubResource("Resource_nuxa8")] +animationTargets = [SubResource("Resource_cxc3f")] +compositorEffectID = SubResource("Resource_6a7ab") +metadata/_custom_type_script = "uid://c3ipi4e85bp0r" + +[sub_resource type="Curve" id="Curve_4k7mp"] +_data = [Vector2(0, 0), 0.0, 0.3423754, 0, 1, Vector2(1, 0.3423754), 0.3423754, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_8d170"] +script = ExtResource("1_nq6ls") +member = "amount" +curve = SubResource("Curve_4k7mp") + +[sub_resource type="Resource" id="Resource_ie6m2"] +script = ExtResource("3_oydfn") +owner = SubResource("Resource_0c48d") + +[sub_resource type="Gradient" id="Gradient_p64cs"] +offsets = PackedFloat32Array(0.09477124, 0.6092437, 1) +colors = PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_7720d"] +gradient = SubResource("Gradient_p64cs") +fill = 1 +fill_from = Vector2(0.50427353, 0.508547) +fill_to = Vector2(1, 0.52136755) + +[sub_resource type="Resource" id="Resource_63qv8"] +script = ExtResource("6_ll4h8") +numInstances = 3 +blendMode = 0.2199 +ellipseAmount = 0.1543 +ellipseSizeXY = 0.6454 +ellipseMinDistance = 1.315 +radialFadingWrapping = 9.0 +distortionAmount = 0.4554 +distortionAngle = 0.0 +distortionAngleFromEllipse = 0.0 +smearingSteps = 4 +smearing = 1.1155 +redShift = -0.1233 +blueShift = -0.096 +blurRadius = 2 +blurSpread = 7.8298 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_a3id7"] +frequency = 0.0041 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_ie6m2"] +width = 32 +height = 1 +noise = SubResource("FastNoiseLite_a3id7") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_hei5s"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_ruaxh") +amount = 0.0 +lumaTint = Color(0, 5.441916, 8.93607, 1) +blurRadius = 1 +blurSpread = 1.6923 +blurNoise = 1.8694 +lumaOutputRange = Vector2(0, 10) +scaleXYMultiplier = 2.25 +fading = SubResource("GradientTexture2D_7720d") +radialFading = SubResource("NoiseTexture2D_ie6m2") +layerSettings = [SubResource("Resource_63qv8")] +animationTargets = [SubResource("Resource_8d170")] +compositorEffectID = SubResource("Resource_ie6m2") +metadata/_custom_type_script = "uid://c3ipi4e85bp0r" + +[sub_resource type="Resource" id="Resource_xx70v"] +script = ExtResource("1_nq6ls") +member = "amount" +curve = SubResource("Curve_4k7mp") +curveScale = 2.0 + +[sub_resource type="Resource" id="Resource_y3g14"] +script = ExtResource("3_oydfn") +owner = SubResource("Resource_0c48d") + +[sub_resource type="Gradient" id="Gradient_cxc3f"] +offsets = PackedFloat32Array(0.0147929, 0.4733728) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_8b3wv"] +gradient = SubResource("Gradient_cxc3f") +fill = 1 +fill_from = Vector2(0.50427353, 0.508547) + +[sub_resource type="Resource" id="Resource_0klnf"] +script = ExtResource("6_ll4h8") +blendMode = 0.0 +ellipseAmount = 0.0 +scaleXY = 1.0315 +mirrorY = true +distortionAmount = 0.115 +distortionAngle = 0.0 +distortionAngleFromEllipse = 0.0 +smearingSteps = 2 +redShift = 0.132 +blueShift = -0.096 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="Gradient" id="Gradient_gxlxg"] +offsets = PackedFloat32Array(0, 0.17226891, 0.28151262, 0.3487395, 0.45378152, 0.5420168, 0.62184876, 0.65966386, 0.6932773, 0.85714287, 1) +colors = PackedColorArray(1, 1, 1, 1, 0.8119403, 0.8119403, 0.8119403, 1, 0.39999998, 0.39999998, 0.39999998, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0.29585797, 0.29585797, 0.29585797, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_4n83u"] +gradient = SubResource("Gradient_gxlxg") +width = 32 + +[sub_resource type="CompositorEffect" id="CompositorEffect_gfw2j"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_ruaxh") +amount = 0.0 +lumaTint = Color(0.79152006, 0, 18.892002, 1) +blurRadius = 2 +blurNoise = 3.3898 +lumaOutputRange = Vector2(0, 10) +scaleXYMultiplier = 1.552 +fading = SubResource("GradientTexture2D_8b3wv") +radialFading = SubResource("GradientTexture1D_4n83u") +layerSettings = [SubResource("Resource_0klnf")] +animationTargets = [SubResource("Resource_xx70v")] +compositorEffectID = SubResource("Resource_y3g14") +metadata/_custom_type_script = "uid://c3ipi4e85bp0r" + +[sub_resource type="Curve" id="Curve_7owh2"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_i3ijp"] +script = ExtResource("1_nq6ls") +member = "amount" +curve = SubResource("Curve_7owh2") + +[sub_resource type="Resource" id="Resource_sdunf"] +script = ExtResource("3_oydfn") +owner = SubResource("Resource_0c48d") + +[sub_resource type="CompositorEffect" id="CompositorEffect_ll4h8"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("8_7khkw") +amount = 0.0 +saturationShift = Vector3(0, 0.03, 0.3) +saturationAmount = 0.2022 +animationTargets = [SubResource("Resource_i3ijp")] +compositorEffectID = SubResource("Resource_sdunf") +metadata/_custom_type_script = "uid://cjfxcl3cdhnku" + +[resource] +script = ExtResource("9_1yxhd") +effects = [SubResource("CompositorEffect_nq6ls"), SubResource("CompositorEffect_k18aw"), SubResource("CompositorEffect_oydfn"), SubResource("CompositorEffect_hei5s"), SubResource("CompositorEffect_gfw2j"), SubResource("CompositorEffect_ll4h8")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Green Cinematic Flares.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Green Cinematic Flares.tres new file mode 100644 index 0000000..5633d4b --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Green Cinematic Flares.tres @@ -0,0 +1,238 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=35 format=3 uid="uid://qr06s6jt1t6m"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_fv6nb"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_faje8"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_55j2s"] +[ext_resource type="Script" uid="uid://bmn34jsmjx7j8" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs" id="4_rxqvv"] +[ext_resource type="Script" uid="uid://c3ipi4e85bp0r" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs" id="5_6c8a4"] +[ext_resource type="Script" uid="uid://b7dy5mtxvj22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs" id="6_1tbsi"] +[ext_resource type="Script" uid="uid://6jkixa201wux" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs" id="7_31jle"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="8_v2hqv"] + +[sub_resource type="Curve" id="Curve_4k7mp"] +_data = [Vector2(0, 0), 0.0, 0.3423754, 0, 1, Vector2(1, 0.3423754), 0.3423754, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_8d170"] +script = ExtResource("1_fv6nb") +member = "amount" +curve = SubResource("Curve_4k7mp") + +[sub_resource type="Resource" id="Resource_i5utj"] +script = ExtResource("2_faje8") + +[sub_resource type="Resource" id="Resource_hpfyh"] +script = ExtResource("3_55j2s") +owner = SubResource("Resource_i5utj") + +[sub_resource type="Gradient" id="Gradient_frwbc"] +offsets = PackedFloat32Array(0.2781065, 0.56804734, 1) +colors = PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1, 0.180933, 0.180933, 0.180933, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_w6tyf"] +gradient = SubResource("Gradient_frwbc") +fill = 1 +fill_from = Vector2(0.50427353, 0.508547) +fill_to = Vector2(1, 0.52136755) + +[sub_resource type="Resource" id="Resource_63qv8"] +script = ExtResource("4_rxqvv") +numInstances = 3 +blendMode = 0.2199 +ellipseAmount = 0.1543 +ellipseSizeXY = 0.6454 +ellipseMinDistance = 1.315 +radialFadingWrapping = 9.0 +distortionAmount = 0.4554 +distortionAngle = 0.0 +distortionAngleFromEllipse = 0.0 +smearingSteps = 4 +smearing = 1.1155 +redShift = -0.1233 +blueShift = -0.096 +blurRadius = 2 +blurSpread = 7.8298 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_gxlxg"] +frequency = 0.0041 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_4n83u"] +width = 32 +height = 1 +noise = SubResource("FastNoiseLite_gxlxg") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_mdsx3"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_6c8a4") +amount = 0.0 +lumaTint = Color(8.822499, 18.892002, 0, 1) +blurRadius = 1 +lumaOutputRange = Vector2(0, 10) +scaleXYMultiplier = 2.25 +scaleXYIndexMultiplier = Vector2(0.945, -1.3345) +fading = SubResource("GradientTexture2D_w6tyf") +radialFading = SubResource("NoiseTexture2D_4n83u") +layerSettings = [SubResource("Resource_63qv8")] +animationTargets = [SubResource("Resource_8d170")] +compositorEffectID = SubResource("Resource_hpfyh") +metadata/_custom_type_script = "uid://c3ipi4e85bp0r" + +[sub_resource type="Curve" id="Curve_d1ujc"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_7axlu"] +script = ExtResource("1_fv6nb") +member = "amount" +curve = SubResource("Curve_d1ujc") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_22k1k"] +script = ExtResource("3_55j2s") +owner = SubResource("Resource_i5utj") + +[sub_resource type="Gradient" id="Gradient_hpfyh"] +offsets = PackedFloat32Array(0.20414202, 1) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_frwbc"] +gradient = SubResource("Gradient_hpfyh") +fill = 2 +fill_from = Vector2(0.508547, 0.52136755) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_w6tyf"] + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_63qv8"] +width = 256 +height = 256 +noise = SubResource("FastNoiseLite_w6tyf") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_wpvj8"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_1tbsi") +amount = 0.0 +direction = 1 +blendMode = 0.184 +inputFading = SubResource("GradientTexture2D_frwbc") +outputFading = SubResource("GradientTexture2D_frwbc") +tint = SubResource("NoiseTexture2D_63qv8") +distortionAmount = 0.1135 +offset = -0.018 +smearingSteps = 6 +redShift = 0.0701 +blueShift = -0.0395 +lumaTint = Color(0, 0.05809719, 0.0033765133, 1) +lumaWeights = Vector3(1, 1, 0) +lumaInputRange = Vector2(0.599, 1.5) +animationTargets = [SubResource("Resource_7axlu")] +compositorEffectID = SubResource("Resource_22k1k") +metadata/_custom_type_script = "uid://b7dy5mtxvj22k" + +[sub_resource type="Curve" id="Curve_4n83u"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_72jau"] +script = ExtResource("1_fv6nb") +member = "amount" +curve = SubResource("Curve_4n83u") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_ixn1d"] +script = ExtResource("3_55j2s") +owner = SubResource("Resource_i5utj") + +[sub_resource type="CompositorEffect" id="CompositorEffect_ysmsc"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_31jle") +amount = 0.0 +num = 1 +blendMode = 0.4353 +distortionAmount = 0.069 +distortionAngle = 0.0 +distortionAngleSpeed = 0.0 +distortionOffset = Vector2(0.0214, 0) +smearingSteps = 3 +smearing = 1.3977 +redShift = 0.065 +blueShift = -0.2072 +blurRadiusX = 4 +blurRadiusY = 4 +blurSpread = 2.373 +blurNoise = 0.7951 +lumaTint = Color(1.8086953, 5.8570466, 0.80493706, 1) +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 2) +desaturation = 0.0 +downSampling = 1 +animationTargets = [SubResource("Resource_72jau")] +compositorEffectID = SubResource("Resource_ixn1d") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[sub_resource type="Curve" id="Curve_3tnad"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_y3g14"] +script = ExtResource("1_fv6nb") +member = "amount" +curve = SubResource("Curve_3tnad") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_cxc3f"] +script = ExtResource("3_55j2s") +owner = SubResource("Resource_i5utj") + +[sub_resource type="CompositorEffect" id="CompositorEffect_t5au6"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_31jle") +amount = 0.0 +num = 4 +rotationMode = 1 +blendMode = 0.0 +distortionAmount = 0.4223 +distortionAngleSpeed = 5.0 +smearingSteps = 23 +smearing = 1.1125 +redShift = 0.0505 +greenShift = 0.0058 +blueShift = -0.1134 +blurRadiusX = 1 +blurRadiusY = 1 +lumaTint = Color(0.22112837, 0.5411765, 0, 1) +lumaWeights = Vector3(0.3, 0.5, 0) +lumaInputRange = Vector2(1.492, 2) +lumaOutputRange = Vector2(0, 5) +desaturation = 0.5 +downSampling = 1 +animationTargets = [SubResource("Resource_y3g14")] +compositorEffectID = SubResource("Resource_cxc3f") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[resource] +script = ExtResource("8_v2hqv") +effects = [SubResource("CompositorEffect_mdsx3"), SubResource("CompositorEffect_wpvj8"), SubResource("CompositorEffect_ysmsc"), SubResource("CompositorEffect_t5au6")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow.tres new file mode 100644 index 0000000..344270e --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow.tres @@ -0,0 +1,203 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=35 format=3 uid="uid://cxxb8xq3xpa6d"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_e74ec"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_bfksq"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_eyvih"] +[ext_resource type="Script" uid="uid://t5g1g1uv5yrj" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs" id="4_chktd"] +[ext_resource type="Texture2D" uid="uid://cqaqvhmyuo56d" path="res://VFX/Compositor Effects/Star Glow/star-glow-blur.png" id="5_1gqhf"] +[ext_resource type="Script" uid="uid://cqkrgyuerq50a" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/EllispeDistortion/EllipseDistortionEffect.cs" id="6_t8xaw"] +[ext_resource type="Script" uid="uid://6jkixa201wux" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs" id="7_g2w8j"] +[ext_resource type="Script" uid="uid://pevgspwywsxi" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/HSLAdjustment/HSLAdjustmentEffect.cs" id="8_bfeok"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="9_fgrt2"] + +[sub_resource type="Curve" id="Curve_xhmdb"] +_data = [Vector2(0, 0), 0.0, 0.24930753, 0, 0, Vector2(1, 0.5578947), 0.5578947, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_jdtjt"] +script = ExtResource("1_e74ec") +member = "opacity" +curve = SubResource("Curve_xhmdb") + +[sub_resource type="Resource" id="Resource_1ntwo"] +script = ExtResource("2_bfksq") + +[sub_resource type="Resource" id="Resource_5jnfl"] +script = ExtResource("3_eyvih") +owner = SubResource("Resource_1ntwo") + +[sub_resource type="Gradient" id="Gradient_qf8q3"] +offsets = PackedFloat32Array(0.34812286, 0.70307165, 0.8988327) +colors = PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1, 16.420414, 16.420414, 16.420414, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_cqn6v"] +gradient = SubResource("Gradient_qf8q3") +use_hdr = true +fill = 1 +fill_from = Vector2(0.5, 0.50427353) + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_g6idi"] +load_path = "res://.godot/imported/star-glow.png-61f0458024aeba1668f3516b3db84782.ctex" + +[sub_resource type="CompositorEffect" id="CompositorEffect_ixqtu"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_chktd") +opacity = 0.5578947 +blendMode = 1 +overlayTexture = SubResource("CompressedTexture2D_g6idi") +overlayTint = Color(1, 1, 1, 0.050980393) +tiling = Vector2(9, 5.0625) +scrolling = Vector2(0.22, 0.012) +maskTexture = SubResource("GradientTexture2D_cqn6v") +animationTargets = [SubResource("Resource_jdtjt")] +compositorEffectID = SubResource("Resource_5jnfl") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Resource" id="Resource_86qek"] +script = ExtResource("1_e74ec") +member = "opacity" +curve = SubResource("Curve_xhmdb") + +[sub_resource type="Resource" id="Resource_qf8q3"] +script = ExtResource("3_eyvih") +owner = SubResource("Resource_1ntwo") + +[sub_resource type="Gradient" id="Gradient_7ucn0"] +offsets = PackedFloat32Array(0.08171206, 0.57587546, 1) +colors = PackedColorArray(0, 0, 0, 1, 1.340301, 1.340301, 1.340301, 1, 4.8530827, 4.8530827, 4.8530827, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_su8gi"] +gradient = SubResource("Gradient_7ucn0") +use_hdr = true +fill = 1 +fill_from = Vector2(0.5, 0.50427353) + +[sub_resource type="CompositorEffect" id="CompositorEffect_m7r8b"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_chktd") +opacity = 0.5578947 +blendMode = 1 +overlayTexture = ExtResource("5_1gqhf") +overlayTint = Color(1, 1, 1, 0.21568628) +tiling = Vector2(1, 0.5625) +scrolling = Vector2(-0.1, -0.01) +maskTexture = SubResource("GradientTexture2D_su8gi") +animationTargets = [SubResource("Resource_86qek")] +compositorEffectID = SubResource("Resource_qf8q3") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_nxurn"] +_limits = [0.0, 0.12, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.120000005, 0, 1, Vector2(1, 0.12), 0.120000005, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_35pef"] +script = ExtResource("1_e74ec") +member = "distortionAmount" +curve = SubResource("Curve_nxurn") + +[sub_resource type="Resource" id="Resource_slvrs"] +script = ExtResource("3_eyvih") +owner = SubResource("Resource_1ntwo") + +[sub_resource type="CompositorEffect" id="CompositorEffect_sw5v3"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_t8xaw") +distortionAmount = 0.12 +ellipseScale = 1.138 +ringsDistribution = 0.7727 +animationTargets = [SubResource("Resource_35pef")] +compositorEffectID = SubResource("Resource_slvrs") +metadata/_custom_type_script = "uid://cqkrgyuerq50a" + +[sub_resource type="Curve" id="Curve_71075"] +_data = [Vector2(0, 0), 0.0, 1.8522265, 0, 1, Vector2(0.3466667, 0.6421052), 1.462848, 1.462848, 0, 0, Vector2(1, 1), 0.13663998, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="Resource" id="Resource_yoxag"] +script = ExtResource("1_e74ec") +member = "amount" +curve = SubResource("Curve_71075") + +[sub_resource type="Resource" id="Resource_bhyc7"] +script = ExtResource("3_eyvih") +owner = SubResource("Resource_1ntwo") + +[sub_resource type="CompositorEffect" id="CompositorEffect_wi6eu"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_g2w8j") +amount = 1.0 +num = 3 +distortionAmount = 0.4369 +distortionAngle = 168.8496 +distortionAngleSpeed = 10.0 +smearingSteps = 24 +smearing = 1.2171 +redShift = 0.2239 +greenShift = 0.099 +blueShift = 0.0067 +blurRadiusX = 1 +blurRadiusY = 1 +lumaTint = Color(2.6226976, 1.3143802, 0.9708759, 1) +lumaWeights = Vector3(0.33, 0.33, 0.33) +lumaInputRange = Vector2(0.7, 1) +lumaOutputRange = Vector2(0, 1) +downSampling = 1 +animationTargets = [SubResource("Resource_yoxag")] +compositorEffectID = SubResource("Resource_bhyc7") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[sub_resource type="Curve" id="Curve_su8gi"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_tohnr"] +script = ExtResource("1_e74ec") +member = "amount" +curve = SubResource("Curve_su8gi") + +[sub_resource type="Resource" id="Resource_7jt2s"] +script = ExtResource("3_eyvih") +owner = SubResource("Resource_1ntwo") + +[sub_resource type="CompositorEffect" id="CompositorEffect_7720d"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("8_bfeok") +amount = 1.0 +saturationOffset = 30.0 +saturationGamma = 37.9747 +lightnessOffset = 2.0 +lightnessGamma = 5.0 +animationTargets = [SubResource("Resource_tohnr")] +compositorEffectID = SubResource("Resource_7jt2s") +metadata/_custom_type_script = "uid://pevgspwywsxi" + +[resource] +script = ExtResource("9_fgrt2") +effects = [SubResource("CompositorEffect_ixqtu"), SubResource("CompositorEffect_m7r8b"), SubResource("CompositorEffect_sw5v3"), SubResource("CompositorEffect_wi6eu"), SubResource("CompositorEffect_7720d")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Red Cinematic Bloom.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Red Cinematic Bloom.tres new file mode 100644 index 0000000..719dc5a --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Red Cinematic Bloom.tres @@ -0,0 +1,301 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=40 format=3 uid="uid://c63le61ap244y"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_1rohx"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_yywgn"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_tdlfo"] +[ext_resource type="Script" uid="uid://6jkixa201wux" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs" id="4_2f4vr"] +[ext_resource type="Script" uid="uid://bmn34jsmjx7j8" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs" id="5_xv23r"] +[ext_resource type="Script" uid="uid://c3ipi4e85bp0r" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs" id="6_ypk1d"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="7_3gufn"] +[ext_resource type="Script" uid="uid://b7dy5mtxvj22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs" id="7_yywgn"] + +[sub_resource type="Curve" id="Curve_ysmsc"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_7axlu"] +script = ExtResource("1_1rohx") +member = "amount" +curve = SubResource("Curve_ysmsc") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_5rqpk"] +script = ExtResource("2_yywgn") + +[sub_resource type="Resource" id="Resource_i5utj"] +script = ExtResource("3_tdlfo") +owner = SubResource("Resource_5rqpk") + +[sub_resource type="CompositorEffect" id="CompositorEffect_yywgn"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_2f4vr") +amount = 0.0 +num = 1 +blendMode = 0.7098 +distortionAmount = 0.069 +distortionAngle = 0.0 +distortionAngleSpeed = 0.0 +smearingSteps = 2 +smearing = 1.2164 +redShift = 0.3241 +blueShift = 0.0519 +blurRadiusX = 8 +blurRadiusY = 8 +blurSpread = 6.2918 +blurNoise = 13.559 +lumaTint = Color(18.892157, 3.497829, 2.6066146, 1) +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 1) +desaturation = 0.0 +downSampling = 1 +animationTargets = [SubResource("Resource_7axlu")] +compositorEffectID = SubResource("Resource_i5utj") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[sub_resource type="Resource" id="Resource_jpti0"] +script = ExtResource("3_tdlfo") +owner = SubResource("Resource_5rqpk") + +[sub_resource type="CompositorEffect" id="CompositorEffect_tdlfo"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_2f4vr") +amount = 0.0 +num = 1 +blendMode = 0.0 +distortionAmount = 0.069 +distortionAngle = 0.0 +distortionAngleSpeed = 0.0 +smearingSteps = 6 +smearing = 1.1096 +redShift = 0.1387 +blueShift = 0.0404 +blurRadiusX = 1 +blurRadiusY = 5 +blurSpread = 4.2587 +blurNoise = 0.046 +lumaTint = Color(5.5880003, 0.738, 1.3000295, 1) +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 1) +desaturation = 0.0 +downSampling = 1 +animationTargets = [SubResource("Resource_7axlu")] +compositorEffectID = SubResource("Resource_jpti0") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[sub_resource type="Curve" id="Curve_0y4dn"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_ymqbv"] +script = ExtResource("1_1rohx") +member = "amount" +curve = SubResource("Curve_0y4dn") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_krf45"] +script = ExtResource("3_tdlfo") +owner = SubResource("Resource_5rqpk") + +[sub_resource type="Gradient" id="Gradient_a4g6s"] +offsets = PackedFloat32Array(0, 0.9745455) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_xxny3"] +gradient = SubResource("Gradient_a4g6s") +width = 8 +height = 8 +fill = 1 +fill_from = Vector2(0.52136755, 0.51282054) +fill_to = Vector2(1, 0.33333334) + +[sub_resource type="Resource" id="Resource_oytpb"] +script = ExtResource("5_xv23r") +intensity = 0.3303 +blendMode = 0.2798 +ellipseAmount = 0.0 +distortionAmount = 0.0 +distortionAngleFromEllipse = 0.0 +smearingSteps = 3 +smearing = 1.4165 +blueShift = -0.105 +blurRadius = 3 +blurSpread = 2.2385 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="Resource" id="Resource_yynim"] +script = ExtResource("5_xv23r") +intensity = 0.021 +blendMode = 0.2945 +ellipseAmount = 0.3303 +ellipseSizeXY = 1.0917 +ellipseKeepRatio = 1.0 +radialFadingWrapping = 1.0 +blurRadius = 2 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="Resource" id="Resource_4qtqc"] +script = ExtResource("5_xv23r") +intensity = 0.021 +blendMode = 0.0 +ellipseAmount = 0.1804 +ellipseKeepRatio = 1.0 +radialFadingWrapping = 1.0 +scale = Vector2(2, 1) +mirrorY = true +blurRadius = 2 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_tn5uv"] +frequency = 0.0232 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_027rg"] +noise = SubResource("FastNoiseLite_tn5uv") + +[sub_resource type="CompositorEffect" id="CompositorEffect_2f4vr"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_ypk1d") +amount = 0.0 +lumaTint = Color(18.892002, 0.8377208, 0, 1) +blurRadius = 1 +blurRadiusY = 10 +blurSpread = 6.6459 +lumaWeights = Vector3(0.5, 0.5, 0.2) +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 10) +fading = SubResource("GradientTexture2D_xxny3") +radialFading = SubResource("NoiseTexture2D_027rg") +layerSettings = [SubResource("Resource_oytpb"), SubResource("Resource_yynim"), SubResource("Resource_4qtqc")] +animationTargets = [SubResource("Resource_ymqbv")] +compositorEffectID = SubResource("Resource_krf45") +metadata/_custom_type_script = "uid://c3ipi4e85bp0r" + +[sub_resource type="Resource" id="Resource_8vqmt"] +script = ExtResource("3_tdlfo") +owner = SubResource("Resource_5rqpk") + +[sub_resource type="CompositorEffect" id="CompositorEffect_xv23r"] +resource_local_to_scene = false +resource_name = "" +enabled = false +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_2f4vr") +amount = 0.0 +num = 1 +blendMode = 0.0 +distortionAmount = 0.4727 +distortionAngle = 0.0 +distortionAngleSpeed = 0.0 +smearingSteps = 8 +smearing = 1.091 +redShift = 0.1263 +greenShift = 0.087 +blueShift = -0.0204 +blurRadiusX = 3 +blurSpread = 3.4596 +blurNoise = 1.8634 +lumaTint = Color(6.9260106, 1.2652526, 0.934072, 1) +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 1) +downSampling = 1 +animationTargets = [SubResource("Resource_7axlu")] +compositorEffectID = SubResource("Resource_8vqmt") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[sub_resource type="Curve" id="Curve_4545n"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_p64cs"] +script = ExtResource("1_1rohx") +member = "amount" +curve = SubResource("Curve_4545n") +curveScale = 0.1 +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_22k1k"] +script = ExtResource("3_tdlfo") +owner = SubResource("Resource_5rqpk") + +[sub_resource type="Gradient" id="Gradient_hpfyh"] +offsets = PackedFloat32Array(0.70414203, 1) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_frwbc"] +gradient = SubResource("Gradient_hpfyh") +fill = 2 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="Gradient" id="Gradient_w6tyf"] +offsets = PackedFloat32Array(0.35502958, 0.908284) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_63qv8"] +gradient = SubResource("Gradient_w6tyf") +width = 32 +height = 32 +fill = 1 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="Gradient" id="Gradient_gxlxg"] +offsets = PackedFloat32Array(0, 0.1923077, 1) +colors = PackedColorArray(0, 0, 0, 1, 0.5118343, 0.5118343, 0.5118343, 1, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_4n83u"] +frequency = 0.0128 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_72jau"] +width = 64 +height = 8 +noise = SubResource("FastNoiseLite_4n83u") +color_ramp = SubResource("Gradient_gxlxg") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_ypk1d"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_yywgn") +amount = 0.0 +blendMode = 0.3326 +inputFading = SubResource("GradientTexture2D_frwbc") +outputFading = SubResource("GradientTexture2D_63qv8") +tint = SubResource("NoiseTexture2D_72jau") +tintScale = Vector2(20, 1.077) +tintScaleXY = 0.8955 +distortionAmount = 0.048 +smearingSteps = 10 +smearing = 1.5 +redShift = 0.1689 +blueShift = -0.0889 +lumaTint = Color(1.706018, 0, 0.10151802, 1) +lumaInputRange = Vector2(1.015, 1.5) +lumaOutputRange = Vector2(0, 1) +desaturation = 0.0 +testEdge = 321 +animationTargets = [SubResource("Resource_p64cs")] +compositorEffectID = SubResource("Resource_22k1k") +metadata/_custom_type_script = "uid://b7dy5mtxvj22k" + +[resource] +script = ExtResource("7_3gufn") +effects = [SubResource("CompositorEffect_yywgn"), SubResource("CompositorEffect_tdlfo"), SubResource("CompositorEffect_2f4vr"), SubResource("CompositorEffect_xv23r"), SubResource("CompositorEffect_ypk1d")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Yellow Cinematic Bloom.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Yellow Cinematic Bloom.tres new file mode 100644 index 0000000..748f669 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Yellow Cinematic Bloom.tres @@ -0,0 +1,210 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=34 format=3 uid="uid://hs33m81dlips"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_s2hks"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_nnbdi"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_c6fon"] +[ext_resource type="Script" uid="uid://b7dy5mtxvj22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/MaxBloom/MaxBloomEffect.cs" id="4_qyiel"] +[ext_resource type="Script" uid="uid://bmn34jsmjx7j8" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomSettings.cs" id="5_bd3ow"] +[ext_resource type="Script" uid="uid://c3ipi4e85bp0r" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/GhostBloom/GhostBloomEffect.cs" id="6_cc1ov"] +[ext_resource type="Script" uid="uid://6jkixa201wux" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs" id="7_nnbdi"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="7_txjlu"] + +[sub_resource type="Curve" id="Curve_4545n"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_p64cs"] +script = ExtResource("1_s2hks") +member = "amount" +curve = SubResource("Curve_4545n") +curveScale = 0.1 +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_d1ujc"] +script = ExtResource("2_nnbdi") + +[sub_resource type="Resource" id="Resource_mdsx3"] +script = ExtResource("3_c6fon") +owner = SubResource("Resource_d1ujc") + +[sub_resource type="Gradient" id="Gradient_c05wc"] +offsets = PackedFloat32Array(0.70414203, 1) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_i46l2"] +gradient = SubResource("Gradient_c05wc") +fill = 2 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="Gradient" id="Gradient_4545n"] +offsets = PackedFloat32Array(0.35502958, 0.908284) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_d1ujc"] +gradient = SubResource("Gradient_4545n") +width = 32 +height = 32 +fill = 1 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="Gradient" id="Gradient_0c48d"] +offsets = PackedFloat32Array(0, 0.60946745, 1) +colors = PackedColorArray(0, 0, 0, 1, 0.5118343, 0.5118343, 0.5118343, 1, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_3tnad"] +frequency = 0.0128 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_y3g14"] +width = 64 +height = 8 +noise = SubResource("FastNoiseLite_3tnad") +color_ramp = SubResource("Gradient_0c48d") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_ysmsc"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_qyiel") +amount = 0.1 +blendMode = 0.0 +inputFading = SubResource("GradientTexture2D_i46l2") +outputFading = SubResource("GradientTexture2D_d1ujc") +tint = SubResource("NoiseTexture2D_y3g14") +tintScale = Vector2(1, 1.155) +tintScaleXY = 0.8955 +distortionAmount = 0.012 +offset = -0.0029 +smearingSteps = 10 +smearing = 1.5 +redShift = 0.1689 +blueShift = -0.0889 +lumaTint = Color(0.8206905, 0.5294989, 0.1740212, 1) +lumaInputRange = Vector2(1.015, 1.5) +lumaOutputRange = Vector2(0, 1) +desaturation = 0.0 +testEdge = 321 +animationTargets = [SubResource("Resource_p64cs")] +compositorEffectID = SubResource("Resource_mdsx3") +metadata/_custom_type_script = "uid://b7dy5mtxvj22k" + +[sub_resource type="Curve" id="Curve_t5au6"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_a3id7"] +script = ExtResource("1_s2hks") +member = "amount" +curve = SubResource("Curve_t5au6") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_frwbc"] +script = ExtResource("3_c6fon") +owner = SubResource("Resource_d1ujc") + +[sub_resource type="Gradient" id="Gradient_w6tyf"] +offsets = PackedFloat32Array(0, 0.75443786) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_63qv8"] +gradient = SubResource("Gradient_w6tyf") +width = 8 +height = 8 +fill = 1 +fill_from = Vector2(0.47435898, 0.50427353) +fill_to = Vector2(1, 0.50427353) + +[sub_resource type="Resource" id="Resource_gxlxg"] +script = ExtResource("5_bd3ow") +intensity = 1.0 +numInstances = 2 +blendMode = 0.0 +ellipseAmount = 0.023 +ellipseMinDistance = -2.9152 +ellipseKeepRatio = 1.0 +radialFadingWrapping = 3.0 +distortionAmount = 0.0849 +distortionAngle = 0.0 +distortionAngleFromEllipse = 1.0 +smearingSteps = 1 +redShift = -0.0194 +blueShift = 0.0782 +blurSpread = 3.1702 +metadata/_custom_type_script = "uid://bmn34jsmjx7j8" + +[sub_resource type="Gradient" id="Gradient_ie6m2"] +offsets = PackedFloat32Array(1) +colors = PackedColorArray(1, 1, 1, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_p64cs"] +gradient = SubResource("Gradient_ie6m2") +width = 2 + +[sub_resource type="CompositorEffect" id="CompositorEffect_7axlu"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_cc1ov") +amount = 1.0 +lumaTint = Color(0.26849365, 0.1881681, 0.06346091, 1) +blurRadius = 2 +lumaInputRange = Vector2(1, 1.5) +lumaOutputRange = Vector2(0, 3) +desaturation = 0.0 +scaleXYIndexMultiplier = Vector2(1.2035, 0.134) +fading = SubResource("GradientTexture2D_63qv8") +radialFading = SubResource("GradientTexture1D_p64cs") +layerSettings = [SubResource("Resource_gxlxg")] +animationTargets = [SubResource("Resource_a3id7")] +compositorEffectID = SubResource("Resource_frwbc") +metadata/_custom_type_script = "uid://c3ipi4e85bp0r" + +[sub_resource type="Curve" id="Curve_i5utj"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_22k1k"] +script = ExtResource("1_s2hks") +member = "amount" +curve = SubResource("Curve_i5utj") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_hpfyh"] +script = ExtResource("3_c6fon") +owner = SubResource("Resource_d1ujc") + +[sub_resource type="CompositorEffect" id="CompositorEffect_frwbc"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_nnbdi") +amount = 1.0 +num = 1 +blendMode = 0.7151 +distortionAmount = 0.3446 +distortionAngle = 0.0 +distortionAngleSpeed = 0.0 +smearing = 1.0311 +redShift = 0.0415 +blueShift = -0.0065 +blurRadiusX = 5 +blurRadiusY = 5 +lumaTint = Color(1.340301, 0.78043133, 0, 1) +downSampling = 3 +animationTargets = [SubResource("Resource_22k1k")] +compositorEffectID = SubResource("Resource_hpfyh") +metadata/_custom_type_script = "uid://6jkixa201wux" + +[resource] +script = ExtResource("7_txjlu") +effects = [SubResource("CompositorEffect_ysmsc"), SubResource("CompositorEffect_7axlu"), SubResource("CompositorEffect_frwbc")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Frozen Ice.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Frozen Ice.tres new file mode 100644 index 0000000..1a50615 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Frozen Ice.tres @@ -0,0 +1,227 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=39 format=3 uid="uid://c5qouanne0mar"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_dw6h6"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_dsqqr"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_wy4el"] +[ext_resource type="Script" uid="uid://t5g1g1uv5yrj" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs" id="4_g042w"] +[ext_resource type="Script" uid="uid://balixgskgouhm" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/TextureDistortion/TextureDistortionEffect.cs" id="5_ecf1s"] +[ext_resource type="Script" uid="uid://pevgspwywsxi" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/HSLAdjustment/HSLAdjustmentEffect.cs" id="6_vhp5e"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="7_ibrjq"] + +[sub_resource type="Curve" id="Curve_uhxun"] +_limits = [0.0, 0.5, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.79, 0, 0, Vector2(1, 0.5), 0.5, -0.9409129, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_io6yn"] +script = ExtResource("1_dw6h6") +member = "opacity" +curve = SubResource("Curve_uhxun") + +[sub_resource type="Resource" id="Resource_6xf1f"] +script = ExtResource("2_dsqqr") + +[sub_resource type="Resource" id="Resource_gwku0"] +script = ExtResource("3_wy4el") +owner = SubResource("Resource_6xf1f") + +[sub_resource type="Gradient" id="Gradient_fy8er"] +offsets = PackedFloat32Array(0.51592356, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_ls5mq"] +gradient = SubResource("Gradient_fy8er") +width = 16 +height = 16 +fill = 2 +fill_from = Vector2(0.50678736, 0.50678736) + +[sub_resource type="Gradient" id="Gradient_1ntwo"] +offsets = PackedFloat32Array(0.18468468, 0.8198198) +colors = PackedColorArray(1, 1, 1, 0, 18.892157, 18.892157, 18.892157, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_8vqmt"] +noise_type = 2 +frequency = 0.0025 +fractal_octaves = 4 +fractal_lacunarity = 3.4345 +fractal_gain = 0.5605 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_lrl2b"] +width = 910 +noise = SubResource("FastNoiseLite_8vqmt") +color_ramp = SubResource("Gradient_1ntwo") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_7axlu"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_g042w") +opacity = 0.0 +overlayTexture = SubResource("NoiseTexture2D_lrl2b") +overlayTint = Color(2.0444047, 2.5841746, 3.171924, 1) +overlayConversion = 0 +tiling = Vector2(2.4045, 2.349) +offset = Vector2(-0.1725, 0) +scrolling = Vector2(0, 0.03) +maskTexture = SubResource("GradientTexture2D_ls5mq") +maskOverlayConversion = 0 +screenConversion = 1 +outputConversion = 2 +animationTargets = [SubResource("Resource_io6yn")] +compositorEffectID = SubResource("Resource_gwku0") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_r64p5"] +_limits = [0.0, 0.5263158, 0.0, 1.0] +_data = [Vector2(0, 0), 2.7060935, 0.10999999, 0, 0, Vector2(0.15384617, 0), 0.0, 0.0, 0, 0, Vector2(1, 0.5263158), 0.6220096, 0.0, 1, 0] +point_count = 3 + +[sub_resource type="Resource" id="Resource_f0pyq"] +script = ExtResource("1_dw6h6") +member = "distortionAmount" +curve = SubResource("Curve_r64p5") + +[sub_resource type="Resource" id="Resource_msay1"] +script = ExtResource("3_wy4el") +owner = SubResource("Resource_6xf1f") + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_a5aan"] +noise_type = 2 +frequency = 0.0126 +fractal_lacunarity = 1.5875 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_6jyri"] +noise = SubResource("FastNoiseLite_a5aan") +seamless = true +as_normal_map = true +bump_strength = 32.0 + +[sub_resource type="Gradient" id="Gradient_rjwbk"] +offsets = PackedFloat32Array(0.5023474, 0.8309859, 1) +colors = PackedColorArray(0, 0, 0, 1, 0.54000014, 0.54000014, 0.54000014, 1, 1, 1, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_5ifxw"] +gradient = SubResource("Gradient_rjwbk") +fill = 2 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="CompositorEffect" id="CompositorEffect_i5utj"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_ecf1s") +distortionAmount = 0.0 +blendAmount = 0.8077 +smearing = 1.5 +redShift = 0.1107 +blueShift = -0.1905 +distortionTexture = SubResource("NoiseTexture2D_6jyri") +distortionScroll = Vector2(0, -0.001) +maskTexture = SubResource("GradientTexture2D_5ifxw") +maskTiling = Vector2(1, 0.851) +animationTargets = [SubResource("Resource_f0pyq")] +compositorEffectID = SubResource("Resource_msay1") +metadata/_custom_type_script = "uid://balixgskgouhm" + +[sub_resource type="Curve" id="Curve_cqn6v"] +_data = [Vector2(0, 0), 0.0, 0.09, 0, 0, Vector2(0.507177, 0), 0.0, 0.0, 0, 0, Vector2(0.76076555, 0.19999993), 0.95000005, 0.95000005, 0, 0, Vector2(1, 1), 3.1777756, 0.0, 0, 0] +point_count = 4 + +[sub_resource type="Resource" id="Resource_yvb6s"] +script = ExtResource("1_dw6h6") +member = "opacity" +curve = SubResource("Curve_cqn6v") + +[sub_resource type="Resource" id="Resource_e7hhx"] +script = ExtResource("3_wy4el") +owner = SubResource("Resource_6xf1f") + +[sub_resource type="Gradient" id="Gradient_3764n"] +offsets = PackedFloat32Array(0.59624416, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_n0rnh"] +gradient = SubResource("Gradient_3764n") +width = 16 +height = 16 +fill = 2 +fill_from = Vector2(0.50678736, 0.50678736) + +[sub_resource type="Gradient" id="Gradient_galw3"] +offsets = PackedFloat32Array(0.17370892, 0.3802817, 0.685446, 1) +colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0.4976526, 1, 1, 1, 0.84777355, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_pv8u5"] +noise_type = 2 +frequency = 0.0074 +fractal_octaves = 4 +fractal_lacunarity = 3.4345 +fractal_gain = 0.5605 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_5jnfl"] +width = 910 +noise = SubResource("FastNoiseLite_pv8u5") +color_ramp = SubResource("Gradient_galw3") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_22k1k"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_g042w") +opacity = 0.0 +overlayTexture = SubResource("NoiseTexture2D_5jnfl") +overlayTint = Color(0.7529412, 0.84705883, 0.9490196, 1) +overlayConversion = 0 +tiling = Vector2(2.4045, 2.349) +offset = Vector2(-0.1725, 0) +maskTexture = SubResource("GradientTexture2D_n0rnh") +maskOverlayConversion = 0 +screenConversion = 1 +outputConversion = 2 +animationTargets = [SubResource("Resource_yvb6s")] +compositorEffectID = SubResource("Resource_e7hhx") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_7ucn0"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 1, Vector2(0.31578946, 0), 0.0, 0.0, 0, 0, Vector2(1, 0.81052625), 2.4275863, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="Resource" id="Resource_j43c5"] +script = ExtResource("1_dw6h6") +member = "amount" +curve = SubResource("Curve_7ucn0") + +[sub_resource type="Resource" id="Resource_44rrc"] +script = ExtResource("3_wy4el") +owner = SubResource("Resource_6xf1f") + +[sub_resource type="CompositorEffect" id="CompositorEffect_hpfyh"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_vhp5e") +amount = 0.0 +temparatureShift = -15.0 +saturationOffset = -5.0 +lightnessGamma = -23.0614 +animationTargets = [SubResource("Resource_j43c5")] +compositorEffectID = SubResource("Resource_44rrc") +metadata/_custom_type_script = "uid://pevgspwywsxi" + +[resource] +script = ExtResource("7_ibrjq") +effects = [SubResource("CompositorEffect_7axlu"), SubResource("CompositorEffect_i5utj"), SubResource("CompositorEffect_22k1k"), SubResource("CompositorEffect_hpfyh")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Impact Wave.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Impact Wave.tres new file mode 100644 index 0000000..e73d8b1 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Impact Wave.tres @@ -0,0 +1,74 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=15 format=3 uid="uid://dx1yhdxjvueve"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_kxm1r"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_5rrrf"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_vqmmo"] +[ext_resource type="Script" uid="uid://cqkrgyuerq50a" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/EllispeDistortion/EllipseDistortionEffect.cs" id="4_bgplx"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="5_7wg2m"] + +[sub_resource type="Curve" id="Curve_8vqmt"] +_limits = [0.0, 0.5, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 1.0689882, 0, 0, Vector2(0.029459905, 0.11480683), 1.3490828, 1.3490828, 0, 0, Vector2(0.34740883, 0.38808858), 0.019687198, 0.019687198, 0, 0, Vector2(1, 0), -0.9409129, -0.9409129, 0, 0] +point_count = 4 + +[sub_resource type="Resource" id="Resource_frwbc"] +script = ExtResource("1_kxm1r") +member = "distortionAmount" +curve = SubResource("Curve_8vqmt") + +[sub_resource type="Curve" id="Curve_4rdwj"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0.16479623), 2.7060935, 2.7060935, 0, 0, Vector2(0.4990403, 1.5990403), 0.19149712, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_w6tyf"] +script = ExtResource("1_kxm1r") +member = "ellipseScale" +curve = SubResource("Curve_4rdwj") + +[sub_resource type="Curve" id="Curve_6jyri"] +_data = [Vector2(0, 0), 0.0, 37.7499, 0, 0, Vector2(0.06710311, 1), 0.0, 0.0, 0, 0, Vector2(0.49520153, 1), 0.07217911, 0.07217911, 0, 0, Vector2(1, 1), 0.0, 0.0, 1, 0] +point_count = 4 + +[sub_resource type="Resource" id="Resource_63qv8"] +script = ExtResource("1_kxm1r") +member = "blendAmount" +curve = SubResource("Curve_6jyri") + +[sub_resource type="Resource" id="Resource_fy8er"] +script = ExtResource("2_5rrrf") + +[sub_resource type="Resource" id="Resource_ls5mq"] +script = ExtResource("3_vqmmo") +owner = SubResource("Resource_fy8er") +metadata/_custom_type_script = "uid://comuvej4dr22k" + +[sub_resource type="CompositorEffect" id="CompositorEffect_frwbc"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_bgplx") +distortionAmount = 0.0 +blendAmount = 0.0 +ellipseSize = Vector2(1, 1) +ellipseScale = 0.16479623 +minDistance = 0.0435 +rings = 2.0 +ringsIntensity = 1.0 +ringsType = 0.3803 +ringsDistribution = 0.2951 +smearingSteps = 10 +smearing = 1.0772 +redShift = 0.0372 +blueShift = -0.2691 +animationTargets = [SubResource("Resource_frwbc"), SubResource("Resource_w6tyf"), SubResource("Resource_63qv8")] +compositorEffectID = SubResource("Resource_ls5mq") +metadata/_custom_type_script = "uid://cqkrgyuerq50a" + +[resource] +script = ExtResource("5_7wg2m") +effects = [SubResource("CompositorEffect_frwbc")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Super Speed.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Super Speed.tres new file mode 100644 index 0000000..d8b5a61 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Physical/Super Speed.tres @@ -0,0 +1,174 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=32 format=3 uid="uid://d1uubsqnvu1qe"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_x2b2j"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_kelqw"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_7oha2"] +[ext_resource type="Script" uid="uid://cqkrgyuerq50a" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/EllispeDistortion/EllipseDistortionEffect.cs" id="4_pflfa"] +[ext_resource type="Script" uid="uid://t5g1g1uv5yrj" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs" id="5_6d3w2"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="6_g7p6u"] + +[sub_resource type="Curve" id="Curve_x2b2j"] +_data = [Vector2(0, 0), 0.0, 0.113684244, 0, 0, Vector2(0.39285716, 0.44210523), 1.8189471, 1.8189471, 0, 0, Vector2(1, 1), 0.051012084, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="CurveTexture" id="CurveTexture_kelqw"] +width = 32 +texture_mode = 1 +curve = SubResource("Curve_x2b2j") + +[sub_resource type="Curve" id="Curve_vn1sn"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_tywom"] +script = ExtResource("1_x2b2j") +member = "opacity" +curve = SubResource("Curve_vn1sn") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_diigt"] +script = ExtResource("2_kelqw") + +[sub_resource type="Resource" id="Resource_7oha2"] +script = ExtResource("3_7oha2") +owner = SubResource("Resource_diigt") + +[sub_resource type="Gradient" id="Gradient_pflfa"] +offsets = PackedFloat32Array(0.2090909, 0.94545454) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_6d3w2"] +gradient = SubResource("Gradient_pflfa") +fill_to = Vector2(0, 1) + +[sub_resource type="Gradient" id="Gradient_g7p6u"] +offsets = PackedFloat32Array(0.33223686, 0.34868422) +colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_8gn8u"] +frequency = 0.0021 +fractal_octaves = 2 +fractal_lacunarity = 100.0 +fractal_gain = 0.241 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_segrq"] +width = 1024 +noise = SubResource("FastNoiseLite_8gn8u") +color_ramp = SubResource("Gradient_g7p6u") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_diigt"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_6d3w2") +opacity = 0.0 +blendMode = 1 +uvMode = 1 +overlayTexture = SubResource("NoiseTexture2D_segrq") +tiling = Vector2(3, 1) +scrolling = Vector2(0.346, -2.215) +scrollingFPS = 0.0 +maskTexture = SubResource("GradientTexture2D_6d3w2") +alphaMapping = SubResource("CurveTexture_kelqw") +maskScrollingFPS = 0.0 +animationTargets = [SubResource("Resource_tywom")] +compositorEffectID = SubResource("Resource_7oha2") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_8gn8u"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0028709, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_segrq"] +script = ExtResource("1_x2b2j") +member = "distortionAmount" +curve = SubResource("Curve_8gn8u") +curveScale = 0.3043 +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_1qvce"] +script = ExtResource("3_7oha2") +owner = SubResource("Resource_diigt") + +[sub_resource type="CompositorEffect" id="CompositorEffect_1qvce"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_pflfa") +distortionAmount = 0.0 +ellipseScale = 0.974 +minDistance = 0.37 +smearingSteps = 7 +smearing = 1.5 +redShift = 0.341 +blueShift = -0.0695 +animationTargets = [SubResource("Resource_segrq")] +compositorEffectID = SubResource("Resource_1qvce") +metadata/_custom_type_script = "uid://cqkrgyuerq50a" + +[sub_resource type="Curve" id="Curve_rtqyr"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_qqae0"] +width = 32 +texture_mode = 1 +curve = SubResource("Curve_rtqyr") + +[sub_resource type="Resource" id="Resource_rit7v"] +script = ExtResource("3_7oha2") +owner = SubResource("Resource_diigt") + +[sub_resource type="Gradient" id="Gradient_7q50q"] +offsets = PackedFloat32Array(0, 0.6311111) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_tw0ca"] +gradient = SubResource("Gradient_7q50q") +fill_from = Vector2(0, 0.18902439) +fill_to = Vector2(0, 0.81707317) + +[sub_resource type="Gradient" id="Gradient_ml7cv"] +offsets = PackedFloat32Array(0.8519737, 0.875) +colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_akcsj"] +frequency = 0.0328 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_y4a3q"] +width = 256 +height = 8 +noise = SubResource("FastNoiseLite_akcsj") +color_ramp = SubResource("Gradient_ml7cv") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_rxqhi"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_6d3w2") +opacity = 0.0 +uvMode = 1 +overlayTexture = SubResource("NoiseTexture2D_y4a3q") +tiling = Vector2(7, 1) +scrolling = Vector2(0.05, -3) +scrollingFPS = 0.0 +maskTexture = SubResource("GradientTexture2D_tw0ca") +alphaMapping = SubResource("CurveTexture_qqae0") +maskScrollingFPS = 0.0 +animationTargets = [SubResource("Resource_tywom")] +compositorEffectID = SubResource("Resource_rit7v") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[resource] +script = ExtResource("6_g7p6u") +effects = [SubResource("CompositorEffect_diigt"), SubResource("CompositorEffect_1qvce"), SubResource("CompositorEffect_rxqhi")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Analog Tube TV .tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Analog Tube TV .tres new file mode 100644 index 0000000..4f6fb43 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Analog Tube TV .tres @@ -0,0 +1,238 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=42 format=3 uid="uid://c51155ys7wme8"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_big7l"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_uexx8"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_qf8os"] +[ext_resource type="Script" uid="uid://lytit04mgc2d" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Noise/ChannelPixelation/ChannelPixelationEffect.cs" id="4_1drgm"] +[ext_resource type="Script" uid="uid://dxnmlb5wobxtw" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/ScanLines/ScanLinesEffect.cs" id="5_x4xey"] +[ext_resource type="Script" uid="uid://balixgskgouhm" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/TextureDistortion/TextureDistortionEffect.cs" id="6_2tsv7"] +[ext_resource type="Script" uid="uid://v8yddy4erbru" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Color/HSLCurves/HSLCurvesEffect.cs" id="7_3jbr0"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="8_l3sri"] + +[sub_resource type="Curve" id="Curve_p64cs"] +_limits = [0.0, 0.41, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.08566716, 0, 1, Vector2(1, 0.08566716), 0.08566716, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_bsc7c"] +script = ExtResource("1_big7l") +member = "amount" +curve = SubResource("Curve_p64cs") +curveScale = 0.2 + +[sub_resource type="Resource" id="Resource_4n83u"] +script = ExtResource("2_uexx8") + +[sub_resource type="Resource" id="Resource_a3id7"] +script = ExtResource("3_qf8os") +owner = SubResource("Resource_4n83u") + +[sub_resource type="CompositorEffect" id="CompositorEffect_btbfg"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_1drgm") +amount = 0.0 +pixelSizeX = 1000 +pixelSizeY = 20 +pixelOffsetX = 0.4781 +pixelOffsetY = 0.388 +targetChannel = 1 +noiseAmount = 1.0 +noiseScale = 100.0 +xU = Vector3(0.3115, 1, 10) +xV = Vector3(0.0885, 12, 0) +yU = Vector3(0.2145, 1, 100) +yV = Vector3(0.444, 1, 1) +animationTargets = [SubResource("Resource_bsc7c")] +compositorEffectID = SubResource("Resource_a3id7") +metadata/_custom_type_script = "uid://lytit04mgc2d" + +[sub_resource type="Curve" id="Curve_pl7u1"] +_data = [Vector2(0, 0), 0.0, 3.9473681, 0, 1, Vector2(0.12, 0.4736842), 1.3157895, 1.3157895, 0, 0, Vector2(1, 0.86315787), 0.4425837, -0.9409129, 1, 0] +point_count = 3 + +[sub_resource type="Resource" id="Resource_qou6o"] +script = ExtResource("1_big7l") +member = "amount" +curve = SubResource("Curve_pl7u1") + +[sub_resource type="Resource" id="Resource_ixn1d"] +script = ExtResource("3_qf8os") +owner = SubResource("Resource_4n83u") + +[sub_resource type="CompositorEffect" id="CompositorEffect_ixqtu"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_x4xey") +amount = 0.0 +topColor = Color(2.8845115, 2.8845115, 2.8845115, 1) +bottomColor = Color(0.9480516, 0.8880912, 0.8418834, 1) +scanLineHeight = 3 +rgbTintAmount = 1.0 +rgbSize = 1 +useRGBOffset = true +rgbOffsetLineHeight = 8 +animationTargets = [SubResource("Resource_qou6o")] +compositorEffectID = SubResource("Resource_ixn1d") +metadata/_custom_type_script = "uid://dxnmlb5wobxtw" + +[sub_resource type="Curve" id="Curve_1ntwo"] +_limits = [0.0, 0.5, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.16315788, 0, 1, Vector2(1, 0.16315788), 0.16315788, -0.9409129, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_13517"] +script = ExtResource("1_big7l") +member = "distortionAmount" +curve = SubResource("Curve_1ntwo") + +[sub_resource type="Resource" id="Resource_027rg"] +script = ExtResource("3_qf8os") +owner = SubResource("Resource_4n83u") + +[sub_resource type="Gradient" id="Gradient_6kf7p"] +offsets = PackedFloat32Array(0.35329342, 0.5449102, 0.6047904, 0.70658684, 0.73652697, 1) +colors = PackedColorArray(0.735357, 0.735357, 0.735357, 1, 0.735357, 0.735357, 0.735357, 1, 0.7977378, 0.735357, 0.735357, 1, 0.7977378, 0.735357, 0.735357, 1, 0.735357, 0.735357, 0.735357, 1, 0.735357, 0.735357, 0.735357, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_6xf1f"] +gradient = SubResource("Gradient_6kf7p") +fill_from = Vector2(0, 1) +fill_to = Vector2(0, 0) + +[sub_resource type="Gradient" id="Gradient_gwku0"] +offsets = PackedFloat32Array(0.5808383) +colors = PackedColorArray(1, 1, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_fy8er"] +gradient = SubResource("Gradient_gwku0") +fill = 1 +fill_from = Vector2(0.36796537, 0.47619048) + +[sub_resource type="CompositorEffect" id="CompositorEffect_m7r8b"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_2tsv7") +distortionAmount = 0.0 +smearingSteps = 4 +smearing = 1.5 +redShift = 1.0 +blueShift = -0.263 +distortionTexture = SubResource("GradientTexture2D_6xf1f") +distortionScroll = Vector2(0, 1) +maskTexture = SubResource("GradientTexture2D_fy8er") +animationTargets = [SubResource("Resource_13517")] +compositorEffectID = SubResource("Resource_027rg") +metadata/_custom_type_script = "uid://balixgskgouhm" + +[sub_resource type="Curve" id="Curve_ixn1d"] +_data = [Vector2(0, 0), 0.0, 0.22105265, 0, 1, Vector2(1, 0.22105265), 0.22105265, -0.9409129, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_0ihg0"] +script = ExtResource("1_big7l") +member = "distortionAmount" +curve = SubResource("Curve_ixn1d") + +[sub_resource type="Resource" id="Resource_e2s3r"] +script = ExtResource("3_qf8os") +owner = SubResource("Resource_4n83u") + +[sub_resource type="Gradient" id="Gradient_uhxun"] +offsets = PackedFloat32Array(0.35329342, 0.57894737, 0.6157895, 0.66842103, 0.7, 1) +colors = PackedColorArray(0.735357, 0.735357, 0.735357, 1, 0.735357, 0.735357, 0.735357, 1, 0.7977378, 0.735357, 0.735357, 1, 0.7977378, 0.735357, 0.735357, 1, 0.735357, 0.735357, 0.735357, 1, 0.735357, 0.735357, 0.735357, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_4rdwj"] +gradient = SubResource("Gradient_uhxun") +fill_from = Vector2(0, 1) +fill_to = Vector2(0, 0) + +[sub_resource type="Gradient" id="Gradient_jyu1d"] +offsets = PackedFloat32Array(0.5808383) +colors = PackedColorArray(1, 1, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_msay1"] +gradient = SubResource("Gradient_jyu1d") +fill = 1 +fill_from = Vector2(0.36796537, 0.47619048) + +[sub_resource type="CompositorEffect" id="CompositorEffect_ie6m2"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_2tsv7") +distortionAmount = 0.0 +smearingSteps = 1 +smearing = 1.2009 +redShift = -0.5327 +blueShift = 0.6529 +distortionTexture = SubResource("GradientTexture2D_4rdwj") +distortionTiling = Vector2(1, 0.2703) +distortionScroll = Vector2(0, 0.35) +maskTexture = SubResource("GradientTexture2D_msay1") +animationTargets = [SubResource("Resource_0ihg0")] +compositorEffectID = SubResource("Resource_e2s3r") +metadata/_custom_type_script = "uid://balixgskgouhm" + +[sub_resource type="Curve" id="Curve_yfwqk"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 1, Vector2(1, 0), 0.0, -0.9409129, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_iglkv"] +script = ExtResource("1_big7l") +member = "amount" +curve = SubResource("Curve_yfwqk") + +[sub_resource type="Resource" id="Resource_5ifxw"] +script = ExtResource("3_qf8os") +owner = SubResource("Resource_4n83u") + +[sub_resource type="Curve" id="Curve_r14qv"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Curve" id="Curve_mcvtj"] +_data = [Vector2(0, 0), 0.0, 12.226194, 0, 1, Vector2(0.05902777, 0.721685), 0.0, 0.0, 0, 0, Vector2(0.33175358, 0.16842103), 0.0, 0.0, 0, 0, Vector2(0.55450237, 0.9157895), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.18902573, 0.0, 1, 0] +point_count = 5 + +[sub_resource type="Curve" id="Curve_ju6hd"] +_data = [Vector2(0, 0), 0.0, 0.9994734, 0, 1, Vector2(0.09478673, 0.094736814), 0.0, 0.0, 0, 0, Vector2(0.09952608, 0.29473686), 0.0, 0.0, 0, 0, Vector2(0.27962086, 0.35789472), 0.12114836, 0.12114836, 0, 0, Vector2(0.39336494, 0.7894737), 0.0, 0.0, 0, 0, Vector2(0.58293843, 0.83157897), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.40382773, 0.0, 1, 0] +point_count = 7 + +[sub_resource type="CurveXYZTexture" id="CurveXYZTexture_r64p5"] +curve_x = SubResource("Curve_r14qv") +curve_y = SubResource("Curve_mcvtj") +curve_z = SubResource("Curve_ju6hd") + +[sub_resource type="CompositorEffect" id="CompositorEffect_p64cs"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_3jbr0") +amount = 0.0 +curves = SubResource("CurveXYZTexture_r64p5") +animationTargets = [SubResource("Resource_iglkv")] +compositorEffectID = SubResource("Resource_5ifxw") +metadata/_custom_type_script = "uid://v8yddy4erbru" + +[resource] +script = ExtResource("8_l3sri") +effects = [SubResource("CompositorEffect_btbfg"), SubResource("CompositorEffect_ixqtu"), SubResource("CompositorEffect_m7r8b"), SubResource("CompositorEffect_ie6m2"), SubResource("CompositorEffect_p64cs")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Digital Compression.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Digital Compression.tres new file mode 100644 index 0000000..07001aa --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Digital Compression.tres @@ -0,0 +1,178 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=30 format=3 uid="uid://c11wt1wu6ciyc"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_o7k2r"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_l025j"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_ppfcw"] +[ext_resource type="Script" uid="uid://dqsxgtt4e6vwu" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/BoxBlur/BoxBlurEffect.cs" id="4_58ml0"] +[ext_resource type="Script" uid="uid://b2oxy6ln560ys" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/ColorQuantizer/ColorQuantizerEffect.cs" id="5_w2f2x"] +[ext_resource type="Script" uid="uid://lytit04mgc2d" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Noise/ChannelPixelation/ChannelPixelationEffect.cs" id="6_t1i6v"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="7_nca4q"] + +[sub_resource type="Curve" id="Curve_h2kd5"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.5053305, 0), 0.0, 2.0215516, 0, 1, Vector2(1, 1), 2.0215516, 0.0, 1, 0] +point_count = 3 + +[sub_resource type="Resource" id="Resource_1djbv"] +script = ExtResource("1_o7k2r") +member = "intensity" +curve = SubResource("Curve_h2kd5") + +[sub_resource type="Resource" id="Resource_oqkh4"] +script = ExtResource("2_l025j") + +[sub_resource type="Resource" id="Resource_a4g6s"] +script = ExtResource("3_ppfcw") +owner = SubResource("Resource_oqkh4") + +[sub_resource type="CompositorEffect" id="CompositorEffect_sw5v3"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_58ml0") +intensity = 0.0 +noise = 4.5 +iterations = 1 +animationTargets = [SubResource("Resource_1djbv")] +compositorEffectID = SubResource("Resource_a4g6s") +metadata/_custom_type_script = "uid://dqsxgtt4e6vwu" + +[sub_resource type="Curve" id="Curve_0klnf"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1e-05, 0), 0.0, 0.50237286, 0, 1, Vector2(1, 0.50236785), 0.50237286, 0.0, 1, 0] +point_count = 3 + +[sub_resource type="Resource" id="Resource_hyrm7"] +script = ExtResource("1_o7k2r") +member = "amount" +curve = SubResource("Curve_0klnf") + +[sub_resource type="Curve" id="Curve_6a7ab"] +_limits = [0.0, 64.0, 0.0, 1.0] +_data = [Vector2(0, 64), 0.0, -41.370167, 0, 1, Vector2(1, 22.629837), -41.370167, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_y2w1i"] +script = ExtResource("1_o7k2r") +member = "rgbSteps" +curve = SubResource("Curve_6a7ab") + +[sub_resource type="Resource" id="Resource_adfmi"] +script = ExtResource("3_ppfcw") +owner = SubResource("Resource_oqkh4") + +[sub_resource type="CompositorEffect" id="CompositorEffect_wi6eu"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_w2f2x") +amount = 0.0 +redAmount = 0.0 +greenAmount = 0.0 +blueAmount = 0.0 +rgbAmount = 1.0 +rgbSteps = 64.0 +hueAmount = 0.0 +hueSteps = 19.1385 +saturationAmount = 0.0 +luminanceAmount = 0.0 +luminanceSteps = 24.7231 +animationTargets = [SubResource("Resource_hyrm7"), SubResource("Resource_y2w1i")] +compositorEffectID = SubResource("Resource_adfmi") +metadata/_custom_type_script = "uid://b2oxy6ln560ys" + +[sub_resource type="Curve" id="Curve_5q01g"] +_data = [Vector2(0, 0), 0.0, 0.32794005, 0, 1, Vector2(1, 0.32794005), 0.32794005, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_uykvh"] +script = ExtResource("1_o7k2r") +member = "amount" +curve = SubResource("Curve_5q01g") + +[sub_resource type="Curve" id="Curve_a4g6s"] +_limits = [0.0, 64.0, 0.0, 1.0] +_data = [Vector2(0, 4.899765), 0.0, 59.10023, 0, 1, Vector2(1, 64), 59.10023, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_x4jxv"] +script = ExtResource("1_o7k2r") +member = "pixelSizeX" +curve = SubResource("Curve_a4g6s") +targetType = 1 + +[sub_resource type="Resource" id="Resource_q5vwy"] +script = ExtResource("1_o7k2r") +member = "pixelSizeY" +curve = SubResource("Curve_a4g6s") +targetType = 1 + +[sub_resource type="Resource" id="Resource_ade2u"] +script = ExtResource("3_ppfcw") +owner = SubResource("Resource_oqkh4") + +[sub_resource type="CompositorEffect" id="CompositorEffect_7720d"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_t1i6v") +amount = 0.0 +pixelSizeX = 4 +pixelSizeY = 4 +targetChannel = 6 +noiseAmount = 1.0 +noiseScale = 0.01 +xU = Vector3(5, 0.01, 1) +xV = Vector3(1235, 0.1, 1) +yU = Vector3(5, 0.01, 1) +yV = Vector3(1235, 0.1, 1) +animationTargets = [SubResource("Resource_uykvh"), SubResource("Resource_x4jxv"), SubResource("Resource_q5vwy")] +compositorEffectID = SubResource("Resource_ade2u") +metadata/_custom_type_script = "uid://lytit04mgc2d" + +[sub_resource type="Curve" id="Curve_yynim"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_k2ykb"] +script = ExtResource("1_o7k2r") +member = "amount" +curve = SubResource("Curve_yynim") + +[sub_resource type="Resource" id="Resource_a0x8j"] +script = ExtResource("3_ppfcw") +owner = SubResource("Resource_oqkh4") + +[sub_resource type="CompositorEffect" id="CompositorEffect_a3id7"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_t1i6v") +amount = 0.0 +pixelSizeX = 16 +pixelSizeY = 16 +targetChannel = 3 +noiseAmount = 1.0 +noiseScale = 100.0 +xU = Vector3(5, 0.01, 10) +xV = Vector3(1235, 0.1, 1) +yU = Vector3(5, 1, 435) +yV = Vector3(1235, 0.1, 1) +animationTargets = [SubResource("Resource_k2ykb")] +compositorEffectID = SubResource("Resource_a0x8j") +metadata/_custom_type_script = "uid://lytit04mgc2d" + +[resource] +script = ExtResource("7_nca4q") +effects = [SubResource("CompositorEffect_sw5v3"), SubResource("CompositorEffect_wi6eu"), SubResource("CompositorEffect_7720d"), SubResource("CompositorEffect_a3id7")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Old Film.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Old Film.tres new file mode 100644 index 0000000..daf8ee6 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Old Film.tres @@ -0,0 +1,368 @@ +[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=67 format=3 uid="uid://bupv437tvb5yf"] + +[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_huxlh"] +[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_2sqw4"] +[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_pvdsg"] +[ext_resource type="Script" uid="uid://cn2103slcr2vs" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Sepia/SepiaEffect.cs" id="4_aapvk"] +[ext_resource type="Script" uid="uid://be2v7ns5irml5" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/EdgeDistortion/EdgeDistortionEffect.cs" id="5_84fcg"] +[ext_resource type="Script" uid="uid://dqsxgtt4e6vwu" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/BoxBlur/BoxBlurEffect.cs" id="6_qp6bm"] +[ext_resource type="Script" uid="uid://t5g1g1uv5yrj" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureOverlay/TextureOverlayEffect.cs" id="7_g2cwq"] +[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="8_0kucv"] + +[sub_resource type="Curve" id="Curve_5d4gp"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_ebrx4"] +script = ExtResource("1_huxlh") +member = "amount" +curve = SubResource("Curve_5d4gp") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_gyycf"] +script = ExtResource("2_2sqw4") + +[sub_resource type="Resource" id="Resource_6mw6d"] +script = ExtResource("3_pvdsg") +owner = SubResource("Resource_gyycf") + +[sub_resource type="CompositorEffect" id="CompositorEffect_huxlh"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("4_aapvk") +amount = 0.0 +hue = 38.956 +saturation = 0.3462 +saturationAmount = 0.522 +animationTargets = [SubResource("Resource_ebrx4")] +compositorEffectID = SubResource("Resource_6mw6d") +metadata/_custom_type_script = "uid://cn2103slcr2vs" + +[sub_resource type="Curve" id="Curve_56wl1"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_b8s5d"] +script = ExtResource("1_huxlh") +member = "blendAmount" +curve = SubResource("Curve_56wl1") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_02dsj"] +script = ExtResource("3_pvdsg") +owner = SubResource("Resource_gyycf") + +[sub_resource type="CompositorEffect" id="CompositorEffect_2sqw4"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("5_84fcg") +distortionAmount = 0.0803 +blendAmount = 0.0 +verticalAmount = 0.6281 +smearingSteps = 3 +smearing = 1.5 +redShift = -0.7734 +greenShift = -0.7324 +blueShift = -0.6961 +animationTargets = [SubResource("Resource_b8s5d")] +compositorEffectID = SubResource("Resource_02dsj") +metadata/_custom_type_script = "uid://be2v7ns5irml5" + +[sub_resource type="Curve" id="Curve_rhkl8"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_tlyrv"] +script = ExtResource("1_huxlh") +member = "intensity" +curve = SubResource("Curve_rhkl8") +curveScale = 0.1322 +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_caimu"] +script = ExtResource("3_pvdsg") +owner = SubResource("Resource_gyycf") + +[sub_resource type="CompositorEffect" id="CompositorEffect_pvdsg"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("6_qp6bm") +intensity = 0.0 +noise = 0.0215 +kernelOffset = 1 +iterations = 3 +animationTargets = [SubResource("Resource_tlyrv")] +compositorEffectID = SubResource("Resource_caimu") +metadata/_custom_type_script = "uid://dqsxgtt4e6vwu" + +[sub_resource type="Curve" id="Curve_57qxk"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_ggir3"] +texture_mode = 1 +curve = SubResource("Curve_57qxk") + +[sub_resource type="Curve" id="Curve_holw7"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_mkmom"] +script = ExtResource("1_huxlh") +member = "opacity" +curve = SubResource("Curve_holw7") +curveScale = 0.4338 +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_7t752"] +script = ExtResource("3_pvdsg") +owner = SubResource("Resource_gyycf") + +[sub_resource type="Gradient" id="Gradient_1tehg"] +colors = PackedColorArray(0.9073196, 0.9073196, 0.9073196, 1, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_mdvp5"] +frequency = 0.0058 +fractal_lacunarity = 2.52 +fractal_gain = 0.8385 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_hm381"] +noise = SubResource("FastNoiseLite_mdvp5") +color_ramp = SubResource("Gradient_1tehg") +seamless = true +seamless_blend_skirt = 0.4 + +[sub_resource type="Gradient" id="Gradient_ily1w"] +offsets = PackedFloat32Array(0, 0.41530055, 0.9822222) +colors = PackedColorArray(0, 0, 0, 1, 0.5785921, 0.5785921, 0.5785921, 1, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_p0wf3"] +frequency = 0.771 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_s6ult"] +width = 2048 +height = 2048 +noise = SubResource("FastNoiseLite_p0wf3") +color_ramp = SubResource("Gradient_ily1w") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_aapvk"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_g2cwq") +opacity = 0.0 +overlayTexture = SubResource("NoiseTexture2D_s6ult") +overlayTint = Color(0.5, 0.5, 0.5, 1) +tiling = Vector2(0.3, 0.3) +scrolling = Vector2(2.475, 4.3453) +scrollingFPS = 10.0 +maskTexture = SubResource("NoiseTexture2D_hm381") +alphaMapping = SubResource("CurveTexture_ggir3") +maskScrolling = Vector2(-0.192, -1.2405) +maskScrollingFPS = 3.0 +animationTargets = [SubResource("Resource_mkmom")] +compositorEffectID = SubResource("Resource_7t752") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_skyh6"] +_data = [Vector2(0, 0), 0.0, 0.47958922, 0, 1, Vector2(0.3363095, 0.1612904), 0.0, 0.0, 0, 0, Vector2(0.5029761, 1), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 1, 0] +point_count = 4 + +[sub_resource type="CurveTexture" id="CurveTexture_ca0t2"] +texture_mode = 1 +curve = SubResource("Curve_skyh6") + +[sub_resource type="Curve" id="Curve_1c1f5"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 0, Vector2(1, 1), 1.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_y6bsf"] +script = ExtResource("1_huxlh") +member = "opacity" +curve = SubResource("Curve_1c1f5") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_8wwdp"] +script = ExtResource("3_pvdsg") +owner = SubResource("Resource_gyycf") + +[sub_resource type="Gradient" id="Gradient_of5cr"] +offsets = PackedFloat32Array(0, 0.52459013, 1) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_a7bnx"] +gradient = SubResource("Gradient_of5cr") +fill_to = Vector2(0, 1) + +[sub_resource type="Gradient" id="Gradient_yn1hl"] +colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 0) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_mtdmv"] + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_hose8"] +noise = SubResource("FastNoiseLite_mtdmv") +color_ramp = SubResource("Gradient_yn1hl") +seamless = true + +[sub_resource type="CompositorEffect" id="CompositorEffect_84fcg"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_g2cwq") +opacity = 0.0 +overlayTexture = SubResource("NoiseTexture2D_hose8") +scrolling = Vector2(0.2, 0.56) +scrollingFPS = 10.0 +maskTexture = SubResource("GradientTexture2D_a7bnx") +alphaMapping = SubResource("CurveTexture_ca0t2") +animationTargets = [SubResource("Resource_y6bsf")] +compositorEffectID = SubResource("Resource_8wwdp") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_amr5b"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_k1m0c"] +texture_mode = 1 +curve = SubResource("Curve_amr5b") + +[sub_resource type="Curve" id="Curve_yccyd"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_n36k5"] +script = ExtResource("1_huxlh") +member = "opacity" +curve = SubResource("Curve_yccyd") +curveScale = 0.3938 +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_k3rlg"] +script = ExtResource("3_pvdsg") +owner = SubResource("Resource_gyycf") + +[sub_resource type="Gradient" id="Gradient_2yo2i"] +offsets = PackedFloat32Array(0.19672132, 0.4918033, 0.56284153, 0.6885246) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_n6pl8"] +gradient = SubResource("Gradient_2yo2i") + +[sub_resource type="Gradient" id="Gradient_hbmbv"] +offsets = PackedFloat32Array(0.34319526, 0.5464481, 0.8622222, 0.8888889) +colors = PackedColorArray(0.50638646, 0.50638646, 0.50638646, 0.086, 0.61076367, 0.61076367, 0.61076367, 0.17185088, 0.73227745, 0.73227745, 0.73227745, 0.27179667, 1, 1, 1, 0.492) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_6mdhb"] +frequency = 0.0068 +fractal_gain = 1.1725 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_sj858"] +height = 1024 +noise = SubResource("FastNoiseLite_6mdhb") +color_ramp = SubResource("Gradient_hbmbv") +seamless = true +seamless_blend_skirt = 0.0 + +[sub_resource type="CompositorEffect" id="CompositorEffect_qp6bm"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_g2cwq") +opacity = 0.0 +overlayTexture = SubResource("NoiseTexture2D_sj858") +tiling = Vector2(2.087, 0.05) +scrolling = Vector2(0.7656, 1.3235) +scrollingFPS = 12.0 +maskTexture = SubResource("GradientTexture2D_n6pl8") +alphaMapping = SubResource("CurveTexture_k1m0c") +maskScrollingFPS = 20.0 +animationTargets = [SubResource("Resource_n36k5")] +compositorEffectID = SubResource("Resource_k3rlg") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[sub_resource type="Curve" id="Curve_jdj0p"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_5cyer"] +texture_mode = 1 +curve = SubResource("Curve_jdj0p") + +[sub_resource type="Curve" id="Curve_f325h"] +_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Resource" id="Resource_jsenn"] +script = ExtResource("1_huxlh") +member = "opacity" +curve = SubResource("Curve_f325h") +metadata/_custom_type_script = "uid://dvvfvlutisecy" + +[sub_resource type="Resource" id="Resource_b8fgx"] +script = ExtResource("3_pvdsg") +owner = SubResource("Resource_gyycf") + +[sub_resource type="Gradient" id="Gradient_nwhmp"] +colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_7i7sn"] + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_o8fa0"] +width = 4 +height = 4 +noise = SubResource("FastNoiseLite_7i7sn") +color_ramp = SubResource("Gradient_nwhmp") +seamless = true + +[sub_resource type="Gradient" id="Gradient_xvwby"] +offsets = PackedFloat32Array(0.6830601, 0.91803277, 1) +colors = PackedColorArray(0.20129895, 0.03975258, 0.03975258, 0, 0.24203092, 0.10336319, 0.041287772, 0.4999999, 0.28276289, 0.16697384, 0.04282297, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_nhn56"] +gradient = SubResource("Gradient_xvwby") +fill = 2 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="CompositorEffect" id="CompositorEffect_g2cwq"] +resource_local_to_scene = false +resource_name = "" +enabled = true +effect_callback_type = 4 +needs_motion_vectors = false +needs_normal_roughness = false +script = ExtResource("7_g2cwq") +opacity = 0.0 +overlayTexture = SubResource("GradientTexture2D_nhn56") +maskTexture = SubResource("NoiseTexture2D_o8fa0") +alphaMapping = SubResource("CurveTexture_5cyer") +animationTargets = [SubResource("Resource_jsenn")] +compositorEffectID = SubResource("Resource_b8fgx") +metadata/_custom_type_script = "uid://t5g1g1uv5yrj" + +[resource] +script = ExtResource("8_0kucv") +effects = [SubResource("CompositorEffect_huxlh"), SubResource("CompositorEffect_2sqw4"), SubResource("CompositorEffect_pvdsg"), SubResource("CompositorEffect_aapvk"), SubResource("CompositorEffect_84fcg"), SubResource("CompositorEffect_qp6bm"), SubResource("CompositorEffect_g2cwq")] +metadata/_custom_type_script = "uid://ckixweetchlo0" diff --git a/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs b/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs index b10763c..5de73d5 100644 --- a/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs +++ b/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs @@ -7,7 +7,11 @@ namespace Rokojori [Tool] [GlobalClass] public abstract partial class RokojoriCompositorEffect:CompositorEffect - { + { + [ExportGroup("Animation Targets")] + [Export] + public RokojoriCompositorEffectAnimationTarget[] animationTargets = []; + [ExportGroup("Debug")] [Export] public RokojoriCompositorEffectID compositorEffectID; @@ -39,6 +43,16 @@ namespace Rokojori } + public void UpdateAnimationTargets( float value ) + { + if ( animationTargets == null ) + { + return; + } + + animationTargets.ForEach( at => at.OnAnimationDriverChange( this, value ) ); + } + protected void _InitializeCompositorEffect() { OnConfigure(); diff --git a/Runtime/Rendering/Context/RDContext.cs b/Runtime/Rendering/Context/RDContext.cs index 7a7ea0a..f370506 100644 --- a/Runtime/Rendering/Context/RDContext.cs +++ b/Runtime/Rendering/Context/RDContext.cs @@ -66,6 +66,16 @@ namespace Rokojori public Vector2I internalSize => _sceneBuffers.GetInternalSize(); + public Projection GetCameraProjection() + { + return sceneData.GetCamProjection(); + } + + public Transform3D GetCameraTransform() + { + return sceneData.GetCamTransform(); + } + public RDTexture GetScreenColorTexture() { return RDTexture.Color( this ); diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc new file mode 100644 index 0000000..5ac9852 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc @@ -0,0 +1,107 @@ + + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + +layout( set = 0, binding = 0 ) +uniform sampler2D topImage; + +layout( set = 1, binding = 0 ) +uniform sampler2D maskImage; + +layout( set = 2, binding = 0 ) +uniform sampler2D alphaMapping; + +layout( set = 3, binding = 0 ) +uniform sampler2D bottomImage; + +layout( rgba16f, set = 4, binding = 0 ) +uniform image2D outputImage; + + +layout( push_constant, std430 ) +uniform Parameters +{ + vec4 topTilingOffset; + vec4 maskTilingOffset; + vec4 bottomTilingOffset; + vec4 topTint; + + float opacity; + float topColorConversion; + float maskColorConversion; + float bottomColorConversion; + + float outputColorConversion; + float forceOpaqueBottom; + float uvMode; + float uvModeSetting; + +} parameters; + +vec2 uvMode( vec2 uv, int uvMode, float uvModeSetting ) +{ + int RECT = 0; + int CIRCLE = 1; + + + if ( RECT == uvMode ) + { + return uv; + } + + if ( CIRCLE == uvMode ) + { + float PI = 3.14159265358979323846; + float MAX_DISTANCE = 0.7071067811865476; + + vec2 directionToCenter = uv - vec2( 0.5 ); + float angle = atan( directionToCenter.y, directionToCenter.x ); + float normalizedAngle = ( angle + PI ) / ( 2.0 * PI ); + float directionLength = length( directionToCenter ) / MAX_DISTANCE; + + return vec2( normalizedAngle, directionLength ); + } + +} + +void main( ) +{ + ivec2 size = imageSize( outputImage ); + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + vec2 uv = ( vec2( xy ) + vec2( 0.5 ) ) / vec2( size ); + + vec2 distortedUV = uvMode( uv, int( parameters.uvMode ), parameters.uvModeSetting ); + + vec4 topColor = textureLod( topImage, distortedUV * parameters.topTilingOffset.xy + parameters.topTilingOffset.zw, 0 ); + vec4 maskColor = textureLod( maskImage, distortedUV * parameters.maskTilingOffset.xy + parameters.maskTilingOffset.zw, 0 ); + vec4 bottomColor = textureLod( bottomImage, uv * parameters.bottomTilingOffset.xy + parameters.bottomTilingOffset.zw, 0 ); + + topColor *= parameters.topTint; + + topColor = colorSpaceConversion( topColor, int( parameters.topColorConversion ) ); + maskColor = colorSpaceConversion( maskColor, int( parameters.maskColorConversion ) ); + bottomColor = colorSpaceConversion( bottomColor, int( parameters.bottomColorConversion ) ); + + topColor.a *= maskColor.r; + + topColor.a = textureLod( alphaMapping, vec2( clamp( topColor.a, 0.0, 1.0 ), 0.0 ), 0 ).r; + topColor.a *= parameters.opacity; + + if ( parameters.forceOpaqueBottom > 0.5 ) + { + bottomColor.a = 1.; + } + + vec4 blended = ___blendMode___( bottomColor, topColor ); + + blended = colorSpaceConversion( blended, int( parameters.outputColorConversion ) ); + + + imageStore( outputImage, xy, blended ); +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc.uid new file mode 100644 index 0000000..d15c3bb --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc.uid @@ -0,0 +1 @@ +uid://bgtkupymcc5ms diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Alpha/BlendMode_Alpha.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Alpha/BlendMode_Alpha.glsl index 1f51576..c71d13e 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Alpha/BlendMode_Alpha.glsl +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Alpha/BlendMode_Alpha.glsl @@ -1,77 +1,11 @@ #[compute] #version 450 - + #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" - -layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; - -layout( set = 0, binding = 0 ) -uniform sampler2D topImage; - -layout( set = 1, binding = 0 ) -uniform sampler2D maskImage; - -layout( set = 2, binding = 0 ) -uniform sampler2D bottomImage; - -layout( rgba16f, set = 3, binding = 0 ) -uniform image2D outputImage; - - -layout( push_constant, std430 ) -uniform Parameters + +vec4 ___blendMode___( vec4 bottomColor, vec4 topColor ) { - vec4 topTilingOffset; - vec4 maskTilingOffset; - vec4 bottomTilingOffset; - vec4 topTint; + return blendMode_alpha( bottomColor, topColor ); +} - float opacity; - float topColorConversion; - float maskColorConversion; - float bottomColorConversion; - - float outputColorConversion; - float forceOpaqueBottom; - float p2; - float p3; - -} parameters; - - -void main( ) -{ - ivec2 size = imageSize( outputImage ); - ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); - - if ( any( greaterThanEqual( xy, size ) ) ) - { - return; - } - - vec2 uv = ( vec2( xy ) + vec2( 0.5 ) ) / vec2( size ); - - vec4 topColor = texture( topImage, uv * parameters.topTilingOffset.xy + parameters.topTilingOffset.zw ); - vec4 maskColor = texture( maskImage, uv * parameters.maskTilingOffset.xy + parameters.maskTilingOffset.zw ); - vec4 bottomColor = texture( bottomImage, uv * parameters.bottomTilingOffset.xy + parameters.bottomTilingOffset.zw ); - - topColor *= parameters.topTint; - - topColor = colorSpaceConversion( topColor, int( parameters.topColorConversion ) ); - maskColor = colorSpaceConversion( maskColor, int( parameters.maskColorConversion ) ); - bottomColor = colorSpaceConversion( bottomColor, int( parameters.bottomColorConversion ) ); - - topColor.a *= parameters.opacity * maskColor.r ; - - if ( parameters.forceOpaqueBottom > 0.5 ) - { - bottomColor.a = 1.; - } - - vec4 blended = blendMode_alpha( bottomColor, topColor ); - - blended = colorSpaceConversion( blended, int( parameters.outputColorConversion ) ); - - - imageStore( outputImage, xy, blended ); -} \ No newline at end of file +#include "res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc" diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl new file mode 100644 index 0000000..f678636 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl @@ -0,0 +1,12 @@ +#[compute] +#version 450 + +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" + +vec4 ___blendMode___( vec4 bottomColor, vec4 topColor ) +{ + return blendMode_colorHDRRec709( bottomColor, topColor ); +} + +#include "res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc" + \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl.import new file mode 100644 index 0000000..34c64bc --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://5h8qtljiyh7u" +path="res://.godot/imported/BlendMode_Color.glsl-d5cc84c39a485bec97ff808773f791e5.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl" +dest_files=["res://.godot/imported/BlendMode_Color.glsl-d5cc84c39a485bec97ff808773f791e5.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/RG_BlendMode_Color.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/RG_BlendMode_Color.cs new file mode 100644 index 0000000..ba44b01 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/RG_BlendMode_Color.cs @@ -0,0 +1,20 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_BlendMode_Color:RG_BlendModeBase + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Blend/BlendMode_Color/BlendMode_Color.glsl" ); + + public RG_BlendMode_Color( RDGraph graph ):base( graph, shaderPath ) + {} + + public override RG_BlendModeType GetBlendModeType() + { + return RG_BlendModeType.Screen; + } + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/RG_BlendMode_Color.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/RG_BlendMode_Color.cs.uid new file mode 100644 index 0000000..445b52c --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Color/RG_BlendMode_Color.cs.uid @@ -0,0 +1 @@ +uid://csgql6416vtdj diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Screen/BlendMode_Screen.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Screen/BlendMode_Screen.glsl index f84eca7..45650dc 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Screen/BlendMode_Screen.glsl +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode_Screen/BlendMode_Screen.glsl @@ -1,77 +1,11 @@ #[compute] #version 450 - + #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" -layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; - -layout( set = 0, binding = 0 ) -uniform sampler2D topImage; - -layout( set = 1, binding = 0 ) -uniform sampler2D maskImage; - -layout( set = 2, binding = 0 ) -uniform sampler2D bottomImage; - -layout( rgba16f, set = 3, binding = 0 ) -uniform image2D outputImage; - - -layout( push_constant, std430 ) -uniform Parameters +vec4 ___blendMode___( vec4 bottomColor, vec4 topColor ) { - vec4 topTilingOffset; - vec4 maskTilingOffset; - vec4 bottomTilingOffset; - vec4 topTint; + return blendMode_screen( bottomColor, topColor ); +} - float opacity; - float topColorConversion; - float maskColorConversion; - float bottomColorConversion; - - float outputColorConversion; - float forceOpaqueBottom; - float p2; - float p3; - -} parameters; - - -void main( ) -{ - ivec2 size = imageSize( outputImage ); - ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); - - if ( any( greaterThanEqual( xy, size ) ) ) - { - return; - } - - vec2 uv = ( vec2( xy ) + vec2( 0.5 ) ) / vec2( size ); - - vec4 topColor = texture( topImage, uv * parameters.topTilingOffset.xy + parameters.topTilingOffset.zw ); - vec4 maskColor = texture( maskImage, uv * parameters.maskTilingOffset.xy + parameters.maskTilingOffset.zw ); - vec4 bottomColor = texture( bottomImage, uv * parameters.bottomTilingOffset.xy + parameters.bottomTilingOffset.zw ); - - topColor *= parameters.topTint; - - topColor = colorSpaceConversion( topColor, int( parameters.topColorConversion ) ); - maskColor = colorSpaceConversion( maskColor, int( parameters.maskColorConversion ) ); - bottomColor = colorSpaceConversion( bottomColor, int( parameters.bottomColorConversion ) ); - - topColor.a *= parameters.opacity * maskColor.r ; - - if ( parameters.forceOpaqueBottom > 0.5 ) - { - bottomColor.a = 1.; - } - - vec4 blended = blendMode_screen( bottomColor, topColor ); - - blended = colorSpaceConversion( blended, int( parameters.outputColorConversion ) ); - - - imageStore( outputImage, xy, blended ); -} \ No newline at end of file +#include "res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blend/BlendMode.gdshaderinc" diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl new file mode 100644 index 0000000..98ced9f --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl @@ -0,0 +1,147 @@ +#[compute] +#version 450 + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + +layout( set = 0, binding = 0 ) +uniform sampler2D inputImage; + +layout( rgba16f, set = 1, binding = 0 ) +uniform image2D outputImage; + + +layout( push_constant, std430 ) +uniform Parameters +{ + float intensity; + float noise; + float kernelOffset; + float pad0; + + float kernelRadiusX; + float kernelRadiusY; + float pad1; + float pad2; + +} parameters; + +vec3 SRGBtoLINEAR( vec3 sRGB ) +{ + return mix( pow( (sRGB + vec3( 0.055 )) * ( 1.0 / ( 1.0 + 0.055 )),vec3( 2.4 )),sRGB * ( 1.0 / 12.92 ),lessThan( sRGB,vec3( 0.04045 )) ); +} + +vec4 SRGBtoLINEAR( vec4 sRGB ) +{ + return vec4( SRGBtoLINEAR( sRGB.rgb ), sRGB.a ); +} + +vec3 LINEARtoSRGB( vec3 linear ) +{ + vec3 color = linear; + const vec3 a = vec3(0.055f); + return mix((vec3(1.0f) + a) * pow(color.rgb, vec3(1.0f / 2.4f)) - a, 12.92f * color.rgb, lessThan(color.rgb, vec3(0.0031308f))); +} + +vec4 LINEARtoSRGB( vec4 linear ) +{ + return vec4( LINEARtoSRGB( linear.rgb ), linear.a ); +} + +float randomFloat( vec2 uv ) +{ + return fract( sin( dot( uv.xy, vec2( 12.9898,78.233 ) ) ) * 43758.5453123 ); +} + +vec2 random( vec2 uv ) +{ + float x = randomFloat( uv ); + float y = randomFloat( uv + vec2( 10002, -23589 ) ); + + return vec2( x, y ) * 2.0 - vec2( 1.0, 1.0 ); +} + +float computeGaussianWeight( float x, float y, float sigma ) +{ + return exp( - ( x * x + y * y ) / ( 2.0 * sigma * sigma )); +} + + + +void main( ) +{ + ivec2 size = imageSize( outputImage ); + ivec2 pixelUV = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( pixelUV, size ) ) ) + { + return; + } + + vec4 color = vec4( 0.0 ); + + int kernelRadiusX = int( parameters.kernelRadiusX ); + int kernelRadiusY = int( parameters.kernelRadiusY ); + + float kernelOffset = parameters.kernelOffset; + + + int xS = -kernelRadiusX; + int xE = kernelRadiusX; + + int yS = -kernelRadiusY; + int yE = kernelRadiusY; + + vec2 toUV = vec2( 1.0 ) / vec2( size ); + + float sigma = float( max( kernelRadiusX, kernelRadiusY ) ) * 0.5; + + float sumWeights = 0.0; + + if ( parameters.noise > 0.0 ) + { + for ( int x = xS; x <= xE; x++ ) + { + for ( int y = yS; y <= yE; y++ ) + { + vec2 xy = vec2( x, y ) * kernelOffset; + vec2 kernelUV = vec2( pixelUV + vec2( 0.5 ) ) + xy; + + float weight = computeGaussianWeight( float( x ), float( y ), sigma ); + + kernelUV += vec2( random( kernelUV ) * parameters.noise ); + + color += ( textureLod( inputImage, kernelUV * toUV , 0 ) ) * weight; + + sumWeights += weight; + } + } + } + else + { + for ( int x = xS; x <= xE; x++ ) + { + for ( int y = yS; y <= yE; y++ ) + { + vec2 xy = vec2( x, y ) * kernelOffset; + vec2 kernelUV = vec2( pixelUV + vec2( 0.5 ) ) + xy; + + float weight = computeGaussianWeight( float( x ), float( y ), sigma ); + + color += ( textureLod( inputImage, kernelUV * toUV , 0 ) ) * weight; + + sumWeights += weight; + } + } + } + + color /= sumWeights; + + color = ( color ); + + vec2 uv = vec2( pixelUV + vec2( 0.5 ) ) / vec2( size ); + + vec4 originalColor = textureLod( inputImage, uv, 0 ); + vec4 mixedColor = mix( originalColor, color, parameters.intensity ); + + imageStore( outputImage, pixelUV, mixedColor ); +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl.import new file mode 100644 index 0000000..5d4b0a1 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://ih0cba3gs5cf" +path="res://.godot/imported/GaussBlur.glsl-b2356a1adb190aad34aee12d48e7bccb.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl" +dest_files=["res://.godot/imported/GaussBlur.glsl-b2356a1adb190aad34aee12d48e7bccb.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/RG_GaussBlur.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/RG_GaussBlur.cs new file mode 100644 index 0000000..b0b46ed --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/RG_GaussBlur.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_GaussBlur:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Blurs/GaussBlur/GaussBlur.glsl" ); + + public RG_GaussBlur( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/RG_GaussBlur.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/RG_GaussBlur.cs.uid new file mode 100644 index 0000000..9013f1b --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/GaussBlur/RG_GaussBlur.cs.uid @@ -0,0 +1 @@ +uid://djbb0reefdwg6 diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl new file mode 100644 index 0000000..5b47c55 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl @@ -0,0 +1,105 @@ +#[compute] +#version 450 + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + +layout( rgba16f, set = 0, binding = 0 ) +uniform image2D inputImage; + +layout( rgba16f, set = 1, binding = 0 ) +uniform image2D outputImage; + +layout( set = 2, binding = 0 ) +uniform sampler2D fadingSampler; + +layout( push_constant, std430 ) +uniform Parameters +{ + float outputX; + float outputY; + float direction; + float inputEdge; + + float blurMode; + float fading; + float p3; + float p4; + + +} parameters; + +float getLuma( vec4 rgb ) +{ + return dot( rgb.rgb, vec3( 0.3, 0.5, 0.2 ) ); +} + +void main( ) +{ + ivec2 size = ivec2( int( parameters.outputX ), int( parameters.outputY ) ); + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + int X_DIRECTION = 0; + int Y_DIRECTION = 1; + + ivec2 uv0 = xy; + ivec2 uv1 = xy; + + int inputEdge = int( parameters.inputEdge ) - 1; + + if ( X_DIRECTION == int( parameters.direction ) ) + { + uv0.y = min( inputEdge, xy.y * 2 ); + uv1.y = min( inputEdge, xy.y * 2 + 1 ); + } + else + { + uv0.x = min( inputEdge, xy.x * 2 ); + uv1.x = min( inputEdge, xy.x * 2 + 1 ); + } + + float fading = 1.0; + + + vec4 colorA = imageLoad( inputImage, uv0 ); + vec4 colorB = imageLoad( inputImage, uv1 ); + + if ( parameters.fading > 0.0 ) + { + vec2 size = vec2( parameters.outputX, parameters.outputY ); + + if ( X_DIRECTION == int( parameters.direction ) ) + { + size.y = inputEdge; + } + else + { + size.x = inputEdge; + } + + colorA *= textureLod( fadingSampler, vec2( uv0 ) / size, 0 ).r; + colorB *= textureLod( fadingSampler, vec2( uv1 ) / size, 0 ).r; + } + + int blurMode = int( parameters.blurMode ); + vec4 maxColor = vec4( 0.0 ); + + int MAX = 0; + int AVERAGE = 1; + + if ( blurMode == MAX ) + { + maxColor = max( colorA, colorB ); + } + else if ( blurMode == AVERAGE ) + { + maxColor = ( colorA + colorB ) / 2.0; + } + + + imageStore( outputImage, xy, maxColor ); +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl.import new file mode 100644 index 0000000..648bf2a --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://h1a120bq3fmj" +path="res://.godot/imported/FadedMaxBlur.glsl-78760b577656af5dd1105f5c01e2acf3.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl" +dest_files=["res://.godot/imported/FadedMaxBlur.glsl-78760b577656af5dd1105f5c01e2acf3.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl new file mode 100644 index 0000000..2b0522f --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl @@ -0,0 +1,82 @@ +#[compute] +#version 450 + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + +layout( rgba16f, set = 0, binding = 0 ) +uniform image2D inputImage; + +layout( rgba16f, set = 1, binding = 0 ) +uniform image2D outputImage; + +layout( push_constant, std430 ) +uniform Parameters +{ + float outputX; + float outputY; + float direction; + float inputEdge; + + float blurMode; + float p2; + float p3; + float p4; + + +} parameters; + +float getLuma( vec4 rgb ) +{ + return dot( rgb.rgb, vec3( 0.3, 0.5, 0.2 ) ); +} + +void main( ) +{ + ivec2 size = ivec2( int( parameters.outputX ), int( parameters.outputY ) ); + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + int X_DIRECTION = 0; + int Y_DIRECTION = 1; + + ivec2 uv0 = xy; + ivec2 uv1 = xy; + + int inputEdge = int( parameters.inputEdge ) - 1; + + if ( X_DIRECTION == int( parameters.direction ) ) + { + uv0.y = min( inputEdge, xy.y * 2 ); + uv1.y = min( inputEdge, xy.y * 2 + 1 ); + } + else + { + uv0.x = min( inputEdge, xy.x * 2 ); + uv1.x = min( inputEdge, xy.x * 2 + 1 ); + } + + vec4 colorA = imageLoad( inputImage, uv0 ); + vec4 colorB = imageLoad( inputImage, uv1 ); + + int blurMode = int( parameters.blurMode ); + vec4 maxColor = vec4( 0.0 ); + + int MAX = 0; + int AVERAGE = 1; + + if ( blurMode == MAX ) + { + maxColor = max( colorA, colorB ); + } + else if ( blurMode == AVERAGE ) + { + maxColor = ( colorA + colorB ) / 2.0; + } + + + imageStore( outputImage, xy, maxColor ); +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl.import new file mode 100644 index 0000000..bf9f24a --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://7g5dk4jl4jy2" +path="res://.godot/imported/MaxBlur.glsl-131ee949dde47493c456c9a46cdffa40.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl" +dest_files=["res://.godot/imported/MaxBlur.glsl-131ee949dde47493c456c9a46cdffa40.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_FadedMaxBlur.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_FadedMaxBlur.cs new file mode 100644 index 0000000..1479dff --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_FadedMaxBlur.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_FadedMaxBlur:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Blurs/MaxBlur/FadedMaxBlur.glsl" ); + + public RG_FadedMaxBlur( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_FadedMaxBlur.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_FadedMaxBlur.cs.uid new file mode 100644 index 0000000..ef3618f --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_FadedMaxBlur.cs.uid @@ -0,0 +1 @@ +uid://dd1uukykuqgc5 diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_MaxBlur.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_MaxBlur.cs new file mode 100644 index 0000000..57f814c --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_MaxBlur.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_MaxBlur:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Blurs/MaxBlur/MaxBlur.glsl" ); + + public RG_MaxBlur( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_MaxBlur.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_MaxBlur.cs.uid new file mode 100644 index 0000000..e352569 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/MaxBlur/RG_MaxBlur.cs.uid @@ -0,0 +1 @@ +uid://bfxu2yf88a56v diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Fill.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Fill.glsl new file mode 100644 index 0000000..5817708 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Fill.glsl @@ -0,0 +1,33 @@ +#[compute] +#version 450 + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + + +layout( rgba16, set = 0, binding = 0 ) +uniform restrict writeonly image2D outputImage; + +layout( push_constant, std430 ) +uniform Parameters +{ + float r; + float g; + float b; + float a; + +} parameters; + +void main() +{ + ivec2 size = imageSize( outputImage ); + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + vec4 color = vec4( parameters.r, parameters.g, parameters.b, parameters.a ); + + imageStore( outputImage, xy, color ); +} diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Fill.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Fill.glsl.import new file mode 100644 index 0000000..53bde02 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Fill.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://crjhgnbylqgv2" +path="res://.godot/imported/Fill.glsl-38169c501d1eb440d92c46b8064c54e2.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Fill.glsl" +dest_files=["res://.godot/imported/Fill.glsl-38169c501d1eb440d92c46b8064c54e2.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/RG_Fill.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/RG_Fill.cs new file mode 100644 index 0000000..144bbc1 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/RG_Fill.cs @@ -0,0 +1,26 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_Fill:RDShaderProcessor + { + public readonly CompositorEffectGraphTextureSlot output; + + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Copy/Fill.glsl" ); + + public RG_Fill( RDGraph graph ):base( graph, shaderPath ) + { + output = new CompositorEffectGraphTextureSlot( this ); + + _textureSlots.AddRange( new List{ output } ); + } + + public void SetTextureSlotInput( RDGraphTextureSlotInput outputSlot ) + { + outputSlot.ConnectTo( output ); + } + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/RG_Fill.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/RG_Fill.cs.uid new file mode 100644 index 0000000..a5d5617 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/RG_Fill.cs.uid @@ -0,0 +1 @@ +uid://c6mpjavb0kkr2 diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs index b4e765e..4e94413 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs @@ -108,6 +108,11 @@ namespace Rokojori _connectedSlots.Add( slot ); } + public void SetDisconnected( CompositorEffectGraphTextureSlot slot ) + { + _connectedSlots.Remove( slot ); + } + public CEG_BufferTexture( RDGraph graph, CEG_TextureCreator creator ):base( graph ) { _creator = creator; @@ -150,6 +155,11 @@ namespace Rokojori { slot.SetInput( this ); } + + public void Disconnect( CompositorEffectGraphTextureSlot slot ) + { + slot.RemoveInput( this ); + } } } \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs index f5ee37d..d60ae94 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs @@ -23,6 +23,7 @@ namespace Rokojori outputSlot.ConnectTo( output ); } + public void SetTextureSlotInputs( CEG_ImageProcessor imageProcessorBefore ) { imageProcessorBefore.input.ConnectTo( input ); @@ -37,6 +38,14 @@ namespace Rokojori inputSlot.ConnectTo( slot ); } + public void AddSampledTextureSlotInput( RDGraphTextureSlotInput inputSlot, RenderingDevice.SamplerFilter filter = RenderingDevice.SamplerFilter.Linear, RenderingDevice.SamplerRepeatMode repeatMode = RenderingDevice.SamplerRepeatMode.Repeat ) + { + var slot = new CompositorEffectGraphTextureSlot( this ); + slot.UseSampler( filter, repeatMode ); + _textureSlots.Add( slot ); + inputSlot.ConnectTo( slot ); + } + } } \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs index 39ea8c3..6bbb51d 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs @@ -25,6 +25,11 @@ namespace Rokojori _connectedSlots.Add( slot ); } + public void SetDisconnected( CompositorEffectGraphTextureSlot slot ) + { + _connectedSlots.Remove( slot ); + } + public CEG_ScreenColorTexure( RDGraph graph ):base( graph ) {} @@ -37,6 +42,11 @@ namespace Rokojori { slot.SetInput( this ); } + + public void Disconnect( CompositorEffectGraphTextureSlot slot ) + { + slot.RemoveInput( this ); + } } } \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs index 178df49..84d750c 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs @@ -24,6 +24,11 @@ namespace Rokojori { _connectedSlots.Add( slot ); } + + public void SetDisconnected( CompositorEffectGraphTextureSlot slot ) + { + _connectedSlots.Remove( slot ); + } public CEG_ScreenDepthTexture( RDGraph graph ):base( graph ) {} @@ -37,6 +42,11 @@ namespace Rokojori { slot.SetInput( this ); } + + public void Disconnect( CompositorEffectGraphTextureSlot slot ) + { + slot.RemoveInput( this ); + } } } \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_BlendModeBase.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_BlendModeBase.cs index ef945c3..d9eba38 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_BlendModeBase.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_BlendModeBase.cs @@ -8,6 +8,7 @@ namespace Rokojori { public readonly CompositorEffectGraphTextureSlot top; public readonly CompositorEffectGraphTextureSlot mask; + public readonly CompositorEffectGraphTextureSlot alphaMapping; public readonly CompositorEffectGraphTextureSlot bottom; public readonly CompositorEffectGraphTextureSlot output; @@ -18,17 +19,19 @@ namespace Rokojori { top = new CompositorEffectGraphTextureSlot( this ); mask = new CompositorEffectGraphTextureSlot( this ); + alphaMapping = new CompositorEffectGraphTextureSlot( this ); bottom = new CompositorEffectGraphTextureSlot( this ); output = new CompositorEffectGraphTextureSlot( this ); - _textureSlots.AddRange( [ top, mask, bottom, output ] ); + _textureSlots.AddRange( [ top, mask, alphaMapping, bottom, output ] ); } - public void SetTextureSlotInputs( RDGraphTextureSlotInput topSlot, RDGraphTextureSlotInput maskSlot, RDGraphTextureSlotInput bottomSlot, RDGraphTextureSlotInput outputSlot ) + public void SetTextureSlotInputs( RDGraphTextureSlotInput topSlot, RDGraphTextureSlotInput maskSlot, RDGraphTextureSlotInput alphaSlot, RDGraphTextureSlotInput bottomSlot, RDGraphTextureSlotInput outputSlot ) { topSlot.ConnectTo( top ); maskSlot.ConnectTo( mask ); + alphaSlot.ConnectTo( alphaMapping ); bottomSlot.ConnectTo( bottom ); outputSlot.ConnectTo( output ); } diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_ImageTexture.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_ImageTexture.cs index 8919fc3..a435e9b 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_ImageTexture.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/RG_ImageTexture.cs @@ -25,6 +25,11 @@ namespace Rokojori _connectedSlots.Add( slot ); } + public void SetDisconnected( CompositorEffectGraphTextureSlot slot ) + { + _connectedSlots.Remove( slot ); + } + public RG_ImageTexture( RDGraph graph):base( graph ) { @@ -60,5 +65,9 @@ namespace Rokojori slot.SetInput( this ); } + public void Disconnect( CompositorEffectGraphTextureSlot slot ) + { + slot.RemoveInput( this ); + } } } \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ChromaticBloom/ChromaticBloom.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ChromaticBloom/ChromaticBloom.glsl index ec230b5..6cb01b4 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ChromaticBloom/ChromaticBloom.glsl +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ChromaticBloom/ChromaticBloom.glsl @@ -1,6 +1,8 @@ #[compute] #version 450 +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" + float clamp01( float value ) { return clamp( value, 0.0, 1.0 ); @@ -103,7 +105,7 @@ uniform Parameters float uvOffsetX; float uvOffsetY; - float p1; + float blendMode; float p2; } parameters; @@ -168,6 +170,15 @@ float rgb2luma( vec3 rgb ) return sqrt( dot( rgb, vec3( 0.299, 0.587, 0.114 ) ) ); } +vec4 compositeHDR_glow( vec4 originalColor, vec4 light, float blendAmount ) +{ + vec3 additiveColor = compositeHDR_add( originalColor.rgb, light.rgb ); + vec3 colorBlendColor = compositeHDR_color( originalColor.rgb, light.rgb, 1.0, 5.0 ); + + vec4 resultColor = vec4( mix( additiveColor, colorBlendColor, blendAmount ), originalColor.a ); + + return resultColor; +} void main() { @@ -209,8 +220,10 @@ void main() // vec4 blendedColor = originalColor; // blendedColor.rgb += color.rgb * lumaTint * lumaScale * parameters.amount; - vec4 blendedColor = originalColor; - blendedColor.rgb += color.rgb * parameters.amount; + // vec4 blendedColor = originalColor; + // blendedColor.rgb += color.rgb * parameters.amount; - imageStore( outputImage, xy, blendedColor ); + vec4 resultColor = compositeHDR_glow( originalColor, color * parameters.amount, parameters.blendMode ); + + imageStore( outputImage, xy, resultColor ); } diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlow.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlow.glsl index c49c13d..288a70c 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlow.glsl +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlow.glsl @@ -72,7 +72,7 @@ void main() vec2 uv = ( vec2( xy ) + vec2( 0.5 ) ) / vec2( size ); - vec4 color = texture( inputImage, uv ); + vec4 color = textureLod( inputImage, uv, 0 ); vec3 lumaWeight = vec3( parameters.lumaWeightR, parameters.lumaWeightG, parameters.lumaWeightB ); float luma = pow( dot( lumaWeight, color.rgb ), parameters.lumaPower ); diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl new file mode 100644 index 0000000..f8f81d0 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl @@ -0,0 +1,90 @@ +#[compute] +#version 450 + +float clamp01( float value ) +{ + return clamp( value, 0.0, 1.0 ); +} + +float normalizeToRange( float value, float min, float max ) +{ + return ( value - min ) / ( max - min ); +} + +float normalizeToRange01( float value, float min, float max ) +{ + return clamp01( normalizeToRange( value, min, max ) ); +} + +float map( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) ); +} + +float mapClamped( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) ); +} + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + +layout( rgba16, set = 0, binding = 0 ) +uniform image2D inputImage; + +layout( rgba16, set = 1, binding = 0 ) +uniform restrict writeonly image2D outputImage; + +layout( push_constant, std430 ) +uniform Parameters +{ + float lumaWeightR; + float lumaWeightG; + float lumaWeightB; + float lumaPower; + + float inputRangeMin; + float inputRangeMax; + float normalizationPower; + float outputRangeMin; + + float outputRangeMax; + float desaturation; + float tintR; + float tintG; + + float tintB; + float sizeX; + float sizeY; + float p2; + +} parameters; + +void main() +{ + ivec2 size = ivec2( int( parameters.sizeX ), int( parameters.sizeY ) ); + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + + vec4 color = imageLoad( inputImage, xy ); + + vec3 lumaWeight = vec3( parameters.lumaWeightR, parameters.lumaWeightG, parameters.lumaWeightB ); + float luma = pow( dot( lumaWeight, color.rgb ), parameters.lumaPower ); + + luma = normalizeToRange01( luma, parameters.inputRangeMin, parameters.inputRangeMax ); + luma = pow( luma, parameters.normalizationPower ); + luma = mix( parameters.outputRangeMin, parameters.outputRangeMax, luma ); + + color.rgb = mix( color.rgb, vec3( dot( color.rgb, vec3( 1.0/3.0 ) ) ), parameters.desaturation ); + + // color.rgb = length( color.rgb ) > 0.0 ? normalize( color.rgb ) : color.rgb; + color.rgb = color.rgb * luma * vec3( parameters.tintR, parameters.tintG, parameters.tintB ); + + imageStore( outputImage, xy, color ); + + // imageStore( outputImage, xy, vec4( vec2( xy ) / vec2( size ), 0.0, 1.0 ) ); +} diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl.import new file mode 100644 index 0000000..fe30296 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://q45r6aah2nux" +path="res://.godot/imported/ExtractGlowPartial.glsl-d188ba9e96795b50c9c0b33ad335741b.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl" +dest_files=["res://.godot/imported/ExtractGlowPartial.glsl-d188ba9e96795b50c9c0b33ad335741b.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/RG_ExtractGlowPartial.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/RG_ExtractGlowPartial.cs new file mode 100644 index 0000000..dcf4d59 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/RG_ExtractGlowPartial.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_ExtractGlowPartial:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Glow/ExtractGlow/ExtractGlowPartial.glsl" ); + + public RG_ExtractGlowPartial( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/RG_ExtractGlowPartial.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/RG_ExtractGlowPartial.cs.uid new file mode 100644 index 0000000..19e60f1 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlow/RG_ExtractGlowPartial.cs.uid @@ -0,0 +1 @@ +uid://dicy70qrq7foh diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl new file mode 100644 index 0000000..ff79bed --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl @@ -0,0 +1,328 @@ +#[compute] +#version 450 + +float clamp01( float value ) +{ + return clamp( value, 0.0, 1.0 ); +} + +float normalizeToRange( float value, float min, float max ) +{ + return ( value - min ) / ( max - min ); +} + +float normalizeToRange01( float value, float min, float max ) +{ + return clamp01( normalizeToRange( value, min, max ) ); +} + +float map( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) ); +} + +float mapClamped( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) ); +} + +vec3 applyMatrix( vec3 v, mat4 m ) +{ + return ( m * vec4( v, 1.0 ) ).xyz; +} + +vec3 applyMatrixWithoutTranslation( vec3 v, mat4 m ) +{ + return ( m * vec4( v, 0.0 ) ).xyz; +} + +vec3 applyMatrix( vec3 v, mat3 m ) +{ + return ( m * v ).xyz; +} + + +vec3 localToWorld( vec3 local, mat4 _MODEL_MATRIX ) +{ + return applyMatrix( local, _MODEL_MATRIX ); +} + +vec3 localToWorldDirection( vec3 local, mat4 _MODEL_MATRIX ) +{ + return applyMatrixWithoutTranslation( local, _MODEL_MATRIX ); +} + +vec3 localToView( vec3 local, mat4 _MODELVIEW_MATRIX ) +{ + return applyMatrix( local, _MODELVIEW_MATRIX ); +} + +vec3 localToViewDirection( vec3 local, mat4 _MODELVIEW_MATRIX ) +{ + return applyMatrixWithoutTranslation( local, _MODELVIEW_MATRIX ); +} + +vec3 localToViewDirection( vec3 local, mat3 _MODELVIEW_NORMAL_MATRIX ) +{ + return applyMatrix( local, _MODELVIEW_NORMAL_MATRIX ); +} + +vec3 worldToLocal( vec3 world, mat4 _MODEL_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODEL_MATRIX ); + return applyMatrix( world, inversedMatrix ); +} + +vec3 worldToLocalDirection( vec3 world, mat4 _MODEL_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODEL_MATRIX ); + return applyMatrixWithoutTranslation( world, inversedMatrix ); +} + + +vec3 worldToView( vec3 world, mat4 _VIEW_MATRIX ) +{ + return applyMatrix( world, _VIEW_MATRIX ); +} + +vec3 worldToViewDirection( vec3 worldDirection, mat4 _VIEW_MATRIX ) +{ + return applyMatrixWithoutTranslation( worldDirection, _VIEW_MATRIX ); +} + +vec3 viewToWorld( vec3 view, mat4 _INV_VIEW_MATRIX ) +{ + return applyMatrix( view, _INV_VIEW_MATRIX ); +} + +vec3 viewToWorldDirection( vec3 viewDirection, mat4 _INV_VIEW_MATRIX ) +{ + return applyMatrixWithoutTranslation( viewDirection, _INV_VIEW_MATRIX ); +} + +vec3 viewToLocal( vec3 view, mat4 _INV_VIEW_MATRIX, mat4 _MODEL_MATRIX ) +{ + vec3 world = viewToWorld( view, _INV_VIEW_MATRIX ); + return worldToLocal( world, _MODEL_MATRIX ); +} + +vec3 viewToLocal( vec3 view, mat4 _MODELVIEW_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODELVIEW_MATRIX ); + return applyMatrix( view, inversedMatrix ); +} + +vec3 viewToLocalDirection( vec3 viewDirection, mat4 _MODELVIEW_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODELVIEW_MATRIX ); + return applyMatrixWithoutTranslation( viewDirection, inversedMatrix ); +} + +vec3 viewToLocalDirection( vec3 view, mat4 _INV_VIEW_MATRIX, mat4 _MODEL_MATRIX ) +{ + vec3 world = viewToWorldDirection( view, _INV_VIEW_MATRIX ); + return worldToLocalDirection( world, _MODEL_MATRIX ); +} + +vec4 viewToClip( vec3 view, mat4 _PROJECTION_MATRIX ) +{ + vec4 clip = _PROJECTION_MATRIX * vec4( view, 1.0 ); + clip /= clip.w; + return clip; +} + +vec2 clipToScreen( vec4 clip ) +{ + return ( clip.xy / clip.w ) * 0.5 + vec2( 0.5 ); +} + +vec4 screenToClip( vec2 screen, float z ) +{ + return vec4( screen * 2.0 - 1.0, z, 1.0 ); +} + +vec4 clipToView( vec4 clip, mat4 _INV_PROJECTION_MATRIX ) +{ + vec4 view = _INV_PROJECTION_MATRIX * clip; + view /= view.w; + return view; +} + +vec4 screenToView( vec2 screen, float z, mat4 _INV_PROJECTION_MATRIX ) +{ + vec4 clip = screenToClip( screen, z ); + vec4 view = clipToView( clip, _INV_PROJECTION_MATRIX ); + + return view; +} + +vec3 screenToWorld( vec2 screen, float z, mat4 _INV_PROJECTION_MATRIX, mat4 _INV_VIEW_MATRIX ) +{ + vec4 view = screenToView( screen, z, _INV_PROJECTION_MATRIX ); + + return viewToWorld( view.xyz, _INV_VIEW_MATRIX ); +} + +vec3 screenToLocal( vec2 screen_point, float z, mat4 _PROJECTION_MATRIX, mat4 _VIEW_MATRIX, mat4 _MODEL_MATRIX ) +{ + vec4 clip = vec4( screen_point * 2.0 - 1.0, z, 1.0 ); + vec4 view4 = inverse( _PROJECTION_MATRIX ) * clip; + view4 /= view4.w; + vec3 view = view4.xyz; + mat4 m = inverse( _VIEW_MATRIX * _MODEL_MATRIX ); + return ( m * vec4( view, 1.0 ) ).xyz; +} + +vec2 viewToScreen( vec3 view, mat4 _PROJECTION_MATRIX ) +{ + vec4 clip = viewToClip( view, _PROJECTION_MATRIX ); + + return clipToScreen( clip ); +} + +vec2 localToScreen( vec3 local, mat4 _MODELVIEW_MATRIX, mat4 _PROJECTION_MATRIX ) +{ + vec3 view = localToView( local, _MODELVIEW_MATRIX ); + return viewToScreen( view, _PROJECTION_MATRIX ); +} + +vec2 worldToScreen( vec3 world, mat4 _VIEW_MATRIX, mat4 _PROJECTION_MATRIX ) +{ + vec3 view = worldToView( world, _VIEW_MATRIX ); + vec4 clip = viewToClip( view, _PROJECTION_MATRIX ); + vec2 screen = clipToScreen( clip ); + + return screen; +} + + +vec3 extractTranslation( mat4 matrix ) +{ + return vec3( matrix[ 3 ][ 0 ], matrix[ 3 ][ 1 ], matrix[ 3 ][ 2 ] ); +} + +vec3 extractScale( mat3 matrix ) +{ + mat3 m = matrix; + + float x = length( vec3( m[ 0 ][ 0 ], m[ 1 ][ 0 ], m[ 2 ][ 0 ] ) ); + float y = length( vec3( m[ 0 ][ 1 ], m[ 1 ][ 1 ], m[ 2 ][ 1 ] ) ); + float z = length( vec3( m[ 0 ][ 2 ], m[ 1 ][ 2 ], m[ 2 ][ 2 ] ) ); + + return vec3( x, y, z ); +} + +vec3 extractScale( mat4 matrix ) +{ + mat4 m = matrix; + + float x = length( vec3( m[ 0 ][ 0 ], m[ 1 ][ 0 ], m[ 2 ][ 0 ] ) ); + float y = length( vec3( m[ 0 ][ 1 ], m[ 1 ][ 1 ], m[ 2 ][ 1 ] ) ); + float z = length( vec3( m[ 0 ][ 2 ], m[ 1 ][ 2 ], m[ 2 ][ 2 ] ) ); + + return vec3( x, y, z ); +} + +mat3 extractRotationMatrix( mat4 m ) +{ + vec3 x = normalize( m[ 0 ].xyz ); + vec3 y = normalize( m[ 1 ].xyz ); + vec3 z = normalize( m[ 2 ].xyz ); + + return mat3( x, y, z ); +} + + + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + +layout( set = 0, binding = 0 ) +uniform sampler2D inputImage; + +layout( rgba16, set = 1, binding = 0 ) +uniform restrict writeonly image2D outputImage; + +layout( set = 2, binding = 0 ) +uniform sampler2D depthSampler; + + +layout( set = 3, binding = 0 ) +uniform sampler2D zAmountMapping; + +layout( push_constant, std430 ) +uniform Parameters +{ + vec4 m0; + vec4 m1; + vec4 m2; + vec4 m3; + + float inputRangeMin; + float inputRangeMax; + float normalizationPower; + float outputRangeMin; + + float outputRangeMax; + float desaturation; + float tintR; + float tintG; + + float tintB; + float zStartFadeEnd; + float zEndFadeEnd; + float p0; + +} parameters; + +float getZAmount( vec2 uv, float depth, mat4 INV_PROJ ) +{ + vec4 position = screenToView( uv, depth, INV_PROJ ); + float z = max( 0.0, -position.z ); + + if ( z < parameters.zStartFadeEnd || z > parameters.zEndFadeEnd ) + { + return 0.0; + } + + float normalizedZ = normalizeToRange01( z, parameters.zStartFadeEnd, parameters.zEndFadeEnd ); + + float sampled = textureLod( zAmountMapping, vec2( normalizedZ, 0.0 ), 0 ).r; + + return sampled; +} + +void main() +{ + ivec2 size = imageSize( outputImage ); + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + vec2 uv = ( vec2( xy ) + vec2( 0.5 ) ) / vec2( size ); + + mat4 INV_PROJ = mat4( parameters.m0, parameters.m1, parameters.m2, parameters.m3 ); + + vec4 color = texture( inputImage, uv ); + + float grey = dot( vec3( 0.33333 ), color.rgb ); + float luma = grey; + + luma = normalizeToRange01( luma, parameters.inputRangeMin, parameters.inputRangeMax ); + luma = pow( luma, parameters.normalizationPower ); + luma = mix( parameters.outputRangeMin, parameters.outputRangeMax, luma ); + + color.rgb = mix( color.rgb, vec3( grey ), parameters.desaturation ); + color.rgb = normalize( color.rgb ); + color.rgb = color.rgb * luma * vec3( parameters.tintR, parameters.tintG, parameters.tintB ); + + float depth = texture( depthSampler, uv ).r; + float zAmount = getZAmount( uv, depth, INV_PROJ ); + + color.rgb = color.rgb * zAmount; + color.a = 1.0; + + imageStore( outputImage, xy, color ); +} diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl.import new file mode 100644 index 0000000..1458af8 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://q3m3oewotnfl" +path="res://.godot/imported/ExtractGlowLine.glsl-9b7e7eaebc1b338113904140ac1a4e4a.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl" +dest_files=["res://.godot/imported/ExtractGlowLine.glsl-9b7e7eaebc1b338113904140ac1a4e4a.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/RG_ExtractGlowLine.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/RG_ExtractGlowLine.cs new file mode 100644 index 0000000..394d210 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/RG_ExtractGlowLine.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_ExtractGlowLine:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Glow/ExtractGlowLine/ExtractGlowLine.glsl" ); + + public RG_ExtractGlowLine( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/RG_ExtractGlowLine.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/RG_ExtractGlowLine.cs.uid new file mode 100644 index 0000000..aa5a5ab --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/ExtractGlowLine/RG_ExtractGlowLine.cs.uid @@ -0,0 +1 @@ +uid://cbyyo01qqowuv diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl new file mode 100644 index 0000000..c0fe8d6 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl @@ -0,0 +1,302 @@ +#[compute] +#version 450 + +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" + +float clamp01( float value ) +{ + return clamp( value, 0.0, 1.0 ); +} + +float normalizeToRange( float value, float min, float max ) +{ + return ( value - min ) / ( max - min ); +} + +float normalizeToRange01( float value, float min, float max ) +{ + return clamp01( normalizeToRange( value, min, max ) ); +} + +float map( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) ); +} + +float mapClamped( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) ); +} + +float random( vec2 uv ) +{ + return fract( sin( dot( uv.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453123 ); +} + +vec2 random_v2( vec2 uv ) +{ + uv = vec2 + ( + dot(uv, vec2( 127.1,311.7 ) ), + dot(uv, vec2( 269.5,183.3 ) ) + ); + + return -1.0 + 2.0 * fract( sin( uv ) * 43758.5453123 ); +} + + +vec3 random_v3( vec3 uvw ) +{ + + uvw = vec3( dot(uvw, vec3(127.1,311.7, 513.7) ), + dot(uvw, vec3(269.5,183.3, 396.5) ), + dot(uvw, vec3(421.3,314.1, 119.7) ) ); + + return -1.0 + 2.0 * fract(sin(uvw) * 43758.5453123); +} + +float perlin(vec2 uv) +{ + vec2 uv_index = floor(uv); + vec2 uv_fract = fract(uv); + + vec2 blur = smoothstep(0.0, 1.0, uv_fract); + + return mix( mix( dot( random_v2(uv_index + vec2(0.0,0.0) ), uv_fract - vec2(0.0,0.0) ), + dot( random_v2(uv_index + vec2(1.0,0.0) ), uv_fract - vec2(1.0,0.0) ), blur.x), + mix( dot( random_v2(uv_index + vec2(0.0,1.0) ), uv_fract - vec2(0.0,1.0) ), + dot( random_v2(uv_index + vec2(1.0,1.0) ), uv_fract - vec2(1.0,1.0) ), blur.x), blur.y) + 0.5; +} + +float mirrorValue( float x ) +{ + float t = mod( x, 2.0 ); + return ( t <= 1.0 ) ? t : 2.0 - t; +} + +vec2 mirrorUV( vec2 uv ) +{ + return vec2( mirrorValue( uv.x ), mirrorValue( uv.y ) ); +} + + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout( set = 0, binding = 0 ) +uniform sampler2D inputImage; + +layout( rgba16f, set = 1, binding = 0 ) +uniform image2D outputImage; + +layout( set = 2, binding = 0 ) +uniform sampler2D fadingSampler; + +layout( set = 3, binding = 0 ) +uniform sampler2D radialNoise; + +layout( push_constant, std430 ) +uniform Parameters +{ + float amount; + float redScale; + float greenScale; + float blueScale; + + float steps; + float smear; + float distortionAmount; + float distortionAngle; + + float uvOffsetX; + float uvOffsetY; + float uvScaleX; + float uvScaleY; + + float uvRotation; + float uvPivotX; + float uvPivotY; + float kernelRadius; + + float kernelOffset; + float ellipseAmount; + float ellipseSizeX; + float ellipseSizeY; + + float ellipseMinDistance; + float ellipseKeepRatio; + float ellipseToDistortion; + float radialNoiseWrapping; + + float blendMode; + float p1; + float p2; + float p3; + +} parameters; + +vec4 sampleChromatic( vec2 uv, vec2 dir, ivec2 size, int steps, vec3 shifts, float smear ) +{ + vec4 combinedColor = vec4( 0.0 ); + + float weights = 0.0; + + for ( int i = -steps; i <= steps; i++ ) + { + float t = float( i ) / float( steps ); + float w = 1.0 - abs( t ); + vec2 stepDir = dir * pow( smear, t ); + + vec2 rUV = uv + stepDir * shifts.r; + rUV = mirrorUV( rUV ); + + vec2 gUV = uv + stepDir * shifts.g; + gUV = mirrorUV( gUV ); + + vec2 bUV = uv + stepDir * shifts.b; + bUV = mirrorUV( bUV ); + + vec4 colorR = textureLod( inputImage, rUV, 0 ); + vec4 colorG = textureLod( inputImage, gUV, 0 ); + vec4 colorB = textureLod( inputImage, bUV, 0 ); + + combinedColor.r += colorR.r * w; + combinedColor.g += colorG.g * w; + combinedColor.b += colorB.b * w; + combinedColor.a += colorG.a * w; + + weights += w; + } + + combinedColor /= weights; + + return combinedColor; +} + + + +vec2 rotate( vec2 uv, float angle ) +{ + float s = sin( angle ); + float c = cos( angle ); + + + float x = uv.x; + float y = uv.y; + + uv.x = c * x - s * y; + uv.y = s * x + c * y; + + return uv; +} + +float rgb2luma( vec3 rgb ) +{ + return sqrt( dot( rgb, vec3( 0.299, 0.587, 0.114 ) ) ); +} + +vec4 compositeHDR_glow( vec4 originalColor, vec4 light, float blendAmount ) +{ + vec3 additiveColor = compositeHDR_add( originalColor.rgb, light.rgb ); + vec3 colorBlendColor = compositeHDR_color( originalColor.rgb, light.rgb, 1.0, 5.0 ); + + vec4 resultColor = vec4( mix( additiveColor, colorBlendColor, blendAmount ), originalColor.a ); + + return resultColor; +} + +void main() +{ + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + ivec2 size = imageSize( outputImage ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + vec2 uv = ( vec2( xy ) + 0.5 ) / vec2( size ); + + float fading = textureLod( fadingSampler, uv, 0 ).r; + + vec2 centeredUV = uv - vec2( 0.5 ); + float radialU = (atan(centeredUV.y, centeredUV.x ) + 3.14159265359) / 6.28318530718; + float radialNoiseFading = textureLod( radialNoise, vec2( radialU ) * parameters.radialNoiseWrapping , 0 ).r; + fading *= radialNoiseFading; + + vec2 ringCenter = vec2( 0.5 ); + vec2 ringSize = vec2( parameters.ellipseSizeX, parameters.ellipseSizeY ); + + + float aspect = float( size.x ) / float( size.y ); + + ringSize.y *= mix( 1.0, aspect, parameters.ellipseKeepRatio ); + + + vec2 dir = ringCenter - uv; + + vec2 scaledDir = dir; + scaledDir.x /= ringSize.x; + scaledDir.y /= ringSize.y; + + float dist = length( scaledDir ); + float amount = 1.0 - clamp( dist - parameters.ellipseMinDistance, 0.0, 1.0 ); + + + uv += normalize( dir ) * amount * parameters.ellipseAmount; + + vec2 pivot = vec2( parameters.uvPivotX, parameters.uvPivotY ); + uv -= pivot; + uv *= vec2( parameters.uvScaleX, parameters.uvScaleY ); + uv = rotate( uv, parameters.uvRotation ); + uv += pivot; + + vec3 distortion = vec3( parameters.redScale, parameters.greenScale, parameters.blueScale ) * parameters.distortionAmount; + + int stepsI = min( 32, int( parameters.steps ) ); + + vec4 originalColor = imageLoad( outputImage, xy ); + + float angle = parameters.distortionAngle; + vec2 ratio = vec2( 1.0, float( size.y ) / float( size.x ) ); + + vec2 uvDir = mix( vec2( 1.0, 0.0 ), normalize( dir ), parameters.ellipseToDistortion ) ; + + uvDir = rotate( uvDir, angle ); + + vec2 uvOffset = vec2( parameters.uvOffsetX, parameters.uvOffsetY ); + + uvOffset += -uvDir * parameters.distortionAmount * parameters.smear; + + vec4 light = vec4( 0.0, 0.0, 0.0, 1.0 ); + + int radius = min( 5, int( parameters.kernelRadius ) ); + + if ( radius <= 0 ) + { + light = sampleChromatic( uv + uvOffset, uvDir, size, stepsI, distortion, parameters.smear ); + } + else + { + vec2 offsetScale = ( vec2( 1.0 ) / vec2( size.x, size.x ) ) * parameters.kernelOffset; + + for ( int x = -radius; x <= radius; x ++ ) + { + for ( int y = -radius; y <= radius; y ++ ) + { + vec2 offset = vec2( x, y ) * offsetScale; + light += sampleChromatic( uv + uvOffset + offset, uvDir, size, stepsI, distortion, parameters.smear ); + } + } + + light /= float( ( radius * 2 + 1 ) * ( radius * 2 + 1 ) ); + + } + + light.a = 1.0; + + light.rgb = max( light.rgb, vec3( 0.0 ) ); + + vec4 resultColor = compositeHDR_glow( originalColor, light * fading * parameters.amount, parameters.blendMode ); + + imageStore( outputImage, xy, resultColor ); +} diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl.import new file mode 100644 index 0000000..ee59b12 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://ddgpd64fugq56" +path="res://.godot/imported/GhostBloom.glsl-f65d457f0ba946107259338123346caa.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl" +dest_files=["res://.godot/imported/GhostBloom.glsl-f65d457f0ba946107259338123346caa.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/RG_GhostBloom.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/RG_GhostBloom.cs new file mode 100644 index 0000000..76b2f38 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/RG_GhostBloom.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_GhostBloom:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Glow/GhostBloom/GhostBloom.glsl" ); + + public RG_GhostBloom( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/RG_GhostBloom.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/RG_GhostBloom.cs.uid new file mode 100644 index 0000000..3eef6b2 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/GhostBloom/RG_GhostBloom.cs.uid @@ -0,0 +1 @@ +uid://b18elr2q1rlfn diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl new file mode 100644 index 0000000..c49c13d --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl @@ -0,0 +1,90 @@ +#[compute] +#version 450 + +float clamp01( float value ) +{ + return clamp( value, 0.0, 1.0 ); +} + +float normalizeToRange( float value, float min, float max ) +{ + return ( value - min ) / ( max - min ); +} + +float normalizeToRange01( float value, float min, float max ) +{ + return clamp01( normalizeToRange( value, min, max ) ); +} + +float map( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) ); +} + +float mapClamped( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) ); +} + +layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in; + +layout( set = 0, binding = 0 ) +uniform sampler2D inputImage; + +layout( rgba16, set = 1, binding = 0 ) +uniform restrict writeonly image2D outputImage; + +layout( push_constant, std430 ) +uniform Parameters +{ + float lumaWeightR; + float lumaWeightG; + float lumaWeightB; + float lumaPower; + + float inputRangeMin; + float inputRangeMax; + float normalizationPower; + float outputRangeMin; + + float outputRangeMax; + float desaturation; + float tintR; + float tintG; + + float tintB; + float p0; + float p1; + float p2; + +} parameters; + +void main() +{ + ivec2 size = imageSize( outputImage ); + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + vec2 uv = ( vec2( xy ) + vec2( 0.5 ) ) / vec2( size ); + + + vec4 color = texture( inputImage, uv ); + + vec3 lumaWeight = vec3( parameters.lumaWeightR, parameters.lumaWeightG, parameters.lumaWeightB ); + float luma = pow( dot( lumaWeight, color.rgb ), parameters.lumaPower ); + + luma = normalizeToRange01( luma, parameters.inputRangeMin, parameters.inputRangeMax ); + luma = pow( luma, parameters.normalizationPower ); + luma = mix( parameters.outputRangeMin, parameters.outputRangeMax, luma ); + + color.rgb = mix( color.rgb, vec3( dot( color.rgb, vec3( 1.0/3.0 ) ) ), parameters.desaturation ); + + color.rgb = normalize( color.rgb ); + color.rgb = color.rgb * luma * vec3( parameters.tintR, parameters.tintG, parameters.tintB ); + + imageStore( outputImage, xy, color ); +} diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl.import new file mode 100644 index 0000000..3baec2a --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://d04q5quo2gbf2" +path="res://.godot/imported/ApplyLuma.glsl-4075e89073e8fc26f20fae441b41aa69.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl" +dest_files=["res://.godot/imported/ApplyLuma.glsl-4075e89073e8fc26f20fae441b41aa69.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl new file mode 100644 index 0000000..c0c3fb4 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl @@ -0,0 +1,248 @@ +#[compute] +#version 450 + +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" + +float clamp01( float value ) +{ + return clamp( value, 0.0, 1.0 ); +} + +float normalizeToRange( float value, float min, float max ) +{ + return ( value - min ) / ( max - min ); +} + +float normalizeToRange01( float value, float min, float max ) +{ + return clamp01( normalizeToRange( value, min, max ) ); +} + +float map( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) ); +} + +float mapClamped( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) ); +} + +float random( vec2 uv ) +{ + return fract( sin( dot( uv.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453123 ); +} + +vec2 random_v2( vec2 uv ) +{ + uv = vec2 + ( + dot(uv, vec2( 127.1,311.7 ) ), + dot(uv, vec2( 269.5,183.3 ) ) + ); + + return -1.0 + 2.0 * fract( sin( uv ) * 43758.5453123 ); +} + + +vec3 random_v3( vec3 uvw ) +{ + + uvw = vec3( dot(uvw, vec3(127.1,311.7, 513.7) ), + dot(uvw, vec3(269.5,183.3, 396.5) ), + dot(uvw, vec3(421.3,314.1, 119.7) ) ); + + return -1.0 + 2.0 * fract(sin(uvw) * 43758.5453123); +} + +float perlin(vec2 uv) +{ + vec2 uv_index = floor(uv); + vec2 uv_fract = fract(uv); + + vec2 blur = smoothstep(0.0, 1.0, uv_fract); + + return mix( mix( dot( random_v2(uv_index + vec2(0.0,0.0) ), uv_fract - vec2(0.0,0.0) ), + dot( random_v2(uv_index + vec2(1.0,0.0) ), uv_fract - vec2(1.0,0.0) ), blur.x), + mix( dot( random_v2(uv_index + vec2(0.0,1.0) ), uv_fract - vec2(0.0,1.0) ), + dot( random_v2(uv_index + vec2(1.0,1.0) ), uv_fract - vec2(1.0,1.0) ), blur.x), blur.y) + 0.5; +} + +float mirrorValue( float x ) +{ + float t = mod( x, 2.0 ); + return ( t <= 1.0 ) ? t : 2.0 - t; +} + +vec2 mirrorUV( vec2 uv ) +{ + return vec2( mirrorValue( uv.x ), mirrorValue( uv.y ) ); +} + + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout( set = 0, binding = 0 ) +uniform sampler2D inputImage; + +layout( rgba16f, set = 1, binding = 0 ) +uniform image2D outputImage; + +layout( set = 2, binding = 0 ) +uniform sampler2D fadingSampler; + +layout( set = 3, binding = 0 ) +uniform sampler2D tintSampler; + +layout( push_constant, std430 ) +uniform Parameters +{ + float amount; + float redScale; + float greenScale; + float blueScale; + + float steps; + float smear; + float distortionAmount; + float blendMode; + + float direction; + float offset; + float tintTX; + float tintTY; + + float tintSX; + float tintSY; + float p0; + float p1; + +} parameters; + +vec4 sampleChromatic( vec2 uv, vec2 dir, ivec2 size, int steps, vec3 shifts, float smear ) +{ + vec4 combinedColor = vec4( 0.0 ); + + float weights = 0.0; + + for ( int i = -steps; i <= steps; i++ ) + { + float t = float( i ) / float( steps ); + float w = 1.0 - abs( t ); + vec2 stepDir = dir * pow( smear, t ); + + vec2 rUV = uv + stepDir * shifts.r; + rUV = mirrorUV( rUV ); + + vec2 gUV = uv + stepDir * shifts.g; + gUV = mirrorUV( gUV ); + + vec2 bUV = uv + stepDir * shifts.b; + bUV = mirrorUV( bUV ); + + vec4 colorR = textureLod( inputImage, rUV, 0 ); + vec4 colorG = textureLod( inputImage, gUV, 0 ); + vec4 colorB = textureLod( inputImage, bUV, 0 ); + + combinedColor.r += colorR.r * w; + combinedColor.g += colorG.g * w; + combinedColor.b += colorB.b * w; + combinedColor.a += colorG.a * w; + + weights += w; + } + + combinedColor /= weights; + + return combinedColor; +} + + + +vec2 rotate( vec2 uv, float angle ) +{ + float s = sin( angle ); + float c = cos( angle ); + + + float x = uv.x; + float y = uv.y; + + uv.x = c * x - s * y; + uv.y = s * x + c * y; + + return uv; +} + +float rgb2luma( vec3 rgb ) +{ + return sqrt( dot( rgb, vec3( 0.299, 0.587, 0.114 ) ) ); +} + +vec4 compositeHDR_glow( vec4 originalColor, vec4 light, float blendAmount ) +{ + vec3 additiveColor = compositeHDR_add( originalColor.rgb, light.rgb ); + vec3 colorBlendColor = compositeHDR_color( originalColor.rgb, light.rgb, 1.0, 5.0 ); + + vec4 resultColor = vec4( mix( additiveColor, colorBlendColor, blendAmount ), originalColor.a ); + + return resultColor; +} + +void main() +{ + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + ivec2 size = imageSize( outputImage ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + + bool isX = parameters.direction < 0.5; + + vec2 uv = ( vec2( xy ) + 0.5 ) / vec2( size ); + + float fading = textureLod( fadingSampler, uv, 0 ).r; + + vec2 tintUV = uv * vec2( parameters.tintSX, parameters.tintSY ) + vec2( parameters.tintTX, parameters.tintTY ); + + vec4 tint = textureLod( tintSampler, tintUV, 0 ); + + if ( isX ) + { + uv.y = 0.5 / size.y; + } + else + { + uv.x = 0.5 / size.x; + } + + + vec3 distortion = vec3( parameters.redScale, parameters.greenScale, parameters.blueScale ) * parameters.distortionAmount; + + int stepsI = min( 32, int( parameters.steps ) ); + + vec4 originalColor = imageLoad( outputImage, xy ); + + + vec2 ratio = vec2( 1.0, float( size.y ) / float( size.x ) ); + + vec2 uvDir = isX ? vec2( 1.0, 0.0 ) : vec2( 0.0, 1.0 ) ; + + + + vec2 uvOffset = -uvDir * parameters.distortionAmount * parameters.smear; + + vec4 color = sampleChromatic( uv + uvOffset - uvDir * parameters.offset, uvDir, size, stepsI, distortion, parameters.smear ); + + float colorAmount = parameters.amount; + colorAmount *= fading; + + vec4 resultColor = compositeHDR_glow( originalColor, color * colorAmount * tint, parameters.blendMode ); + + // resultColor = + // resultColor = vec4( parameters.blendMode, parameters.amount, 1.0, 1.0 ); + imageStore( outputImage, xy, resultColor ); +} diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl.import new file mode 100644 index 0000000..35f17b6 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://dh3efarv10o6i" +path="res://.godot/imported/MaxBloom.glsl-f0d30cab654576acc66b1fa3527aa86b.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl" +dest_files=["res://.godot/imported/MaxBloom.glsl-f0d30cab654576acc66b1fa3527aa86b.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_ApplyLuma.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_ApplyLuma.cs new file mode 100644 index 0000000..ee495ec --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_ApplyLuma.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_ApplyLuma:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Glow/MaxBloom/ApplyLuma.glsl" ); + + public RG_ApplyLuma( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_ApplyLuma.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_ApplyLuma.cs.uid new file mode 100644 index 0000000..b42ce55 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_ApplyLuma.cs.uid @@ -0,0 +1 @@ +uid://ddno4x3h4qw45 diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_MaxBloom.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_MaxBloom.cs new file mode 100644 index 0000000..8d0e0e3 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_MaxBloom.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_MaxBloom:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Glow/MaxBloom/MaxBloom.glsl" ); + + public RG_MaxBloom( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_MaxBloom.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_MaxBloom.cs.uid new file mode 100644 index 0000000..4253a6c --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/MaxBloom/RG_MaxBloom.cs.uid @@ -0,0 +1 @@ +uid://cqjgnkndjs5ky diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RG_RingBloom.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RG_RingBloom.cs new file mode 100644 index 0000000..2c0093f --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RG_RingBloom.cs @@ -0,0 +1,17 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RG_RingBloom:CEG_ImageProcessor + { + public static readonly string shaderPath = + RDGraph.Path( "Nodes/Processors/Glow/RingBloom/RingBloom.glsl" ); + + public RG_RingBloom( RDGraph graph ):base( graph, shaderPath ) + {} + + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RG_RingBloom.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RG_RingBloom.cs.uid new file mode 100644 index 0000000..35f8ae7 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RG_RingBloom.cs.uid @@ -0,0 +1 @@ +uid://cu2trxvwwk23u diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RingBloom.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RingBloom.glsl new file mode 100644 index 0000000..d4b6041 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RingBloom.glsl @@ -0,0 +1,436 @@ +#[compute] +#version 450 + +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" + +float clamp01( float value ) +{ + return clamp( value, 0.0, 1.0 ); +} + +float normalizeToRange( float value, float min, float max ) +{ + return ( value - min ) / ( max - min ); +} + +float normalizeToRange01( float value, float min, float max ) +{ + return clamp01( normalizeToRange( value, min, max ) ); +} + +float map( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) ); +} + +float mapClamped( float value, float inMin, float inMax, float outMin, float outMax ) +{ + return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) ); +} + +float random( vec2 uv ) +{ + return fract( sin( dot( uv.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453123 ); +} + +vec2 random_v2( vec2 uv ) +{ + uv = vec2 + ( + dot(uv, vec2( 127.1,311.7 ) ), + dot(uv, vec2( 269.5,183.3 ) ) + ); + + return -1.0 + 2.0 * fract( sin( uv ) * 43758.5453123 ); +} + + +vec3 random_v3( vec3 uvw ) +{ + + uvw = vec3( dot(uvw, vec3(127.1,311.7, 513.7) ), + dot(uvw, vec3(269.5,183.3, 396.5) ), + dot(uvw, vec3(421.3,314.1, 119.7) ) ); + + return -1.0 + 2.0 * fract(sin(uvw) * 43758.5453123); +} + +float perlin(vec2 uv) +{ + vec2 uv_index = floor(uv); + vec2 uv_fract = fract(uv); + + vec2 blur = smoothstep(0.0, 1.0, uv_fract); + + return mix( mix( dot( random_v2(uv_index + vec2(0.0,0.0) ), uv_fract - vec2(0.0,0.0) ), + dot( random_v2(uv_index + vec2(1.0,0.0) ), uv_fract - vec2(1.0,0.0) ), blur.x), + mix( dot( random_v2(uv_index + vec2(0.0,1.0) ), uv_fract - vec2(0.0,1.0) ), + dot( random_v2(uv_index + vec2(1.0,1.0) ), uv_fract - vec2(1.0,1.0) ), blur.x), blur.y) + 0.5; +} + +float mirrorValue( float x ) +{ + float t = mod( x, 2.0 ); + return ( t <= 1.0 ) ? t : 2.0 - t; +} + +vec2 mirrorUV( vec2 uv ) +{ + return vec2( mirrorValue( uv.x ), mirrorValue( uv.y ) ); +} + +vec3 applyMatrix( vec3 v, mat4 m ) +{ + return ( m * vec4( v, 1.0 ) ).xyz; +} + +vec3 applyMatrixWithoutTranslation( vec3 v, mat4 m ) +{ + return ( m * vec4( v, 0.0 ) ).xyz; +} + +vec3 applyMatrix( vec3 v, mat3 m ) +{ + return ( m * v ).xyz; +} + + +vec3 localToWorld( vec3 local, mat4 _MODEL_MATRIX ) +{ + return applyMatrix( local, _MODEL_MATRIX ); +} + +vec3 localToWorldDirection( vec3 local, mat4 _MODEL_MATRIX ) +{ + return applyMatrixWithoutTranslation( local, _MODEL_MATRIX ); +} + +vec3 localToView( vec3 local, mat4 _MODELVIEW_MATRIX ) +{ + return applyMatrix( local, _MODELVIEW_MATRIX ); +} + +vec3 localToViewDirection( vec3 local, mat4 _MODELVIEW_MATRIX ) +{ + return applyMatrixWithoutTranslation( local, _MODELVIEW_MATRIX ); +} + +vec3 localToViewDirection( vec3 local, mat3 _MODELVIEW_NORMAL_MATRIX ) +{ + return applyMatrix( local, _MODELVIEW_NORMAL_MATRIX ); +} + +vec3 worldToLocal( vec3 world, mat4 _MODEL_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODEL_MATRIX ); + return applyMatrix( world, inversedMatrix ); +} + +vec3 worldToLocalDirection( vec3 world, mat4 _MODEL_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODEL_MATRIX ); + return applyMatrixWithoutTranslation( world, inversedMatrix ); +} + + +vec3 worldToView( vec3 world, mat4 _VIEW_MATRIX ) +{ + return applyMatrix( world, _VIEW_MATRIX ); +} + +vec3 worldToViewDirection( vec3 worldDirection, mat4 _VIEW_MATRIX ) +{ + return applyMatrixWithoutTranslation( worldDirection, _VIEW_MATRIX ); +} + +vec3 viewToWorld( vec3 view, mat4 _INV_VIEW_MATRIX ) +{ + return applyMatrix( view, _INV_VIEW_MATRIX ); +} + +vec3 viewToWorldDirection( vec3 viewDirection, mat4 _INV_VIEW_MATRIX ) +{ + return applyMatrixWithoutTranslation( viewDirection, _INV_VIEW_MATRIX ); +} + +vec3 viewToLocal( vec3 view, mat4 _INV_VIEW_MATRIX, mat4 _MODEL_MATRIX ) +{ + vec3 world = viewToWorld( view, _INV_VIEW_MATRIX ); + return worldToLocal( world, _MODEL_MATRIX ); +} + +vec3 viewToLocal( vec3 view, mat4 _MODELVIEW_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODELVIEW_MATRIX ); + return applyMatrix( view, inversedMatrix ); +} + +vec3 viewToLocalDirection( vec3 viewDirection, mat4 _MODELVIEW_MATRIX ) +{ + mat4 inversedMatrix = inverse( _MODELVIEW_MATRIX ); + return applyMatrixWithoutTranslation( viewDirection, inversedMatrix ); +} + +vec3 viewToLocalDirection( vec3 view, mat4 _INV_VIEW_MATRIX, mat4 _MODEL_MATRIX ) +{ + vec3 world = viewToWorldDirection( view, _INV_VIEW_MATRIX ); + return worldToLocalDirection( world, _MODEL_MATRIX ); +} + +vec4 viewToClip( vec3 view, mat4 _PROJECTION_MATRIX ) +{ + vec4 clip = _PROJECTION_MATRIX * vec4( view, 1.0 ); + clip /= clip.w; + return clip; +} + +vec2 clipToScreen( vec4 clip ) +{ + return ( clip.xy / clip.w ) * 0.5 + vec2( 0.5 ); +} + +vec4 screenToClip( vec2 screen, float z ) +{ + return vec4( screen * 2.0 - 1.0, z, 1.0 ); +} + +vec4 clipToView( vec4 clip, mat4 _INV_PROJECTION_MATRIX ) +{ + vec4 view = _INV_PROJECTION_MATRIX * clip; + view /= view.w; + return view; +} + +vec4 screenToView( vec2 screen, float z, mat4 _INV_PROJECTION_MATRIX ) +{ + vec4 clip = screenToClip( screen, z ); + vec4 view = clipToView( clip, _INV_PROJECTION_MATRIX ); + + return view; +} + +vec3 screenToWorld( vec2 screen, float z, mat4 _INV_PROJECTION_MATRIX, mat4 _INV_VIEW_MATRIX ) +{ + vec4 view = screenToView( screen, z, _INV_PROJECTION_MATRIX ); + + return viewToWorld( view.xyz, _INV_VIEW_MATRIX ); +} + +vec3 screenToLocal( vec2 screen_point, float z, mat4 _PROJECTION_MATRIX, mat4 _VIEW_MATRIX, mat4 _MODEL_MATRIX ) +{ + vec4 clip = vec4( screen_point * 2.0 - 1.0, z, 1.0 ); + vec4 view4 = inverse( _PROJECTION_MATRIX ) * clip; + view4 /= view4.w; + vec3 view = view4.xyz; + mat4 m = inverse( _VIEW_MATRIX * _MODEL_MATRIX ); + return ( m * vec4( view, 1.0 ) ).xyz; +} + +vec2 viewToScreen( vec3 view, mat4 _PROJECTION_MATRIX ) +{ + vec4 clip = viewToClip( view, _PROJECTION_MATRIX ); + + return clipToScreen( clip ); +} + +vec2 localToScreen( vec3 local, mat4 _MODELVIEW_MATRIX, mat4 _PROJECTION_MATRIX ) +{ + vec3 view = localToView( local, _MODELVIEW_MATRIX ); + return viewToScreen( view, _PROJECTION_MATRIX ); +} + +vec2 worldToScreen( vec3 world, mat4 _VIEW_MATRIX, mat4 _PROJECTION_MATRIX ) +{ + vec3 view = worldToView( world, _VIEW_MATRIX ); + vec4 clip = viewToClip( view, _PROJECTION_MATRIX ); + vec2 screen = clipToScreen( clip ); + + return screen; +} + + +vec3 extractTranslation( mat4 matrix ) +{ + return vec3( matrix[ 3 ][ 0 ], matrix[ 3 ][ 1 ], matrix[ 3 ][ 2 ] ); +} + +vec3 extractScale( mat3 matrix ) +{ + mat3 m = matrix; + + float x = length( vec3( m[ 0 ][ 0 ], m[ 1 ][ 0 ], m[ 2 ][ 0 ] ) ); + float y = length( vec3( m[ 0 ][ 1 ], m[ 1 ][ 1 ], m[ 2 ][ 1 ] ) ); + float z = length( vec3( m[ 0 ][ 2 ], m[ 1 ][ 2 ], m[ 2 ][ 2 ] ) ); + + return vec3( x, y, z ); +} + +vec3 extractScale( mat4 matrix ) +{ + mat4 m = matrix; + + float x = length( vec3( m[ 0 ][ 0 ], m[ 1 ][ 0 ], m[ 2 ][ 0 ] ) ); + float y = length( vec3( m[ 0 ][ 1 ], m[ 1 ][ 1 ], m[ 2 ][ 1 ] ) ); + float z = length( vec3( m[ 0 ][ 2 ], m[ 1 ][ 2 ], m[ 2 ][ 2 ] ) ); + + return vec3( x, y, z ); +} + +mat3 extractRotationMatrix( mat4 m ) +{ + vec3 x = normalize( m[ 0 ].xyz ); + vec3 y = normalize( m[ 1 ].xyz ); + vec3 z = normalize( m[ 2 ].xyz ); + + return mat3( x, y, z ); +} + +vec4 compositeHDR_glow( vec4 originalColor, vec4 light, float blendAmount ) +{ + vec3 additiveColor = compositeHDR_add( originalColor.rgb, light.rgb ); + vec3 colorBlendColor = compositeHDR_color( originalColor.rgb, light.rgb, 1.0, 5.0 ); + + vec4 resultColor = vec4( mix( additiveColor, colorBlendColor, blendAmount ), originalColor.a ); + + return resultColor; +} + + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout( set = 0, binding = 0 ) +uniform sampler2D inputImage; + +layout( rgba16f, set = 1, binding = 0 ) +uniform image2D outputImage; + +layout( push_constant, std430 ) +uniform Parameters +{ + float amount; + float redScale; + float greenScale; + float blueScale; + + float smearSteps; + float smear; + float ringSteps; + float ringSizeX; + + float ringSizeY; + float distortionAmount; + float blendMode; + float p3; + + +} parameters; + + +vec4 sampleChromatic( vec2 uv, vec2 dir, int steps, vec3 shifts, float smear ) +{ + vec4 combinedColor = vec4( 0.0 ); + + float weights = 0.0; + + for ( int i = -steps; i <= steps; i++ ) + { + float t = float( i ) / float( steps ); + float w = 1.0 - abs( t ); + vec2 stepDir = dir * pow( smear, t ); + + vec2 rUV = uv + stepDir * shifts.r; + rUV = mirrorUV( rUV ); + + vec2 gUV = uv + stepDir * shifts.g; + gUV = mirrorUV( gUV ); + + vec2 bUV = uv + stepDir * shifts.b; + bUV = mirrorUV( bUV ); + + vec4 colorR = textureLod( inputImage, rUV, 0 ); + vec4 colorG = textureLod( inputImage, gUV, 0 ); + vec4 colorB = textureLod( inputImage, bUV, 0 ); + + combinedColor.r += colorR.r * w; + combinedColor.g += colorG.g * w; + combinedColor.b += colorB.b * w; + combinedColor.a += colorG.a * w; + + weights += w; + } + + combinedColor /= weights; + + return combinedColor; +} + + + +vec2 rotate( vec2 uv, float angle ) +{ + float s = sin( angle ); + float c = cos( angle ); + + + float x = uv.x; + float y = uv.y; + + uv.x = c * x - s * y; + uv.y = s * x + c * y; + + return uv; +} + +float rgb2luma( vec3 rgb ) +{ + return sqrt( dot( rgb, vec3( 0.299, 0.587, 0.114 ) ) ); +} + + + +void main() +{ + ivec2 xy = ivec2( gl_GlobalInvocationID.xy ); + ivec2 size = imageSize( outputImage ); + + if ( any( greaterThanEqual( xy, size ) ) ) + { + return; + } + + vec2 uv = ( vec2( xy ) + 0.5 ) / vec2( size ); + + vec3 distortion = vec3( parameters.redScale, parameters.greenScale, parameters.blueScale ) * parameters.distortionAmount; + + int stepsI = min( 32, int( parameters.smearSteps ) ); + int ringSteps = min( 32, int( parameters.ringSteps ) ); + + vec4 color = vec4( 0.0 ); + + float angleStep = 6.283185307 / float( ringSteps ); + + + float combinedZ = 0; + + float ratio = float( size.y ) / float( size.x ); + + for ( int i = 0; i < ringSteps; i++ ) + { + float angle = float( i ) * angleStep; + vec2 uvDir = vec2( cos( angle ) * ratio * parameters.ringSizeX, sin( angle ) * parameters.ringSizeY ); + vec2 uvOffset = uvDir * parameters.distortionAmount; + + vec4 chromatic = sampleChromatic( uv + uvOffset, uvDir, stepsI, distortion, parameters.smear ); + color.rgb += chromatic.rgb; + } + + color.rgb /= float( ringSteps ); + + // vec4 blendedColor = imageLoad( outputImage, xy ); + // blendedColor.rgb += color.rgb * parameters.amount; + + vec4 originalColor = imageLoad( outputImage, xy ); + vec4 blendedColor = compositeHDR_glow( originalColor, color * parameters.amount, parameters.blendMode ); + + imageStore( outputImage, xy, blendedColor ); +} diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RingBloom.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RingBloom.glsl.import new file mode 100644 index 0000000..7f01283 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RingBloom.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://cqghenq27mwsf" +path="res://.godot/imported/RingBloom.glsl-8c62ca7d623fa5f9c79101341a7f1ad7.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Glow/RingBloom/RingBloom.glsl" +dest_files=["res://.godot/imported/RingBloom.glsl-8c62ca7d623fa5f9c79101341a7f1ad7.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Logic/RG_SwapRepeat.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Logic/RG_SwapRepeat.cs index 890ec46..97c896f 100644 --- a/Runtime/Rendering/RenderGraph/Nodes/Processors/Logic/RG_SwapRepeat.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Logic/RG_SwapRepeat.cs @@ -66,6 +66,7 @@ namespace Rokojori _output.SetTexture( cachedInputTexture ); } + if ( onPreProcess != null ) { onPreProcess( i ); @@ -77,6 +78,7 @@ namespace Rokojori { onPostProcess( i ); } + } _input.SetTexture( cachedInputTexture ); diff --git a/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs b/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs index 14ff515..f32df6d 100644 --- a/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs +++ b/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs @@ -10,6 +10,9 @@ namespace Rokojori public RGGraphProcessor GetProcessor(); public void SetConnected( CompositorEffectGraphTextureSlot slot ); public void ConnectTo( CompositorEffectGraphTextureSlot slot ); + + public void SetDisconnected( CompositorEffectGraphTextureSlot slot ); + public void Disconnect( CompositorEffectGraphTextureSlot slot ); } public class CompositorEffectGraphTextureSlot:RDGraphConnection, RDGraphTextureSlotInput @@ -26,6 +29,41 @@ namespace Rokojori sampler = graph.context.Sampler( filter, repeatMode ); } + public void UseLinearSampler( RenderingDevice.SamplerRepeatMode repeatMode = RenderingDevice.SamplerRepeatMode.Repeat ) + { + sampler = graph.context.Sampler( RenderingDevice.SamplerFilter.Linear, repeatMode ); + } + + public void UseLinearSamplerEdgeClamped() + { + UseLinearSampler( RenderingDevice.SamplerRepeatMode.ClampToEdge ); + } + + public void UseLinearSamplerMirroredRepeat() + { + UseLinearSampler( RenderingDevice.SamplerRepeatMode.MirroredRepeat ); + } + + public void UseNearestSampler( RenderingDevice.SamplerRepeatMode repeatMode = RenderingDevice.SamplerRepeatMode.Repeat ) + { + sampler = graph.context.Sampler( RenderingDevice.SamplerFilter.Nearest, repeatMode ); + } + + public void UseNearestSamplerEdgeClamped() + { + UseNearestSampler( RenderingDevice.SamplerRepeatMode.ClampToEdge ); + } + + public void UseNearestSamplerMirroredRepeat() + { + UseNearestSampler( RenderingDevice.SamplerRepeatMode.MirroredRepeat ); + } + + public void UseSamplerNoRepeat( RenderingDevice.SamplerFilter filter = RenderingDevice.SamplerFilter.Linear ) + { + sampler = graph.context.Sampler( filter, RenderingDevice.SamplerRepeatMode.ClampToEdge ); + } + public RDTexture GetTexture() { return _texture; @@ -48,6 +86,11 @@ namespace Rokojori _connectedSlots.Add( slot ); } + public void SetDisconnected( CompositorEffectGraphTextureSlot slot ) + { + _connectedSlots.Remove( slot ); + } + public CompositorEffectGraphTextureSlot( RGGraphProcessor processor ):base( processor ) { @@ -55,14 +98,41 @@ namespace Rokojori public void SetInput( RDGraphTextureSlotInput input ) { + if ( input == _input ) + { + return; + } + _input = input; input.SetConnected( this ); } + public void ReplaceInput( RDGraphTextureSlotInput oldInput, RDGraphTextureSlotInput newInput ) + { + RemoveInput( oldInput ); + SetInput( newInput ); + } + + public void RemoveInput( RDGraphTextureSlotInput input ) + { + if ( input != _input ) + { + return; + } + + _input.SetDisconnected( this ); + _input = null; + } + public void ConnectTo( CompositorEffectGraphTextureSlot slot ) { slot.SetInput( this ); } + + public void Disconnect( CompositorEffectGraphTextureSlot slot ) + { + slot.RemoveInput( this ); + } } public class RG_TextureSlotEditable:CompositorEffectGraphTextureSlot diff --git a/Runtime/Shading/Library/Colors.gdshaderinc b/Runtime/Shading/Library/Colors.gdshaderinc index a046d7a..e7f9a42 100644 --- a/Runtime/Shading/Library/Colors.gdshaderinc +++ b/Runtime/Shading/Library/Colors.gdshaderinc @@ -88,6 +88,11 @@ vec3 RGBtoHSL( vec3 c ) return vec3( h, s, l ); } +vec3 RGBtoHSL( vec3 c, float scale ) +{ + return RGBtoHSL( c.rgb / scale ); +} + vec4 RGBtoHSL( vec4 c ) { return vec4( RGBtoHSL( c.rgb ), c.a ); @@ -170,6 +175,10 @@ vec4 HSLtoRGB( vec4 c, float scale ) return vec4( HSLtoRGB( c.rgb ) * scale, c.a ); } +vec3 HSLtoRGB( vec3 c, float scale ) +{ + return HSLtoRGB( c.rgb ) * scale; +} vec3 adjustHSL( vec3 color, vec3 hslAdjustment ) { @@ -450,7 +459,6 @@ vec4 blendMode_alpha( vec4 bottom, vec4 top ) vec4 result = alpha > 0.0 ? vec4( color / alpha, alpha ) : vec4( color, 0 ); - // result = clamp( result, 0, 1 ); return result; } @@ -691,6 +699,68 @@ vec4 blendMode_colorHSL( vec4 bottom, vec4 top ) return blendMode_alpha( bottom, vec4( blendFunction_colorHSL( bottom.rgb, top.rgb ), top.a ) ); } +vec3 blendFunction_colorHSLHDR( vec3 bottom, vec3 top ) +{ + float topScale = getRGBScale( top ); + float bottomScale = getRGBScale( bottom ); + + vec3 topHSL = RGBtoHSL( top.rgb, topScale ); + vec3 bottomHSL = RGBtoHSL( bottom.rgb, bottomScale ); + + if ( topHSL.y == 0.0 || topHSL.z == 0.0 ) + { + return bottom; + } + + vec3 resultHSL = vec3( topHSL.x, topHSL.y, bottomHSL.z ); + // vec3 resultRBG = clamp( HSLtoRGB( resultHSL ), 0, 1 ); + + return HSLtoRGB( resultHSL, bottomScale ); +} + +vec4 blendMode_colorHSLHDR( vec4 bottom, vec4 top ) +{ + if ( bottom.a <= 0.0 ) + { + return top; + } + + return blendMode_alpha( bottom, vec4( blendFunction_colorHSLHDR( bottom.rgb, top.rgb ), top.a ) ); +} + +float getLuminanceRec709( vec3 color ) +{ + return dot( color, vec3( 0.2126, 0.7152, 0.0722 ) ); +} + +vec3 getChromaRec709( vec3 color ) +{ + float luminance = getLuminanceRec709( color ); + + return luminance > 0.0 ? color / luminance : vec3( 1.0 / 3.0 ); +} + +vec3 blendFunction_colorHDRRec709( vec3 bottom, vec3 top ) +{ + float bottomLuminance = getLuminanceRec709( bottom ); + + vec3 topChroma = getChromaRec709( top ); + + return topChroma * bottomLuminance; +} + +vec4 blendMode_colorHDRRec709( vec4 bottom, vec4 top ) +{ + if ( bottom.a <= 0.0 ) + { + return top; + } + + return blendMode_alpha( bottom, vec4( blendFunction_colorHDRRec709( bottom.rgb, top.rgb ), top.a ) ); +} + + + vec3 blendFunction_colorHSV( vec3 bottom, vec3 top ) { vec3 topHSL = RGBtoHSV( top.rgb ); @@ -711,5 +781,27 @@ vec4 blendMode_colorHSV( vec4 bottom, vec4 top ) } return blendMode_alpha( bottom, vec4( blendFunction_colorHSV( bottom.rgb, top.rgb ), top.a ) ); - } + + + +/* + + + + +*/ + + +vec3 compositeHDR_add( vec3 bottom, vec3 top ) +{ + return bottom + top; +} + + +vec3 compositeHDR_color( vec3 bottom, vec3 top, float maxLuma, float power ) +{ + float luma = clamp( dot( top, vec3( maxLuma / 3.0 ) ), 0.0, 1.0 ); + return bottom * pow( 1.0 - luma, power ) + top; +} +