Compositor Effects Update
This commit is contained in:
parent
4bfb94540f
commit
fad61c7e9b
|
|
@ -12,6 +12,9 @@ namespace Rokojori
|
||||||
[Export]
|
[Export]
|
||||||
public GodotObject target;
|
public GodotObject target;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Node targetNode;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public string targetMemberPath;
|
public string targetMemberPath;
|
||||||
|
|
||||||
|
|
@ -24,6 +27,13 @@ namespace Rokojori
|
||||||
[Export]
|
[Export]
|
||||||
public Curve curve;
|
public Curve curve;
|
||||||
|
|
||||||
|
[ExportGroup( "Editor Testing")]
|
||||||
|
[Export]
|
||||||
|
public bool forceStartValue = false;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public float forcedStartValue = 0f;
|
||||||
|
|
||||||
public void OnAnimatorStart(){}
|
public void OnAnimatorStart(){}
|
||||||
public void OnAnimatorEnd(){}
|
public void OnAnimatorEnd(){}
|
||||||
public void OnAnimatorCancel(){}
|
public void OnAnimatorCancel(){}
|
||||||
|
|
@ -33,7 +43,7 @@ namespace Rokojori
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public float GetTargetValue( GodotObject go, string targetMember, float alternative = 0 )
|
public static float GetTargetValue( GodotObject go, string targetMember, float alternative = 0 )
|
||||||
{
|
{
|
||||||
var path = targetMember.Split( "/" );
|
var path = targetMember.Split( "/" );
|
||||||
var prop = path[ path.Length - 1 ];
|
var prop = path[ path.Length - 1 ];
|
||||||
|
|
@ -44,7 +54,7 @@ namespace Rokojori
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTargetValue( GodotObject go, string targetMember, float value )
|
public static void SetTargetValue( GodotObject go, string targetMember, float value )
|
||||||
{
|
{
|
||||||
var path = targetMember.Split( "/" );
|
var path = targetMember.Split( "/" );
|
||||||
var prop = path[ path.Length - 1 ];
|
var prop = path[ path.Length - 1 ];
|
||||||
|
|
@ -76,9 +86,20 @@ namespace Rokojori
|
||||||
|
|
||||||
_actionID = DispatchStart();
|
_actionID = DispatchStart();
|
||||||
|
|
||||||
|
var target = this.target != null ? this.target : targetNode;
|
||||||
|
|
||||||
// var startValue = ReflectionHelper.GetValue<float>( target, targetMember );
|
// var startValue = ReflectionHelper.GetValue<float>( target, targetMember );
|
||||||
var startValue = GetTargetValue( target, targetMemberPath );
|
var startValue = GetTargetValue( target, targetMemberPath );
|
||||||
|
|
||||||
|
if ( forceStartValue && Engine.IsEditorHint() )
|
||||||
|
{
|
||||||
|
startValue = forcedStartValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AnimationManager.StartAnimation( this, target, targetMemberPath );
|
AnimationManager.StartAnimation( this, target, targetMemberPath );
|
||||||
|
|
||||||
this.LogInfo( "Start Value Float Tween", HierarchyName.OfAny( target ), target.GetType().Name, targetMemberPath, ">>", startValue );
|
this.LogInfo( "Start Value Float Tween", HierarchyName.OfAny( target ), target.GetType().Name, targetMemberPath, ">>", startValue );
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class FloatDriver:Node
|
||||||
|
{
|
||||||
|
float _driverValue = 0f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1" )]
|
||||||
|
public float value
|
||||||
|
{
|
||||||
|
get => _driverValue;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_driverValue = value;
|
||||||
|
UpdateValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExportToolButton( "Update Value")]
|
||||||
|
public Callable updateValueButton => Callable.From( ()=> UpdateValue() ) ;
|
||||||
|
|
||||||
|
void UpdateValue()
|
||||||
|
{
|
||||||
|
if ( targets == null )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( int i = 0; i < targets.Length; i++ )
|
||||||
|
{
|
||||||
|
if ( targets[ i ] == null || targets[ i ].GetGodotObject( this ) == null )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
targets[ i ].Update( this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public FloatDriverTarget[] targets = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bvmdtshoesn5v
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class FloatDriverNodeTarget:FloatDriverTarget
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public NodePath nodePath;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public string targetMemberPath;
|
||||||
|
|
||||||
|
public override GodotObject GetGodotObject( FloatDriver driver )
|
||||||
|
{
|
||||||
|
return driver.GetNode( nodePath );
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetTargetMemberPath( FloatDriver driver )
|
||||||
|
{
|
||||||
|
return targetMemberPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cqgobpug8btt3
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class FloatDriverResourceTarget:FloatDriverTarget
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public Resource resource;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public string targetMemberPath;
|
||||||
|
|
||||||
|
public override GodotObject GetGodotObject( FloatDriver driver )
|
||||||
|
{
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetTargetMemberPath( FloatDriver driver )
|
||||||
|
{
|
||||||
|
return targetMemberPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dhuspbjmculan
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public abstract partial class FloatDriverTarget:Resource
|
||||||
|
{
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Curve mappingCurve;
|
||||||
|
|
||||||
|
public abstract string GetTargetMemberPath( FloatDriver driver );
|
||||||
|
|
||||||
|
public abstract GodotObject GetGodotObject( FloatDriver driver );
|
||||||
|
|
||||||
|
public void Update( FloatDriver driver )
|
||||||
|
{
|
||||||
|
var mappedValue = mappingCurve.Sample( driver.value );
|
||||||
|
var targetMemberPath = GetTargetMemberPath( driver );
|
||||||
|
TweenFloat.SetTargetValue( GetGodotObject( driver ), targetMemberPath, mappedValue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bvx5mbwb86jca
|
||||||
|
|
@ -119,7 +119,7 @@ namespace Rokojori
|
||||||
var bufferTexture = CEG_BufferTexture.From( graph, ot );
|
var bufferTexture = CEG_BufferTexture.From( graph, ot );
|
||||||
|
|
||||||
var copy = new CEG_Copy( graph );
|
var copy = new CEG_Copy( graph );
|
||||||
var blur = new RD_BoxBlur( graph );
|
var blur = new RG_BoxBlur( graph );
|
||||||
|
|
||||||
graph.InitializeNodes();
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ namespace Rokojori
|
||||||
ctx.messageLogLevel = Messages.GetLevel( MessageType.Verbose );
|
ctx.messageLogLevel = Messages.GetLevel( MessageType.Verbose );
|
||||||
|
|
||||||
this.LogInfo( "Creating program" );
|
this.LogInfo( "Creating program" );
|
||||||
ctx.SetProgramFromPath( CEG_AlphaColorDilation.shaderPath );
|
ctx.SetProgramFromPath( RG_AlphaColorDilation.shaderPath );
|
||||||
|
|
||||||
this.LogInfo( "Creating textures" );
|
this.LogInfo( "Creating textures" );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,16 @@ namespace Rokojori
|
||||||
public float intensity = 1f;
|
public float intensity = 1f;
|
||||||
|
|
||||||
[Export( PropertyHint.Range, "0,100")]
|
[Export( PropertyHint.Range, "0,100")]
|
||||||
public float noise = 0f;
|
public float noise = 2f;
|
||||||
|
|
||||||
[Export( PropertyHint.Range, "1,100")]
|
[Export( PropertyHint.Range, "1,100")]
|
||||||
public int kernelOffset = 5;
|
public int kernelOffset = 2;
|
||||||
|
|
||||||
[Export( PropertyHint.Range, "1,30")]
|
[Export( PropertyHint.Range, "1,30")]
|
||||||
public int kernelRadius = 2;
|
public int kernelRadius = 2;
|
||||||
|
|
||||||
[Export( PropertyHint.Range, "1,4")]
|
[Export( PropertyHint.Range, "1,4")]
|
||||||
public int iterations = 1;
|
public int iterations = 2;
|
||||||
|
|
||||||
|
|
||||||
CEG_ScreenColorTexure screenColorTexture;
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
|
@ -35,12 +35,12 @@ namespace Rokojori
|
||||||
|
|
||||||
CEG_Copy copy;
|
CEG_Copy copy;
|
||||||
CEG_Copy copy2;
|
CEG_Copy copy2;
|
||||||
RD_BoxBlur boxBlur;
|
RG_BoxBlur boxBlur;
|
||||||
RD_BoxBlur boxBlur1;
|
RG_BoxBlur boxBlur1;
|
||||||
RD_BoxBlur boxBlur2;
|
RG_BoxBlur boxBlur2;
|
||||||
RD_BoxBlur boxBlur3;
|
RG_BoxBlur boxBlur3;
|
||||||
|
|
||||||
List<RD_BoxBlur> _blurs;
|
List<RG_BoxBlur> _blurs;
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -49,12 +49,12 @@ namespace Rokojori
|
||||||
|
|
||||||
copy = new CEG_Copy( graph );
|
copy = new CEG_Copy( graph );
|
||||||
copy2 = new CEG_Copy( graph );
|
copy2 = new CEG_Copy( graph );
|
||||||
boxBlur = new RD_BoxBlur( graph );
|
boxBlur = new RG_BoxBlur( graph );
|
||||||
boxBlur1 = new RD_BoxBlur( graph );
|
boxBlur1 = new RG_BoxBlur( graph );
|
||||||
boxBlur2 = new RD_BoxBlur( graph );
|
boxBlur2 = new RG_BoxBlur( graph );
|
||||||
boxBlur3 = new RD_BoxBlur( graph );
|
boxBlur3 = new RG_BoxBlur( graph );
|
||||||
|
|
||||||
_blurs = new List<RD_BoxBlur>()
|
_blurs = new List<RG_BoxBlur>()
|
||||||
{
|
{
|
||||||
boxBlur, boxBlur1, boxBlur2, boxBlur3
|
boxBlur, boxBlur1, boxBlur2, boxBlur3
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ namespace Rokojori
|
||||||
{
|
{
|
||||||
[Tool]
|
[Tool]
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public abstract partial class ChromaticAberation:RDGraphCompositorEffect
|
public partial class ChromaticAberation:RDGraphCompositorEffect
|
||||||
{
|
{
|
||||||
public ChromaticAberation():base()
|
public ChromaticAberation():base()
|
||||||
{
|
{
|
||||||
|
|
@ -31,11 +31,10 @@ namespace Rokojori
|
||||||
public float shiftAll = 0.5f;
|
public float shiftAll = 0.5f;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public float unshiftCenter = 16f;
|
public float centerUnshiftPower = 1f;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public int constantsInternalSize;
|
public float centerUnshiftMinRadius = 0.1f;
|
||||||
|
|
||||||
|
|
||||||
CEG_ScreenColorTexure screenColorTexture;
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
CEG_BufferTexture bufferTexture;
|
CEG_BufferTexture bufferTexture;
|
||||||
|
|
@ -75,12 +74,14 @@ namespace Rokojori
|
||||||
rShift,
|
rShift,
|
||||||
gShift,
|
gShift,
|
||||||
bShift,
|
bShift,
|
||||||
|
Vector2.Zero, // padding
|
||||||
|
|
||||||
intensity,
|
intensity,
|
||||||
shiftAll,
|
shiftAll,
|
||||||
unshiftCenter
|
centerUnshiftPower,
|
||||||
|
centerUnshiftMinRadius // padding
|
||||||
);
|
);
|
||||||
|
|
||||||
constantsInternalSize = chromaticAberation.constants.internalSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,187 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class ColorQuantizerEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public ColorQuantizerEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExportGroup("All")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
public enum HSLConversionMode
|
||||||
|
{
|
||||||
|
Raw,
|
||||||
|
Scaled,
|
||||||
|
Clamped
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public HSLConversionMode hslConversionMode = HSLConversionMode.Scaled;
|
||||||
|
|
||||||
|
[ExportGroup("Red")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float redAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float redSteps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float redStepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float redGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float redOffset = 0;
|
||||||
|
|
||||||
|
[ExportGroup("Green")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float greenAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float greenSteps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float greenStepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float greenGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float greenOffset = 0;
|
||||||
|
|
||||||
|
[ExportGroup("Blue")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float blueAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float blueSteps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float blueStepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float blueGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float blueOffset = 0;
|
||||||
|
|
||||||
|
[ExportGroup("RGB")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float rgbAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float rgbSteps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float rgbStepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float rgbGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float rgbOffset = 0;
|
||||||
|
|
||||||
|
[ExportGroup("Hue")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float hueAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float hueSteps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float hueStepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float hueGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float hueOffset = 0;
|
||||||
|
|
||||||
|
[ExportGroup("Saturation")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float saturationAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float saturationSteps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float saturationStepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float saturationGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float saturationOffset = 0;
|
||||||
|
|
||||||
|
[ExportGroup("Luminance")]
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float luminanceAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float luminanceSteps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float luminanceStepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float luminanceGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float luminanceOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
RG_ColorQuantizer colorQuantizer;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
colorQuantizer = new RG_ColorQuantizer( graph );
|
||||||
|
|
||||||
|
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
||||||
|
colorQuantizer.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
colorQuantizer
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
colorQuantizer.constants.Set(
|
||||||
|
|
||||||
|
new Vector4( redAmount, redSteps * redStepsMultiplier, Mathf.Pow( 5f,redGamma ), redOffset ),
|
||||||
|
new Vector4( greenAmount, greenSteps * greenStepsMultiplier, Mathf.Pow( 5f,greenGamma ), greenOffset ),
|
||||||
|
new Vector4( blueAmount, blueSteps * blueStepsMultiplier, Mathf.Pow( 5f,blueGamma ), blueOffset ),
|
||||||
|
new Vector4( rgbAmount, rgbSteps * rgbStepsMultiplier, Mathf.Pow( 5f,rgbGamma ), rgbOffset ),
|
||||||
|
|
||||||
|
new Vector4( hueAmount, hueSteps * hueStepsMultiplier, Mathf.Pow( 5f,hueGamma), hueOffset ),
|
||||||
|
new Vector4( saturationAmount, saturationSteps * saturationStepsMultiplier, Mathf.Pow( 5f,saturationGamma), saturationOffset ),
|
||||||
|
new Vector4( luminanceAmount, luminanceSteps * luminanceStepsMultiplier, Mathf.Pow( 5f,luminanceGamma), luminanceOffset ),
|
||||||
|
|
||||||
|
new Vector4( amount, (int) hslConversionMode, 0f, 0f )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b2oxy6ln560ys
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class EllipseDistortionEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public EllipseDistortionEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float distortionAmount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float blendAmount = 1f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector2 ellipseCenter = new Vector2( 0.5f, 0.5f );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector2 ellipseSize = new Vector2( 0.5f, 0.5f );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public float ellipseScale = 1.0f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool keepRatio = true;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public float minDistance = 0.1f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,20") ]
|
||||||
|
public float rings = 1f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float ringsIntensity = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-2,2") ]
|
||||||
|
public float ringsType = 0.5f;
|
||||||
|
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float ringsDistribution = 1f;
|
||||||
|
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
CEG_BufferTexture bufferTexture;
|
||||||
|
|
||||||
|
CEG_Copy copy;
|
||||||
|
RG_EllipseDistortion distortion;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
bufferTexture = CEG_BufferTexture.ScreenSize( graph );
|
||||||
|
|
||||||
|
copy = new CEG_Copy( graph );
|
||||||
|
distortion = new RG_EllipseDistortion( graph );
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
copy.SetTextureSlotInputs( screenColorTexture, bufferTexture );
|
||||||
|
distortion.SetTextureSlotInputs( copy.output, copy.input );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
bufferTexture,
|
||||||
|
copy,
|
||||||
|
distortion
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
|
||||||
|
distortion.constants.Set(
|
||||||
|
new Vector4(
|
||||||
|
ellipseCenter.X, ellipseCenter.Y, ellipseSize.X * ellipseScale, ellipseSize.Y * ellipseScale
|
||||||
|
),
|
||||||
|
distortionAmount,
|
||||||
|
blendAmount,
|
||||||
|
minDistance,
|
||||||
|
1.0f + redShift,
|
||||||
|
1.0f + greenShift,
|
||||||
|
1.0f + blueShift,
|
||||||
|
(float) smearingSteps,
|
||||||
|
smearing,
|
||||||
|
rings,
|
||||||
|
keepRatio ? 1.0f : 0.0f,
|
||||||
|
ringsIntensity,
|
||||||
|
Mathf.Pow( 10f, -ringsDistribution ),
|
||||||
|
ringsType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cqkrgyuerq50a
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class NoiseDistortionEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public NoiseDistortionEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0.01,100") ]
|
||||||
|
public float scale = 1f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,5") ]
|
||||||
|
public int smearingSteps = 3;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,1.5") ]
|
||||||
|
public float smearing = 1.1f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 xU = new Vector3( 0f, 0f, 0f );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 xV = new Vector3( 0f, 0f, 0f );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 yU = new Vector3( 0f, 0f, 0f );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 yV = new Vector3( 0f, 0f, 0f );
|
||||||
|
|
||||||
|
[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;
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
CEG_BufferTexture bufferTexture;
|
||||||
|
|
||||||
|
CEG_Copy copy;
|
||||||
|
RG_NoiseDistortion distortion;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
bufferTexture = CEG_BufferTexture.ScreenSize( graph );
|
||||||
|
|
||||||
|
copy = new CEG_Copy( graph );
|
||||||
|
distortion = new RG_NoiseDistortion( graph );
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
copy.SetTextureSlotInputs( screenColorTexture, bufferTexture );
|
||||||
|
distortion.SetTextureSlotInputs( copy.output, copy.input );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
bufferTexture,
|
||||||
|
copy,
|
||||||
|
distortion
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
var time = TimeLine.osTime;
|
||||||
|
|
||||||
|
distortion.constants.Set(
|
||||||
|
new Vector4(
|
||||||
|
xU.X + Mathf.Sin( xU.Y * time ) * xU.Z,
|
||||||
|
xV.X + Mathf.Sin( xV.Y * time ) * xV.Z,
|
||||||
|
yU.X + Mathf.Sin( yU.Y * time ) * yU.Z,
|
||||||
|
yV.X + Mathf.Sin( yV.Y * time ) * yV.Z
|
||||||
|
),
|
||||||
|
amount,
|
||||||
|
scale,
|
||||||
|
1.0f + redShift,
|
||||||
|
1.0f + greenShift,
|
||||||
|
1.0f + blueShift,
|
||||||
|
(float) smearingSteps,
|
||||||
|
smearing
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cidk0x7sb1pxl
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class ScanLinesEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public ScanLinesEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public Color topColor = Colors.White;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public Color bottomColor = new Color( 0.96f, 0.96f, 0.96f, 1.0f );
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,500") ]
|
||||||
|
public int scanLineHeight = 2;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float rgbTintAmount = 0.1f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public int rgbSize = 2;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool useRGBOffset = false;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,500") ]
|
||||||
|
public int rgbOffsetLineHeight = 2;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public float jitterStrength = 1f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,120") ]
|
||||||
|
public float jitterFPS = 60f;
|
||||||
|
|
||||||
|
bool jitterFlag = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
CEG_BufferTexture bufferTexture;
|
||||||
|
|
||||||
|
CEG_Copy copy;
|
||||||
|
RG_ScanLines scanLines;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
bufferTexture = CEG_BufferTexture.ScreenSize( graph );
|
||||||
|
|
||||||
|
copy = new CEG_Copy( graph );
|
||||||
|
scanLines = new RG_ScanLines( graph );
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
copy.SetTextureSlotInputs( screenColorTexture, bufferTexture );
|
||||||
|
scanLines.SetTextureSlotInputs( copy.output, copy.input );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
bufferTexture,
|
||||||
|
copy,
|
||||||
|
scanLines
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
float duration = 1f / jitterFPS;
|
||||||
|
float normalizedTime = ( TimeLine.osTime % duration ) / duration;
|
||||||
|
float jitter = Mathf.Sin( normalizedTime * Mathf.Pi * 2f ) * jitterStrength;
|
||||||
|
|
||||||
|
// this.LogInfo( jitter );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
scanLines.constants.Set(
|
||||||
|
topColor,
|
||||||
|
bottomColor,
|
||||||
|
Vector4.Zero,
|
||||||
|
Vector4.Zero,
|
||||||
|
|
||||||
|
amount,
|
||||||
|
(float) scanLineHeight,
|
||||||
|
rgbTintAmount,
|
||||||
|
(float) rgbOffsetLineHeight,
|
||||||
|
|
||||||
|
(float) rgbSize,
|
||||||
|
useRGBOffset ? 1f : 0f,
|
||||||
|
jitter,
|
||||||
|
0f
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dxnmlb5wobxtw
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class HSLAdjustmentEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public HSLAdjustmentEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-360,360") ]
|
||||||
|
public float hueShift = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-360,360") ]
|
||||||
|
public float temparatureShift = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,120") ]
|
||||||
|
public float temparatureBlendRadius = 15f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-100,100") ]
|
||||||
|
public float saturationOffset = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-100,100") ]
|
||||||
|
public float saturationGamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-100,100") ]
|
||||||
|
public float lightnessOffset = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-100,100") ]
|
||||||
|
public float lightnessGamma = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public enum HSLConversionMode
|
||||||
|
{
|
||||||
|
Raw,
|
||||||
|
Scaled,
|
||||||
|
Clamped
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public HSLConversionMode hslConversionMode = HSLConversionMode.Scaled;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
RG_HSLAdjustment hslAdjustment;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
hslAdjustment = new RG_HSLAdjustment( graph );
|
||||||
|
|
||||||
|
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
||||||
|
hslAdjustment.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
hslAdjustment
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
hslAdjustment.constants.Set(
|
||||||
|
amount,
|
||||||
|
MathX.Repeat( hueShift, 360 ) / 360f, temparatureShift,
|
||||||
|
|
||||||
|
saturationOffset / 100f, Mathf.Pow( 5f, saturationGamma / 100f ),
|
||||||
|
lightnessOffset / 100f, Mathf.Pow( 5f, lightnessGamma / 100f ),
|
||||||
|
|
||||||
|
(float)(int)hslConversionMode,
|
||||||
|
|
||||||
|
temparatureBlendRadius,
|
||||||
|
0f,
|
||||||
|
0f,
|
||||||
|
0f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://pevgspwywsxi
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class InvertEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public InvertEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool r = true;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool g = true;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool b = true;
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
RG_Invert invert;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
invert = new RG_Invert( graph );
|
||||||
|
|
||||||
|
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
||||||
|
invert.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
invert
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
invert.constants.Set(
|
||||||
|
amount,
|
||||||
|
r ? 1.0f : 0.0f,
|
||||||
|
g ? 1.0f : 0.0f,
|
||||||
|
b ? 1.0f : 0.0f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://m38dajaa0alm
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class Kernel3Effect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public Kernel3Effect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1")]
|
||||||
|
public float amount = 1f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10")]
|
||||||
|
public int kernelOffset = 1;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 rowTop = new Vector3( 0, 0, 0 );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 rowCenter = new Vector3( 0, 1, 0 );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 rowBottom = new Vector3( 0, 0, 0 );
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool normalize = false;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool clamp = false;
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
CEG_BufferTexture bufferTexture;
|
||||||
|
|
||||||
|
CEG_Copy copy;
|
||||||
|
RG_Kernel3 kernel;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
bufferTexture = CEG_BufferTexture.ScreenSize( graph );
|
||||||
|
|
||||||
|
copy = new CEG_Copy( graph );
|
||||||
|
kernel = new RG_Kernel3( graph );
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
copy.SetTextureSlotInputs( screenColorTexture, bufferTexture );
|
||||||
|
kernel.SetTextureSlotInputs( copy.output, copy.input );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
bufferTexture,
|
||||||
|
copy,
|
||||||
|
kernel
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float v( Vector3 v )
|
||||||
|
{
|
||||||
|
return v.X + v.Y + v.Z;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
var s = 1.0f;
|
||||||
|
|
||||||
|
if ( normalize )
|
||||||
|
{
|
||||||
|
var n = v( rowTop ) + v( rowCenter ) + v( rowBottom );
|
||||||
|
|
||||||
|
if ( n != 0 )
|
||||||
|
{
|
||||||
|
s = 1f / n;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel.constants.Set(
|
||||||
|
[
|
||||||
|
amount,
|
||||||
|
rowTop.X * s, rowTop.Y * s, rowTop.Z * s,
|
||||||
|
rowCenter.X * s, rowCenter.Y * s, rowCenter.Z * s,
|
||||||
|
rowBottom.X * s, rowBottom.Y * s, rowBottom.Z * s,
|
||||||
|
(float) kernelOffset,
|
||||||
|
clamp ? 1.0f : 0.0f
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b2pfl80ql156g
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class LightnessBasedAdjustmentEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public LightnessBasedAdjustmentEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 hueShift = Vector3.Zero;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float hueAmount = 1.0f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Vector3 saturationShift = Vector3.Zero;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float saturationAmount = 1.0f;
|
||||||
|
|
||||||
|
[Export ]
|
||||||
|
public Vector3 lightnessShift = Vector3.Zero;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float lightnessAmount = 1.0f;
|
||||||
|
|
||||||
|
public enum HSLConversionMode
|
||||||
|
{
|
||||||
|
Raw,
|
||||||
|
Scaled,
|
||||||
|
Clamped
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public HSLConversionMode hslConversionMode = HSLConversionMode.Scaled;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
RG_LightnessBasedAdjustment adjustment;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
adjustment = new RG_LightnessBasedAdjustment( graph );
|
||||||
|
|
||||||
|
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
||||||
|
adjustment.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
adjustment
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector4 ToVector4( Vector3 v, float w )
|
||||||
|
{
|
||||||
|
return new Vector4( v.X, v.Y, v.Z, w );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
adjustment.constants.Set(
|
||||||
|
ToVector4( hueShift, hueAmount ),
|
||||||
|
ToVector4( saturationShift, saturationAmount ),
|
||||||
|
ToVector4( lightnessShift, lightnessAmount ),
|
||||||
|
Vector4.Zero,
|
||||||
|
amount,
|
||||||
|
0f,
|
||||||
|
0f,
|
||||||
|
0f
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cjfxcl3cdhnku
|
||||||
|
|
@ -7,9 +7,9 @@ namespace Rokojori
|
||||||
{
|
{
|
||||||
[Tool]
|
[Tool]
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class NormalViewEffect:SingleShaderCompositorEffect
|
public abstract partial class NormalViewEffect:SingleShaderCompositorEffect
|
||||||
{
|
{
|
||||||
public static readonly string shaderPath = Path( "DepthView/NormalViewShader.glsl" );
|
public static readonly string shaderPath = Path( "NormalView/NormalViewShader.glsl" );
|
||||||
|
|
||||||
RDSampler sampler;
|
RDSampler sampler;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class PosterizationEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public PosterizationEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,100") ]
|
||||||
|
public float steps = 10;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10") ]
|
||||||
|
public float stepsMultiplier = 1;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float gamma = 0;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "-1,1") ]
|
||||||
|
public float offset = 0;
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
RG_Posterization posterization;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
posterization = new RG_Posterization( graph );
|
||||||
|
|
||||||
|
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
||||||
|
posterization.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
posterization
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
posterization.constants.Set(
|
||||||
|
amount,
|
||||||
|
steps * stepsMultiplier,
|
||||||
|
Mathf.Pow( 5f, gamma ),
|
||||||
|
offset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://q6iw8nan6yiv
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Rokojori
|
||||||
CEG_BufferTexture bufferTexture;
|
CEG_BufferTexture bufferTexture;
|
||||||
|
|
||||||
CEG_Copy copy;
|
CEG_Copy copy;
|
||||||
CEG_RadialBlur radialBlur;
|
RG_RadialBlur radialBlur;
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Rokojori
|
||||||
bufferTexture = CEG_BufferTexture.ScreenSize( graph );
|
bufferTexture = CEG_BufferTexture.ScreenSize( graph );
|
||||||
|
|
||||||
copy = new CEG_Copy( graph );
|
copy = new CEG_Copy( graph );
|
||||||
radialBlur = new CEG_RadialBlur( graph );
|
radialBlur = new RG_RadialBlur( graph );
|
||||||
|
|
||||||
|
|
||||||
graph.InitializeNodes();
|
graph.InitializeNodes();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class ReplaceColorEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public ReplaceColorEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 0.5f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Color searchColor;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Color replacementColor;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,3") ]
|
||||||
|
public float colorDistanceMax = 0.5f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,3") ]
|
||||||
|
public float colorDistanceMin = 0.1f;
|
||||||
|
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
RG_ReplaceColor replaceColor;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
replaceColor = new RG_ReplaceColor( graph );
|
||||||
|
|
||||||
|
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
||||||
|
replaceColor.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
replaceColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
replaceColor.constants.Set(
|
||||||
|
searchColor,
|
||||||
|
replacementColor,
|
||||||
|
amount,
|
||||||
|
colorDistanceMax,
|
||||||
|
colorDistanceMin,
|
||||||
|
0f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://7pq3ojke8tvv
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class SepiaEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public SepiaEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[ Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float amount = 1f;
|
||||||
|
|
||||||
|
[ Export( PropertyHint.Range, "0,360") ]
|
||||||
|
public float hue = 35;
|
||||||
|
|
||||||
|
[ Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float saturation = 0.5f;
|
||||||
|
|
||||||
|
[ Export( PropertyHint.Range, "0,1") ]
|
||||||
|
public float saturationAmount = 0.5f;
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
RG_Sepia sepia;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
sepia = new RG_Sepia( graph );
|
||||||
|
|
||||||
|
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
|
||||||
|
sepia.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
sepia
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
sepia.constants.Set(
|
||||||
|
amount,
|
||||||
|
hue / 360f,
|
||||||
|
saturation,
|
||||||
|
saturationAmount
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cn2103slcr2vs
|
||||||
|
|
@ -7,7 +7,7 @@ namespace Rokojori
|
||||||
{
|
{
|
||||||
[Tool]
|
[Tool]
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public abstract partial class TemporalSmearSimpleEffect:SingleShaderCompositorEffect
|
public partial class TemporalSmearSimpleEffect:SingleShaderCompositorEffect
|
||||||
{
|
{
|
||||||
public static readonly string shaderPath = Path( "TemporalSmearSimple/TemporalSmearSimple.glsl" );
|
public static readonly string shaderPath = Path( "TemporalSmearSimple/TemporalSmearSimple.glsl" );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class UnsharpMaskingEffect:RDGraphCompositorEffect
|
||||||
|
{
|
||||||
|
public UnsharpMaskingEffect():base()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "0,1")]
|
||||||
|
public float amount = 1f;
|
||||||
|
|
||||||
|
[Export( PropertyHint.Range, "1,10")]
|
||||||
|
public int kernelOffset = 1;
|
||||||
|
|
||||||
|
CEG_ScreenColorTexure screenColorTexture;
|
||||||
|
CEG_BufferTexture bufferTexture;
|
||||||
|
|
||||||
|
CEG_Copy copy;
|
||||||
|
RG_Kernel3 unsharpMaskingKernel;
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
screenColorTexture = new CEG_ScreenColorTexure( graph );
|
||||||
|
bufferTexture = CEG_BufferTexture.ScreenSize( graph );
|
||||||
|
|
||||||
|
copy = new CEG_Copy( graph );
|
||||||
|
unsharpMaskingKernel = new RG_Kernel3( graph );
|
||||||
|
graph.InitializeNodes();
|
||||||
|
|
||||||
|
copy.SetTextureSlotInputs( screenColorTexture, bufferTexture );
|
||||||
|
unsharpMaskingKernel.SetTextureSlotInputs( copy.output, copy.input );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
graph.SetProcessOrder(
|
||||||
|
screenColorTexture,
|
||||||
|
bufferTexture,
|
||||||
|
copy,
|
||||||
|
unsharpMaskingKernel
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ForAllViews()
|
||||||
|
{
|
||||||
|
unsharpMaskingKernel.constants.Set(
|
||||||
|
[
|
||||||
|
amount,
|
||||||
|
0f, -1f, 0f,
|
||||||
|
-1f, 5f, -1f,
|
||||||
|
0f, -1f,0f,
|
||||||
|
(float)kernelOffset,
|
||||||
|
0f
|
||||||
|
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://wl1p78fs5sos
|
||||||
|
|
@ -20,6 +20,27 @@ uniform Parameters
|
||||||
|
|
||||||
} parameters;
|
} 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 )
|
float randomFloat( vec2 uv )
|
||||||
{
|
{
|
||||||
|
|
@ -65,7 +86,7 @@ void main( )
|
||||||
kernelUV.x = clamp( kernelUV.x, 0, size.x - 1 );
|
kernelUV.x = clamp( kernelUV.x, 0, size.x - 1 );
|
||||||
kernelUV.y = clamp( kernelUV.y, 0, size.y - 1 );
|
kernelUV.y = clamp( kernelUV.y, 0, size.y - 1 );
|
||||||
|
|
||||||
color += imageLoad( inputImage, kernelUV );
|
color += ( imageLoad( inputImage, kernelUV ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +102,7 @@ void main( )
|
||||||
kernelUV.x = clamp( kernelUV.x, 0, size.x - 1 );
|
kernelUV.x = clamp( kernelUV.x, 0, size.x - 1 );
|
||||||
kernelUV.y = clamp( kernelUV.y, 0, size.y - 1 );
|
kernelUV.y = clamp( kernelUV.y, 0, size.y - 1 );
|
||||||
|
|
||||||
color += imageLoad( inputImage, kernelUV );
|
color += ( imageLoad( inputImage, kernelUV ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +113,8 @@ void main( )
|
||||||
|
|
||||||
color /= numPixels;
|
color /= numPixels;
|
||||||
|
|
||||||
|
color = ( color );
|
||||||
|
|
||||||
vec4 originalColor = imageLoad( inputImage, pixelUV );
|
vec4 originalColor = imageLoad( inputImage, pixelUV );
|
||||||
vec4 mixedColor = mix( originalColor, color, parameters.intensity );
|
vec4 mixedColor = mix( originalColor, color, parameters.intensity );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Rokojori
|
namespace Rokojori
|
||||||
{
|
{
|
||||||
public class RD_BoxBlur:CEG_ImageProcessor
|
public class RG_BoxBlur:CEG_ImageProcessor
|
||||||
{
|
{
|
||||||
public static readonly string shaderPath =
|
public static readonly string shaderPath =
|
||||||
RDGraph.Path( "Nodes/Processors/Blurs/BoxBlur/BoxBlur.glsl" );
|
RDGraph.Path( "Nodes/Processors/Blurs/BoxBlur/BoxBlur.glsl" );
|
||||||
|
|
||||||
public RD_BoxBlur( RDGraph graph ):base( graph, shaderPath )
|
public RG_BoxBlur( RDGraph graph ):base( graph, shaderPath )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Rokojori
|
namespace Rokojori
|
||||||
{
|
{
|
||||||
public class CEG_RadialBlur:CEG_ImageProcessor
|
public class RG_RadialBlur:CEG_ImageProcessor
|
||||||
{
|
{
|
||||||
public static readonly string shaderPath =
|
public static readonly string shaderPath =
|
||||||
RDGraph.Path( "Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl" );
|
RDGraph.Path( "Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl" );
|
||||||
|
|
||||||
public CEG_RadialBlur( RDGraph graph ):base( graph, shaderPath )
|
public RG_RadialBlur( RDGraph graph ):base( graph, shaderPath )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4,12 +4,12 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Rokojori
|
namespace Rokojori
|
||||||
{
|
{
|
||||||
public class CEG_AlphaColorDilation:CEG_ImageProcessor
|
public class RG_AlphaColorDilation:CEG_ImageProcessor
|
||||||
{
|
{
|
||||||
public static readonly string shaderPath =
|
public static readonly string shaderPath =
|
||||||
RDGraph.Path( "Nodes/Processors/Color/AlphaColorDilation/AlphaColorDilation.glsl" );
|
RDGraph.Path( "Nodes/Processors/Color/AlphaColorDilation/AlphaColorDilation.glsl" );
|
||||||
|
|
||||||
public CEG_AlphaColorDilation( RDGraph graph ):base( graph, shaderPath )
|
public RG_AlphaColorDilation( RDGraph graph ):base( graph, shaderPath )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -15,12 +15,28 @@ uniform Params
|
||||||
vec2 rShift;
|
vec2 rShift;
|
||||||
vec2 gShift;
|
vec2 gShift;
|
||||||
vec2 bShift;
|
vec2 bShift;
|
||||||
|
vec2 padding0;
|
||||||
|
|
||||||
float amount;
|
float amount;
|
||||||
float shiftAll;
|
float shiftAll;
|
||||||
float unshiftCenter;
|
float unshiftPower;
|
||||||
|
float unshiftOffset;
|
||||||
|
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
|
|
||||||
|
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 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void main( )
|
void main( )
|
||||||
{
|
{
|
||||||
ivec2 size = imageSize( inputImage );
|
ivec2 size = imageSize( inputImage );
|
||||||
|
|
@ -33,10 +49,18 @@ void main( )
|
||||||
|
|
||||||
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
float d = length( uv - vec2( 0.5 ) ) / 0.5;
|
||||||
|
d = pow( max( 0.0, d - params.unshiftOffset ), params.unshiftPower );
|
||||||
|
|
||||||
|
|
||||||
|
vec2 uvR = uv + params.rShift * params.shiftAll * d;
|
||||||
|
vec2 uvG = uv + params.gShift * params.shiftAll * d;
|
||||||
|
vec2 uvB = uv + params.bShift * params.shiftAll * d;
|
||||||
|
|
||||||
|
uvR = mirrorUV( uvR );
|
||||||
|
uvG = mirrorUV( uvG );
|
||||||
|
uvB = mirrorUV( uvB );
|
||||||
|
|
||||||
vec2 uvR = uv + params.rShift * params.shiftAll;
|
|
||||||
vec2 uvG = uv + params.gShift * params.shiftAll;
|
|
||||||
vec2 uvB = uv + params.bShift * params.shiftAll;
|
|
||||||
|
|
||||||
float r = imageLoad( inputImage, ivec2( uvR * size ) ).r;
|
float r = imageLoad( inputImage, ivec2( uvR * size ) ).r;
|
||||||
float g = imageLoad( inputImage, ivec2( uvG * size ) ).g;
|
float g = imageLoad( inputImage, ivec2( uvG * size ) ).g;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
#[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
|
||||||
|
{
|
||||||
|
vec4 r;
|
||||||
|
vec4 g;
|
||||||
|
vec4 b;
|
||||||
|
vec4 rgb;
|
||||||
|
|
||||||
|
vec4 h;
|
||||||
|
vec4 s;
|
||||||
|
vec4 l;
|
||||||
|
vec4 settings;
|
||||||
|
|
||||||
|
} parameters;
|
||||||
|
|
||||||
|
|
||||||
|
vec3 RGBtoHSL( vec3 c )
|
||||||
|
{
|
||||||
|
float h = 0.0;
|
||||||
|
float s = 0.0;
|
||||||
|
float l = 0.0;
|
||||||
|
|
||||||
|
float cmin = min( min( c.r, c.g ), c.b );
|
||||||
|
float cmax = max( max( c.r, c.g ), c.b );
|
||||||
|
|
||||||
|
l = ( cmin + cmax ) / 2.0;
|
||||||
|
|
||||||
|
if ( cmin == cmax )
|
||||||
|
{
|
||||||
|
s = 0.0;
|
||||||
|
h = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float delta = cmax - cmin;
|
||||||
|
float both = cmax + cmin;
|
||||||
|
|
||||||
|
s = ( l <= 0.5 ) ?
|
||||||
|
( both == 0.0 ? 0.0 : ( delta / both ) ) :
|
||||||
|
( delta / ( 2.0 - both ) );
|
||||||
|
|
||||||
|
h = 0.0;
|
||||||
|
|
||||||
|
if ( c.r == cmax )
|
||||||
|
{
|
||||||
|
h = delta == 0.0 ? 0.0 : ( ( c.g - c.b ) / delta );
|
||||||
|
}
|
||||||
|
else if ( c.g == cmax )
|
||||||
|
{
|
||||||
|
h = delta == 0.0 ? 0.0 : ( 2.0 + ( c.b - c.r ) / delta );
|
||||||
|
}
|
||||||
|
else if ( c.b == cmax )
|
||||||
|
{
|
||||||
|
h = delta == 0.0 ? 0.0 : ( 4.0 + ( c.r - c.g ) / delta ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = h / 6.0;
|
||||||
|
|
||||||
|
if ( h > 1.0 )
|
||||||
|
{
|
||||||
|
h -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3( h, s, l );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hueToRGB( float hue )
|
||||||
|
{
|
||||||
|
float R = abs( hue * 6.0 - 3.0 ) - 1.0;
|
||||||
|
float G = 2.0 - abs( hue * 6.0 - 2.0 );
|
||||||
|
float B = 2.0 - abs( hue * 6.0 - 4.0 );
|
||||||
|
return clamp( vec3( R,G,B ), 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 HSLtoRGB( vec3 hsl )
|
||||||
|
{
|
||||||
|
if ( hsl.y == 0.0 )
|
||||||
|
{
|
||||||
|
return vec3( hsl.z, hsl.z, hsl.z );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 rgb = hueToRGB( hsl.x );
|
||||||
|
float C = ( 1.0 - abs( 2.0 * hsl.z - 1.0 )) * hsl.y;
|
||||||
|
return ( rgb - 0.5 ) * C + hsl.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float applyGamma( float x, float power )
|
||||||
|
{
|
||||||
|
if ( x <= 0.0 )
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pow( x, power );
|
||||||
|
}
|
||||||
|
|
||||||
|
float apply( float x, vec4 parameters )
|
||||||
|
{
|
||||||
|
float amount = parameters.x;
|
||||||
|
float steps = parameters.y;
|
||||||
|
float power = parameters.z;
|
||||||
|
float off = parameters.w;
|
||||||
|
|
||||||
|
float y = applyGamma( x + off, power );
|
||||||
|
y = round( y * steps ) / steps;
|
||||||
|
return mix( x, applyGamma( y, 1.0/ power ) - off, amount );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 applyRGB( vec4 v, vec4 parameters )
|
||||||
|
{
|
||||||
|
v.x = apply( v.x, parameters );
|
||||||
|
v.y = apply( v.y, parameters );
|
||||||
|
v.z = apply( v.z, parameters );
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
vec4 color = imageLoad( inputImage, ivec2( uv * size ) );
|
||||||
|
|
||||||
|
vec4 rgb = color;
|
||||||
|
rgb.r = apply( rgb.r, parameters.r );
|
||||||
|
rgb.g = apply( rgb.g, parameters.g );
|
||||||
|
rgb.b = apply( rgb.b, parameters.b );
|
||||||
|
|
||||||
|
rgb = applyRGB( rgb, parameters.rgb );
|
||||||
|
|
||||||
|
int NONE = 0;
|
||||||
|
int SCALE = 1;
|
||||||
|
int CLAMP = 2;
|
||||||
|
|
||||||
|
int hslMode = int( round( parameters.settings.y ) );
|
||||||
|
float scaler = 1.0;
|
||||||
|
|
||||||
|
if ( hslMode == SCALE )
|
||||||
|
{
|
||||||
|
scaler = max( max( max( rgb.r, rgb.g ), rgb.b ), 1.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hslMode == CLAMP )
|
||||||
|
{
|
||||||
|
rgb.rgb = clamp( rgb.rgb, 0.0, 1.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hsl = RGBtoHSL( rgb.rgb / scaler );
|
||||||
|
hsl.r = apply( hsl.r, parameters.h );
|
||||||
|
hsl.g = apply( hsl.g, parameters.s );
|
||||||
|
hsl.b = apply( hsl.b, parameters.l );
|
||||||
|
|
||||||
|
vec4 posterColor = vec4( HSLtoRGB( hsl ) * scaler, color.a );
|
||||||
|
|
||||||
|
|
||||||
|
vec4 blended = mix( color, posterColor, parameters.settings.x );
|
||||||
|
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, blended );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://pt5sgwsji4qe"
|
||||||
|
path="res://.godot/imported/ColorQuantizer.glsl-68db05911563e8ec1917ba51206dd6ab.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Color/ColorQuantizer/ColorQuantizer.glsl"
|
||||||
|
dest_files=["res://.godot/imported/ColorQuantizer.glsl-68db05911563e8ec1917ba51206dd6ab.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_ColorQuantizer:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Color/ColorQuantizer/ColorQuantizer.glsl" );
|
||||||
|
|
||||||
|
public RG_ColorQuantizer( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://u4s8vs05cmto
|
||||||
|
|
@ -0,0 +1,208 @@
|
||||||
|
#[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 amount;
|
||||||
|
float h;
|
||||||
|
float t;
|
||||||
|
float s;
|
||||||
|
|
||||||
|
float sp;
|
||||||
|
float l;
|
||||||
|
float lp;
|
||||||
|
float hslMode;
|
||||||
|
|
||||||
|
float tBlendRadius;
|
||||||
|
float p0;
|
||||||
|
float p1;
|
||||||
|
float p2;
|
||||||
|
|
||||||
|
} parameters;
|
||||||
|
|
||||||
|
|
||||||
|
vec3 RGBtoHSL( vec3 c )
|
||||||
|
{
|
||||||
|
float h = 0.0;
|
||||||
|
float s = 0.0;
|
||||||
|
float l = 0.0;
|
||||||
|
|
||||||
|
float cmin = min( min( c.r, c.g ), c.b );
|
||||||
|
float cmax = max( max( c.r, c.g ), c.b );
|
||||||
|
|
||||||
|
l = ( cmin + cmax ) / 2.0;
|
||||||
|
|
||||||
|
if ( cmin == cmax )
|
||||||
|
{
|
||||||
|
s = 0.0;
|
||||||
|
h = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float delta = cmax - cmin;
|
||||||
|
float both = cmax + cmin;
|
||||||
|
|
||||||
|
s = ( l <= 0.5 ) ?
|
||||||
|
( both == 0.0 ? 0.0 : ( delta / both ) ) :
|
||||||
|
( delta / ( 2.0 - both ) );
|
||||||
|
|
||||||
|
h = 0.0;
|
||||||
|
|
||||||
|
if ( c.r == cmax )
|
||||||
|
{
|
||||||
|
h = delta == 0.0 ? 0.0 : ( ( c.g - c.b ) / delta );
|
||||||
|
}
|
||||||
|
else if ( c.g == cmax )
|
||||||
|
{
|
||||||
|
h = delta == 0.0 ? 0.0 : ( 2.0 + ( c.b - c.r ) / delta );
|
||||||
|
}
|
||||||
|
else if ( c.b == cmax )
|
||||||
|
{
|
||||||
|
h = delta == 0.0 ? 0.0 : ( 4.0 + ( c.r - c.g ) / delta ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = h / 6.0;
|
||||||
|
|
||||||
|
if ( h > 1.0 )
|
||||||
|
{
|
||||||
|
h -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3( h, s, l );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hueToRGB( float hue )
|
||||||
|
{
|
||||||
|
float R = abs( hue * 6.0 - 3.0 ) - 1.0;
|
||||||
|
float G = 2.0 - abs( hue * 6.0 - 2.0 );
|
||||||
|
float B = 2.0 - abs( hue * 6.0 - 4.0 );
|
||||||
|
return clamp( vec3( R,G,B ), 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 HSLtoRGB( vec3 hsl )
|
||||||
|
{
|
||||||
|
if ( hsl.y == 0.0 )
|
||||||
|
{
|
||||||
|
return vec3( hsl.z, hsl.z, hsl.z );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 rgb = hueToRGB( hsl.x );
|
||||||
|
float C = ( 1.0 - abs( 2.0 * hsl.z - 1.0 )) * hsl.y;
|
||||||
|
return ( rgb - 0.5 ) * C + hsl.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float modPolarDegrees( float value )
|
||||||
|
{
|
||||||
|
return mod( value + 180.0, 360.0 ) - 180.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec3 changeHueOfRGB( vec3 rgb, float hueChange )
|
||||||
|
{
|
||||||
|
vec3 hsl = RGBtoHSL( rgb );
|
||||||
|
hsl.x = mod( hsl.x + hueChange, 1.0 ) ;
|
||||||
|
|
||||||
|
return HSLtoRGB( hsl );
|
||||||
|
}
|
||||||
|
|
||||||
|
float hue360ToYB( float hue )
|
||||||
|
{
|
||||||
|
return modPolarDegrees( hue - 240.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
float ybToHue360( float yb )
|
||||||
|
{
|
||||||
|
return mod( yb + 240.0, 360.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
float changeHue360( float hue, float change )
|
||||||
|
{
|
||||||
|
float yb = hue360ToYB( hue );
|
||||||
|
|
||||||
|
float absYB = abs( yb );
|
||||||
|
|
||||||
|
absYB = clamp( absYB + change, 0.0, 180.0 );
|
||||||
|
|
||||||
|
float realYB = sign( yb ) * absYB;
|
||||||
|
|
||||||
|
return ybToHue360( realYB );
|
||||||
|
}
|
||||||
|
|
||||||
|
float changeHue360Blended( float hue, float change, float blendRadius )
|
||||||
|
{
|
||||||
|
float distanceToYellow = min( 1.0, abs( hue - 60.0 ) / blendRadius );
|
||||||
|
float distanceToBlue = min( 1.0, abs( hue - 240.0 ) / blendRadius );
|
||||||
|
|
||||||
|
return changeHue360( hue, change * distanceToYellow * distanceToBlue );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 shiftHSL360( vec3 hslWithH360, vec3 offset, float blendRadius )
|
||||||
|
{
|
||||||
|
float distanceToYellow = min( 1.0, abs( hslWithH360.x - 60.0 ) / blendRadius );
|
||||||
|
float distanceToBlue = min( 1.0, abs( hslWithH360.x - 240.0 ) / blendRadius );
|
||||||
|
|
||||||
|
hslWithH360.x = changeHue360( hslWithH360.x, offset.x * distanceToYellow * distanceToBlue );
|
||||||
|
hslWithH360.y = clamp( hslWithH360.y + offset.y, 0, 1 );
|
||||||
|
hslWithH360.z = clamp( hslWithH360.z + offset.z, 0, 1 );
|
||||||
|
|
||||||
|
return hslWithH360;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
vec4 color = imageLoad( inputImage, ivec2( uv * size ) );
|
||||||
|
|
||||||
|
vec4 rgb = color;
|
||||||
|
|
||||||
|
int NONE = 0;
|
||||||
|
int SCALE = 1;
|
||||||
|
int CLAMP = 2;
|
||||||
|
|
||||||
|
int hslMode = int( round( parameters.hslMode ) );
|
||||||
|
float scaler = 1.0;
|
||||||
|
|
||||||
|
if ( hslMode == SCALE )
|
||||||
|
{
|
||||||
|
scaler = max( max( max( rgb.r, rgb.g ), rgb.b ), 1.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hslMode == CLAMP )
|
||||||
|
{
|
||||||
|
rgb.rgb = clamp( rgb.rgb, 0.0, 1.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hsl = RGBtoHSL( rgb.rgb / scaler );
|
||||||
|
hsl.r = mod( hsl.r + parameters.h, 1.0 );
|
||||||
|
hsl.r = changeHue360Blended( hsl.r * 360.0, parameters.t, parameters.tBlendRadius) / 360.0;
|
||||||
|
hsl.g = clamp( pow( hsl.g, parameters.sp ) + parameters.s, 0.0, 1.0 );
|
||||||
|
hsl.b = clamp( pow( hsl.b, parameters.lp ) + parameters.l, 0.0, 1.0 );
|
||||||
|
|
||||||
|
vec4 processedColor = vec4( HSLtoRGB( hsl ) * scaler, color.a );
|
||||||
|
|
||||||
|
|
||||||
|
vec4 blended = mix( color, processedColor, parameters.amount );
|
||||||
|
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, blended );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://cvyxjo22y6g8a"
|
||||||
|
path="res://.godot/imported/HSLAdjustment.glsl-d01c2dde505d97a50e752af329ce3d54.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Color/HSLAdjustment/HSLAdjustment.glsl"
|
||||||
|
dest_files=["res://.godot/imported/HSLAdjustment.glsl-d01c2dde505d97a50e752af329ce3d54.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_HSLAdjustment:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Color/HSLAdjustment/HSLAdjustment.glsl" );
|
||||||
|
|
||||||
|
public RG_HSLAdjustment( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://disjx4q2bdjbm
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
#[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 amount;
|
||||||
|
float r;
|
||||||
|
float g;
|
||||||
|
float b;
|
||||||
|
|
||||||
|
} 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 )) );
|
||||||
|
}
|
||||||
|
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec3 RGBtoHSL( vec3 c )
|
||||||
|
{
|
||||||
|
float h = 0.0;
|
||||||
|
float s = 0.0;
|
||||||
|
float l = 0.0;
|
||||||
|
|
||||||
|
float cmin = min( min( c.r, c.g ), c.b );
|
||||||
|
float cmax = max( max( c.r, c.g ), c.b );
|
||||||
|
|
||||||
|
l = ( cmin + cmax ) / 2.0;
|
||||||
|
|
||||||
|
if ( cmin == cmax )
|
||||||
|
{
|
||||||
|
s = 0.0;
|
||||||
|
h = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float delta = cmax - cmin;
|
||||||
|
|
||||||
|
s = ( l <= 0.5 ) ? ( delta / ( cmax + cmin ) ) : ( delta / ( 2.0 - ( cmax + cmin ) ) );
|
||||||
|
|
||||||
|
h = 0.0;
|
||||||
|
|
||||||
|
if ( c.r == cmax )
|
||||||
|
{
|
||||||
|
h = ( c.g - c.b ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.g == cmax )
|
||||||
|
{
|
||||||
|
h = 2.0 + ( c.b - c.r ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.b == cmax )
|
||||||
|
{
|
||||||
|
h = 4.0 + ( c.r - c.g ) / delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = h / 6.0;
|
||||||
|
|
||||||
|
if ( h > 1.0 )
|
||||||
|
{
|
||||||
|
h -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3( h, s, l );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hueToRGB( float hue )
|
||||||
|
{
|
||||||
|
float R = abs( hue * 6.0 - 3.0 ) - 1.0;
|
||||||
|
float G = 2.0 - abs( hue * 6.0 - 2.0 );
|
||||||
|
float B = 2.0 - abs( hue * 6.0 - 4.0 );
|
||||||
|
return clamp( vec3( R,G,B ), 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 HSLtoRGB( vec3 hsl )
|
||||||
|
{
|
||||||
|
if ( hsl.y == 0.0 )
|
||||||
|
{
|
||||||
|
return vec3( hsl.z, hsl.z, hsl.z );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 rgb = hueToRGB( hsl.x );
|
||||||
|
float C = ( 1.0 - abs( 2.0 * hsl.z - 1.0 )) * hsl.y;
|
||||||
|
return ( rgb - 0.5 ) * C + hsl.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float applyGamma( float x, float power )
|
||||||
|
{
|
||||||
|
if ( x <= 0.0 )
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pow( x, power );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 gammaColor( vec4 v, float power )
|
||||||
|
{
|
||||||
|
v.x = applyGamma( v.x, power );
|
||||||
|
v.y = applyGamma( v.y, power );
|
||||||
|
v.z = applyGamma( v.z, power );
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vec4 color = imageLoad( inputImage, ivec2( uv * size ) );
|
||||||
|
|
||||||
|
vec4 invertedColor = vec4( LINEARtoSRGB( color.rgb ), color.a );
|
||||||
|
|
||||||
|
float maxV = max( 1.0, max( invertedColor.r, max( invertedColor.g, invertedColor.b ) ) );
|
||||||
|
invertedColor /= maxV;
|
||||||
|
|
||||||
|
invertedColor.r = parameters.r < 0.5 ? invertedColor.r : ( 1.0 - invertedColor.r );
|
||||||
|
invertedColor.g = parameters.g < 0.5 ? invertedColor.g : ( 1.0 - invertedColor.g );
|
||||||
|
invertedColor.b = parameters.b < 0.5 ? invertedColor.b : ( 1.0 - invertedColor.b );
|
||||||
|
|
||||||
|
invertedColor *= maxV;
|
||||||
|
|
||||||
|
invertedColor.rgb = SRGBtoLINEAR( invertedColor.rgb );
|
||||||
|
|
||||||
|
vec4 blended = mix( color, invertedColor, parameters.amount );
|
||||||
|
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, blended );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://xlqgoulucny3"
|
||||||
|
path="res://.godot/imported/Invert.glsl-e536eda71df4cd1428c6b86e70585c9e.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Color/Invert/Invert.glsl"
|
||||||
|
dest_files=["res://.godot/imported/Invert.glsl-e536eda71df4cd1428c6b86e70585c9e.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_Invert:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Color/Invert/Invert.glsl" );
|
||||||
|
|
||||||
|
public RG_Invert( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://u4v7gvnxrx3y
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
#[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
|
||||||
|
{
|
||||||
|
vec4 h;
|
||||||
|
vec4 s;
|
||||||
|
vec4 l;
|
||||||
|
vec4 pad;
|
||||||
|
float amount;
|
||||||
|
float pad0;
|
||||||
|
float pad1;
|
||||||
|
float pad2;
|
||||||
|
|
||||||
|
|
||||||
|
} parameters;
|
||||||
|
|
||||||
|
|
||||||
|
vec3 RGBtoHSL( vec3 c )
|
||||||
|
{
|
||||||
|
float h = 0.0;
|
||||||
|
float s = 0.0;
|
||||||
|
float l = 0.0;
|
||||||
|
|
||||||
|
float cmin = min( min( c.r, c.g ), c.b );
|
||||||
|
float cmax = max( max( c.r, c.g ), c.b );
|
||||||
|
|
||||||
|
l = ( cmin + cmax ) / 2.0;
|
||||||
|
|
||||||
|
if ( cmin == cmax )
|
||||||
|
{
|
||||||
|
s = 0.0;
|
||||||
|
h = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float delta = cmax - cmin;
|
||||||
|
|
||||||
|
s = ( l <= 0.5 ) ? ( delta / ( cmax + cmin ) ) : ( delta / ( 2.0 - ( cmax + cmin ) ) );
|
||||||
|
|
||||||
|
h = 0.0;
|
||||||
|
|
||||||
|
if ( c.r == cmax )
|
||||||
|
{
|
||||||
|
h = ( c.g - c.b ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.g == cmax )
|
||||||
|
{
|
||||||
|
h = 2.0 + ( c.b - c.r ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.b == cmax )
|
||||||
|
{
|
||||||
|
h = 4.0 + ( c.r - c.g ) / delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = h / 6.0;
|
||||||
|
|
||||||
|
if ( h > 1.0 )
|
||||||
|
{
|
||||||
|
h -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3( h, s, l );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hueToRGB( float hue )
|
||||||
|
{
|
||||||
|
float R = abs( hue * 6.0 - 3.0 ) - 1.0;
|
||||||
|
float G = 2.0 - abs( hue * 6.0 - 2.0 );
|
||||||
|
float B = 2.0 - abs( hue * 6.0 - 4.0 );
|
||||||
|
return clamp( vec3( R,G,B ), 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 HSLtoRGB( vec3 hsl )
|
||||||
|
{
|
||||||
|
if ( hsl.y == 0.0 )
|
||||||
|
{
|
||||||
|
return vec3( hsl.z, hsl.z, hsl.z );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 rgb = hueToRGB( hsl.x );
|
||||||
|
float C = ( 1.0 - abs( 2.0 * hsl.z - 1.0 )) * hsl.y;
|
||||||
|
return ( rgb - 0.5 ) * C + hsl.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec4 color = imageLoad( inputImage, texel_coord );
|
||||||
|
|
||||||
|
vec4 sRGB = LINEARtoSRGB( color );
|
||||||
|
float scale = max( 1.0, max( sRGB.r, max( sRGB.g, sRGB.b ) ) );
|
||||||
|
vec4 scaledColor = sRGB / scale;
|
||||||
|
|
||||||
|
vec3 hsl = RGBtoHSL( scaledColor.rgb );
|
||||||
|
|
||||||
|
vec3 offsetX = vec3( parameters.h.x * parameters.h.w, parameters.s.x * parameters.s.w, parameters.l.x * parameters.l.w );
|
||||||
|
vec3 offsetY = vec3( parameters.h.y * parameters.h.w, parameters.s.y * parameters.s.w, parameters.l.y * parameters.l.w );
|
||||||
|
vec3 offsetZ = vec3( parameters.h.z * parameters.h.w, parameters.s.z * parameters.s.w, parameters.l.z * parameters.l.w );
|
||||||
|
|
||||||
|
vec3 lerpedOffset = hsl.z < 0.5 ? mix( offsetX, offsetY, hsl.z * 2.0 ) :
|
||||||
|
mix( offsetY, offsetZ, ( hsl.z - 0.5 ) * 2.0 );
|
||||||
|
|
||||||
|
vec3 lerpedHSL = hsl;
|
||||||
|
lerpedHSL.x = mod( lerpedHSL.x + lerpedOffset.x, 1.0 );
|
||||||
|
lerpedHSL.y = clamp( lerpedHSL.y + lerpedOffset.y, 0.0, 1.0 );
|
||||||
|
lerpedHSL.z = clamp( lerpedHSL.z + lerpedOffset.z, 0.0, 1.0 );
|
||||||
|
|
||||||
|
vec4 processedColor = vec4( HSLtoRGB( lerpedHSL ) * scale, color.a );
|
||||||
|
processedColor = SRGBtoLINEAR( processedColor );
|
||||||
|
|
||||||
|
|
||||||
|
vec4 blended = mix( color, processedColor, parameters.amount );
|
||||||
|
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, blended );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://k2mgqrsy2q5g"
|
||||||
|
path="res://.godot/imported/LightnessBasedAdjustment.glsl-010561f97d3def7287134adc5db44cfe.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Color/LightnessBasedAdjustment/LightnessBasedAdjustment.glsl"
|
||||||
|
dest_files=["res://.godot/imported/LightnessBasedAdjustment.glsl-010561f97d3def7287134adc5db44cfe.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_LightnessBasedAdjustment:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Color/LightnessBasedAdjustment/LightnessBasedAdjustment.glsl" );
|
||||||
|
|
||||||
|
public RG_LightnessBasedAdjustment( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bl0nsj1m6ahc4
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
#[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 amount;
|
||||||
|
float steps;
|
||||||
|
float gamma;
|
||||||
|
float off;
|
||||||
|
|
||||||
|
} parameters;
|
||||||
|
|
||||||
|
|
||||||
|
vec3 RGBtoHSL( vec3 c )
|
||||||
|
{
|
||||||
|
float h = 0.0;
|
||||||
|
float s = 0.0;
|
||||||
|
float l = 0.0;
|
||||||
|
|
||||||
|
float cmin = min( min( c.r, c.g ), c.b );
|
||||||
|
float cmax = max( max( c.r, c.g ), c.b );
|
||||||
|
|
||||||
|
l = ( cmin + cmax ) / 2.0;
|
||||||
|
|
||||||
|
if ( cmin == cmax )
|
||||||
|
{
|
||||||
|
s = 0.0;
|
||||||
|
h = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float delta = cmax - cmin;
|
||||||
|
|
||||||
|
s = ( l <= 0.5 ) ? ( delta / ( cmax + cmin ) ) : ( delta / ( 2.0 - ( cmax + cmin ) ) );
|
||||||
|
|
||||||
|
h = 0.0;
|
||||||
|
|
||||||
|
if ( c.r == cmax )
|
||||||
|
{
|
||||||
|
h = ( c.g - c.b ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.g == cmax )
|
||||||
|
{
|
||||||
|
h = 2.0 + ( c.b - c.r ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.b == cmax )
|
||||||
|
{
|
||||||
|
h = 4.0 + ( c.r - c.g ) / delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = h / 6.0;
|
||||||
|
|
||||||
|
if ( h > 1.0 )
|
||||||
|
{
|
||||||
|
h -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3( h, s, l );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hueToRGB( float hue )
|
||||||
|
{
|
||||||
|
float R = abs( hue * 6.0 - 3.0 ) - 1.0;
|
||||||
|
float G = 2.0 - abs( hue * 6.0 - 2.0 );
|
||||||
|
float B = 2.0 - abs( hue * 6.0 - 4.0 );
|
||||||
|
return clamp( vec3( R,G,B ), 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 HSLtoRGB( vec3 hsl )
|
||||||
|
{
|
||||||
|
if ( hsl.y == 0.0 )
|
||||||
|
{
|
||||||
|
return vec3( hsl.z, hsl.z, hsl.z );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 rgb = hueToRGB( hsl.x );
|
||||||
|
float C = ( 1.0 - abs( 2.0 * hsl.z - 1.0 )) * hsl.y;
|
||||||
|
return ( rgb - 0.5 ) * C + hsl.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float applyGamma( float x, float power )
|
||||||
|
{
|
||||||
|
if ( x <= 0.0 )
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pow( x, power );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 gammaColor( vec4 v, float power )
|
||||||
|
{
|
||||||
|
v.x = applyGamma( v.x, power );
|
||||||
|
v.y = applyGamma( v.y, power );
|
||||||
|
v.z = applyGamma( v.z, power );
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
vec4 color = imageLoad( inputImage, ivec2( uv * size ) );
|
||||||
|
|
||||||
|
float off = parameters.off;
|
||||||
|
vec4 offset = vec4( off, off, off, 0);
|
||||||
|
|
||||||
|
vec4 gColor = color;
|
||||||
|
gColor = gammaColor( color + offset, parameters.gamma );
|
||||||
|
vec4 posterColor = round( gColor * parameters.steps ) / parameters.steps;
|
||||||
|
posterColor = gammaColor( posterColor, parameters.gamma ) - offset;
|
||||||
|
|
||||||
|
|
||||||
|
vec4 blended = mix( color, posterColor, parameters.amount );
|
||||||
|
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, blended );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://clvkmeu1lxyj6"
|
||||||
|
path="res://.godot/imported/Posterization.glsl-ea3489149cb3e34a41a4e78e183669b0.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Color/Posterization/Posterization.glsl"
|
||||||
|
dest_files=["res://.godot/imported/Posterization.glsl-ea3489149cb3e34a41a4e78e183669b0.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_Posterization:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Color/Posterization/Posterization.glsl" );
|
||||||
|
|
||||||
|
public RG_Posterization( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://lk8i5eldaq1b
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_ReplaceColor:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Color/ReplaceColor/ReplaceColor.glsl" );
|
||||||
|
|
||||||
|
public RG_ReplaceColor( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bfww66s0qml6d
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
#[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
|
||||||
|
{
|
||||||
|
vec4 searchColor;
|
||||||
|
vec4 replacementColor;
|
||||||
|
|
||||||
|
float amount;
|
||||||
|
float colorDistanceMax;
|
||||||
|
float colorDistanceMin;
|
||||||
|
float colorSpace;
|
||||||
|
|
||||||
|
} 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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 color = imageLoad( inputImage, texel_coord );
|
||||||
|
|
||||||
|
vec4 colorA = LINEARtoSRGB( color ) ;
|
||||||
|
vec4 colorB = parameters.searchColor;
|
||||||
|
|
||||||
|
float dist = length( colorA.rgb - colorB.rgb );
|
||||||
|
dist = max( 0.0, dist - parameters.colorDistanceMin );
|
||||||
|
dist = min( 1.0, dist / parameters.colorDistanceMax );
|
||||||
|
|
||||||
|
float replaceAmount = 1.0 - dist;
|
||||||
|
|
||||||
|
vec4 replacedColor = SRGBtoLINEAR( parameters.replacementColor );
|
||||||
|
vec4 blended = mix( color, replacedColor, parameters.amount * replaceAmount );
|
||||||
|
// blended = vec4( replaceAmount, replaceAmount, replaceAmount, 1.0 );
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, blended );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://bkeu321cfhd1y"
|
||||||
|
path="res://.godot/imported/ReplaceColor.glsl-299dcd7071f443b0d26fe49c0c67fccc.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Color/ReplaceColor/ReplaceColor.glsl"
|
||||||
|
dest_files=["res://.godot/imported/ReplaceColor.glsl-299dcd7071f443b0d26fe49c0c67fccc.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_Sepia:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Color/Sepia/Sepia.glsl" );
|
||||||
|
|
||||||
|
public RG_Sepia( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cg18sqym0g4os
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
#[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 amount;
|
||||||
|
float hue;
|
||||||
|
float saturationOverride;
|
||||||
|
float saturationAmount;
|
||||||
|
|
||||||
|
} parameters;
|
||||||
|
|
||||||
|
|
||||||
|
vec3 RGBtoHSL( vec3 c )
|
||||||
|
{
|
||||||
|
float h = 0.0;
|
||||||
|
float s = 0.0;
|
||||||
|
float l = 0.0;
|
||||||
|
|
||||||
|
float cmin = min( min( c.r, c.g ), c.b );
|
||||||
|
float cmax = max( max( c.r, c.g ), c.b );
|
||||||
|
|
||||||
|
l = ( cmin + cmax ) / 2.0;
|
||||||
|
|
||||||
|
if ( cmin == cmax )
|
||||||
|
{
|
||||||
|
s = 0.0;
|
||||||
|
h = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float delta = cmax - cmin;
|
||||||
|
|
||||||
|
s = ( l <= 0.5 ) ? ( delta / ( cmax + cmin ) ) : ( delta / ( 2.0 - ( cmax + cmin ) ) );
|
||||||
|
|
||||||
|
h = 0.0;
|
||||||
|
|
||||||
|
if ( c.r == cmax )
|
||||||
|
{
|
||||||
|
h = ( c.g - c.b ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.g == cmax )
|
||||||
|
{
|
||||||
|
h = 2.0 + ( c.b - c.r ) / delta;
|
||||||
|
}
|
||||||
|
else if ( c.b == cmax )
|
||||||
|
{
|
||||||
|
h = 4.0 + ( c.r - c.g ) / delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = h / 6.0;
|
||||||
|
|
||||||
|
if ( h > 1.0 )
|
||||||
|
{
|
||||||
|
h -= 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3( h, s, l );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hueToRGB( float hue )
|
||||||
|
{
|
||||||
|
float R = abs( hue * 6.0 - 3.0 ) - 1.0;
|
||||||
|
float G = 2.0 - abs( hue * 6.0 - 2.0 );
|
||||||
|
float B = 2.0 - abs( hue * 6.0 - 4.0 );
|
||||||
|
return clamp( vec3( R,G,B ), 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 HSLtoRGB( vec3 hsl )
|
||||||
|
{
|
||||||
|
if ( hsl.y == 0.0 )
|
||||||
|
{
|
||||||
|
return vec3( hsl.z, hsl.z, hsl.z );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 rgb = hueToRGB( hsl.x );
|
||||||
|
float C = ( 1.0 - abs( 2.0 * hsl.z - 1.0 )) * hsl.y;
|
||||||
|
return ( rgb - 0.5 ) * C + hsl.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
vec4 color = imageLoad( inputImage, ivec2( uv * size ) );
|
||||||
|
|
||||||
|
float scaler = max( max( max( color.r, color.g ), color.b ), 1.0 );
|
||||||
|
|
||||||
|
vec3 hsl = RGBtoHSL( color.rgb / scaler );
|
||||||
|
|
||||||
|
hsl.x = parameters.hue;
|
||||||
|
hsl.y = mix( hsl.y, parameters.saturationOverride, parameters.saturationAmount );
|
||||||
|
|
||||||
|
vec3 rgb = HSLtoRGB( hsl ) * scaler;
|
||||||
|
|
||||||
|
vec4 sepiaColor = vec4( rgb, 1.0 );
|
||||||
|
|
||||||
|
|
||||||
|
vec4 blended = mix( color, sepiaColor, parameters.amount );
|
||||||
|
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, blended );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://f108ocsg57wx"
|
||||||
|
path="res://.godot/imported/Sepia.glsl-f73d9003bf68ddf4b6920a6e59a092b0.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Color/Sepia/Sepia.glsl"
|
||||||
|
dest_files=["res://.godot/imported/Sepia.glsl-f73d9003bf68ddf4b6920a6e59a092b0.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b54gtivmiiprf
|
||||||
|
|
@ -0,0 +1,253 @@
|
||||||
|
#[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 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
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( rgba16f, set = 0, binding = 0 )
|
||||||
|
uniform image2D inputImage;
|
||||||
|
|
||||||
|
layout( rgba16f, set = 1, binding = 0 )
|
||||||
|
uniform image2D outputImage;
|
||||||
|
|
||||||
|
// layout( rgba16f, set = 2, binding = 0 )
|
||||||
|
// uniform image2D noiseImage;
|
||||||
|
|
||||||
|
layout( push_constant, std430 )
|
||||||
|
uniform Parameters
|
||||||
|
{
|
||||||
|
vec4 ellipse; // x,y, sx,sy
|
||||||
|
|
||||||
|
float distortionAmount;
|
||||||
|
float blendAmount;
|
||||||
|
float minDistance;
|
||||||
|
float redScale;
|
||||||
|
|
||||||
|
float greenScale;
|
||||||
|
float blueScale;
|
||||||
|
float steps;
|
||||||
|
float smear;
|
||||||
|
|
||||||
|
float rings;
|
||||||
|
float ratio;
|
||||||
|
float ringsIntensity;
|
||||||
|
float ringsDistribution;
|
||||||
|
|
||||||
|
float ringsType;
|
||||||
|
float p0;
|
||||||
|
float p1;
|
||||||
|
float p2;
|
||||||
|
|
||||||
|
} 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 = imageLoad( inputImage, ivec2( rUV * size ) );
|
||||||
|
vec4 colorG = imageLoad( inputImage, ivec2( gUV * size ) );
|
||||||
|
vec4 colorB = imageLoad( inputImage, ivec2( bUV * size ) );
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
float triangle( float value )
|
||||||
|
{
|
||||||
|
float inverted = 1.0 - value;
|
||||||
|
|
||||||
|
return min( value, inverted ) * 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ringFunction( float value, float roundness )
|
||||||
|
{
|
||||||
|
float t = triangle( mod( value, 1.0 ) );
|
||||||
|
float c = 0.5 - 0.5 * cos( 6.28318531 * value );
|
||||||
|
|
||||||
|
return clamp( mix( t, c, roundness ), 0.0, 1.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
// vec2 ratio = vec2( size ) / min( size.x, size.y );
|
||||||
|
vec2 ellipseCenter = vec2( parameters.ellipse.x, parameters.ellipse.y );
|
||||||
|
vec2 ellipseSize = vec2( parameters.ellipse.z, parameters.ellipse.w );
|
||||||
|
|
||||||
|
if ( parameters.ratio > 0.5 )
|
||||||
|
{
|
||||||
|
float aspect = float( size.x ) / float( size.y );
|
||||||
|
|
||||||
|
ellipseSize.y *= aspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 dir = ellipseCenter - uv;
|
||||||
|
|
||||||
|
vec2 scaledDir = dir;
|
||||||
|
scaledDir.x /= ellipseSize.x;
|
||||||
|
scaledDir.y /= ellipseSize.y;
|
||||||
|
|
||||||
|
float dist = length( scaledDir );
|
||||||
|
float amount = 1.0 - clamp( dist - parameters.minDistance, 0.0, 1.0 );
|
||||||
|
|
||||||
|
float simpleAmount = amount;
|
||||||
|
amount = ringFunction( pow( amount, parameters.ringsDistribution ) * parameters.rings, parameters.ringsType );
|
||||||
|
|
||||||
|
if ( parameters.ringsIntensity < 0.0 )
|
||||||
|
{
|
||||||
|
amount = mix( amount * ( 1.0 - simpleAmount ), amount, 1.0 + parameters.ringsIntensity );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
amount = mix( amount, amount * simpleAmount, parameters.ringsIntensity );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec2 uvOffset = normalize( dir ) * amount;
|
||||||
|
vec3 distortion = vec3( parameters.redScale, parameters.greenScale, parameters.blueScale ) * parameters.distortionAmount;
|
||||||
|
|
||||||
|
int stepsI = min( 10, int( parameters.steps ) );
|
||||||
|
|
||||||
|
vec4 originalColor = imageLoad( inputImage, texel_coord );
|
||||||
|
vec4 color = originalColor;
|
||||||
|
|
||||||
|
if ( stepsI <= 1 )
|
||||||
|
{
|
||||||
|
vec2 rUV = uv + uvOffset * distortion.r;
|
||||||
|
rUV = mirrorUV( rUV );
|
||||||
|
|
||||||
|
vec2 gUV = uv + uvOffset * distortion.g;
|
||||||
|
gUV = mirrorUV( gUV );
|
||||||
|
|
||||||
|
vec2 bUV = uv + uvOffset * distortion.b;
|
||||||
|
bUV = mirrorUV( bUV );
|
||||||
|
|
||||||
|
vec4 colorR = imageLoad( inputImage, ivec2( rUV * size ) );
|
||||||
|
vec4 colorG = imageLoad( inputImage, ivec2( gUV * size ) );
|
||||||
|
vec4 colorB = imageLoad( inputImage, ivec2( bUV * size ) );
|
||||||
|
|
||||||
|
color = vec4( colorR.r, colorG.g, colorB.b, colorG.a );
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color = sampleChromatic( uv, uvOffset, size, stepsI, distortion, parameters.smear );
|
||||||
|
}
|
||||||
|
|
||||||
|
color = mix( originalColor, color, parameters.blendAmount );
|
||||||
|
imageStore( outputImage, texel_coord, color );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://b1212vgxla2l5"
|
||||||
|
path="res://.godot/imported/EllipseDistortion.glsl-87ebf88b7bcd782ac275b8ebbbf1f32d.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Distortion/EllipseDistortion/EllipseDistortion.glsl"
|
||||||
|
dest_files=["res://.godot/imported/EllipseDistortion.glsl-87ebf88b7bcd782ac275b8ebbbf1f32d.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_EllipseDistortion:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Distortion/EllipseDistortion/EllipseDistortion.glsl" );
|
||||||
|
|
||||||
|
public RG_EllipseDistortion( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://nt4qosqs3xmo
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
#[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 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
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( rgba16f, set = 0, binding = 0 )
|
||||||
|
uniform image2D inputImage;
|
||||||
|
|
||||||
|
layout( rgba16f, set = 1, binding = 0 )
|
||||||
|
uniform image2D outputImage;
|
||||||
|
|
||||||
|
// layout( rgba16f, set = 2, binding = 0 )
|
||||||
|
// uniform image2D noiseImage;
|
||||||
|
|
||||||
|
layout( push_constant, std430 )
|
||||||
|
uniform Parameters
|
||||||
|
{
|
||||||
|
vec4 noiseSeed;
|
||||||
|
float distortionAmount;
|
||||||
|
float noiseScale;
|
||||||
|
float redScale;
|
||||||
|
float greenScale;
|
||||||
|
float blueScale;
|
||||||
|
float steps;
|
||||||
|
float smear;
|
||||||
|
float p2;
|
||||||
|
|
||||||
|
} 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 = imageLoad( inputImage, ivec2( rUV * size ) );
|
||||||
|
vec4 colorG = imageLoad( inputImage, ivec2( gUV * size ) );
|
||||||
|
vec4 colorB = imageLoad( inputImage, ivec2( bUV * size ) );
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
|
||||||
|
|
||||||
|
vec2 ratio = vec2( size ) / min( size.x, size.y );
|
||||||
|
|
||||||
|
float noiseX = perlin( uv * parameters.noiseScale * ratio + vec2( parameters.noiseSeed.x, parameters.noiseSeed.y ) );
|
||||||
|
float noiseY = perlin( uv * parameters.noiseScale * ratio + vec2( parameters.noiseSeed.z, parameters.noiseSeed.w ) );
|
||||||
|
|
||||||
|
vec2 uvNoise = vec2( noiseX, noiseY ) * 2.0 - vec2( 1.0 );
|
||||||
|
|
||||||
|
int stepsI = min( 5, int( parameters.steps ) );
|
||||||
|
|
||||||
|
vec3 distortion = vec3( parameters.redScale, parameters.greenScale, parameters.blueScale ) * parameters.distortionAmount;
|
||||||
|
|
||||||
|
if ( stepsI <= 1 )
|
||||||
|
{
|
||||||
|
vec2 rUV = uv + uvNoise * distortion.r;
|
||||||
|
rUV = mirrorUV( rUV );
|
||||||
|
|
||||||
|
vec2 gUV = uv + uvNoise * distortion.g;
|
||||||
|
gUV = mirrorUV( gUV );
|
||||||
|
|
||||||
|
vec2 bUV = uv + uvNoise * distortion.b;
|
||||||
|
bUV = mirrorUV( bUV );
|
||||||
|
|
||||||
|
vec4 colorR = imageLoad( inputImage, ivec2( rUV * size ) );
|
||||||
|
vec4 colorG = imageLoad( inputImage, ivec2( gUV * size ) );
|
||||||
|
vec4 colorB = imageLoad( inputImage, ivec2( bUV * size ) );
|
||||||
|
|
||||||
|
vec4 color = vec4( colorR.r, colorG.g, colorB.b, colorG.a );
|
||||||
|
|
||||||
|
imageStore( outputImage, texel_coord, color );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vec4 chromatic = sampleChromatic( uv, uvNoise, size, stepsI, distortion, parameters.smear );
|
||||||
|
imageStore( outputImage, texel_coord, chromatic );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://bofphutm1n3lj"
|
||||||
|
path="res://.godot/imported/NoiseDistortion.glsl-d65b5f741f820cc23f4e7aa17b63beb1.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Distortion/NoiseDistortion/NoiseDistortion.glsl"
|
||||||
|
dest_files=["res://.godot/imported/NoiseDistortion.glsl-d65b5f741f820cc23f4e7aa17b63beb1.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_NoiseDistortion:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Distortion/NoiseDistortion/NoiseDistortion.glsl" );
|
||||||
|
|
||||||
|
public RG_NoiseDistortion( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://edkh3455qjly
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_ScanLines:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Distortion/ScanLines/ScanLines.glsl" );
|
||||||
|
|
||||||
|
public RG_ScanLines( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bpncud2w4lj3o
|
||||||
|
|
@ -0,0 +1,225 @@
|
||||||
|
#[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 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
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( rgba16f, set = 0, binding = 0 )
|
||||||
|
uniform image2D inputImage;
|
||||||
|
|
||||||
|
layout( rgba16f, set = 1, binding = 0 )
|
||||||
|
uniform image2D outputImage;
|
||||||
|
|
||||||
|
// layout( rgba16f, set = 2, binding = 0 )
|
||||||
|
// uniform image2D noiseImage;
|
||||||
|
|
||||||
|
layout( push_constant, std430 )
|
||||||
|
uniform Parameters
|
||||||
|
{
|
||||||
|
vec4 scanlineTintTop;
|
||||||
|
vec4 scanlineTintBottom;
|
||||||
|
vec4 pad0;
|
||||||
|
vec4 pad1;
|
||||||
|
|
||||||
|
float amount;
|
||||||
|
float scanlineHeight;
|
||||||
|
float rgbTintAmount;
|
||||||
|
float rgbOffsetLineHeight;
|
||||||
|
|
||||||
|
float rgbSizeMultiplier;
|
||||||
|
float useRGBOffset;
|
||||||
|
float jitterOffset;
|
||||||
|
float p2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} 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 = imageLoad( inputImage, ivec2( rUV * size ) );
|
||||||
|
vec4 colorG = imageLoad( inputImage, ivec2( gUV * size ) );
|
||||||
|
vec4 colorB = imageLoad( inputImage, ivec2( bUV * size ) );
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
float mirrorValue( float x, float base )
|
||||||
|
{
|
||||||
|
float t = mod( x, 2.0 * base );
|
||||||
|
return ( t <= 1.0 * base ) ? t : 2.0 * base - t;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 mirrorUV( vec2 uv, vec2 size )
|
||||||
|
{
|
||||||
|
return vec2( mirrorValue( uv.x, size.x ), mirrorValue( uv.y, size.y ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( texel_coord, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 jitterTexel = gl_GlobalInvocationID.xy + vec2( 0.0, parameters.jitterOffset );
|
||||||
|
jitterTexel = mirrorUV( jitterTexel, size );
|
||||||
|
|
||||||
|
vec2 uv = ( vec2( texel_coord ) + 0.5 + vec2( 0.0, parameters.jitterOffset ) ) / vec2( size );
|
||||||
|
|
||||||
|
|
||||||
|
int scanLineHeight = int( parameters.scanlineHeight );
|
||||||
|
// scanLineHeight = 20;
|
||||||
|
int scanLineIndex = texel_coord.y / scanLineHeight;
|
||||||
|
int lineType = scanLineIndex % 2;
|
||||||
|
float scanMix = float( lineType );
|
||||||
|
|
||||||
|
|
||||||
|
int rgbSizeMultiplier = int( parameters.rgbSizeMultiplier );
|
||||||
|
int rgbLineHeight = int( parameters.rgbOffsetLineHeight );
|
||||||
|
int rgbLineIndex = texel_coord.y / rgbLineHeight;
|
||||||
|
int rgbLineType = rgbLineIndex % 2;
|
||||||
|
int useRGBLineOffsets = ( parameters.useRGBOffset > 0.5 ) ? 1 : 0;
|
||||||
|
int lineTypeOffset = ( ( rgbSizeMultiplier * 3 ) / 2 ) * rgbLineType * useRGBLineOffsets;
|
||||||
|
|
||||||
|
int rgbIndex = ( ( texel_coord.x + lineTypeOffset ) % ( rgbSizeMultiplier * 3 ) ) / rgbSizeMultiplier;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vec4 tintColor = mix( parameters.scanlineTintTop, parameters.scanlineTintBottom, scanMix );
|
||||||
|
vec4 rTint = vec4( 1.0, 0.0, 0.0, 1.0 );
|
||||||
|
vec4 gTint = vec4( 0.0, 1.0, 0.0, 1.0 );
|
||||||
|
vec4 bTint = vec4( 0.0, 0.0, 1.0, 1.0 );
|
||||||
|
vec4 noTint = vec4( 1.0, 1.0, 1.0, 1.0 );
|
||||||
|
|
||||||
|
vec4 rgbTint = rgbIndex == 0 ? rTint : rgbIndex == 1 ? gTint : bTint;
|
||||||
|
rgbTint = mix( noTint, rgbTint, parameters.rgbTintAmount );
|
||||||
|
|
||||||
|
tintColor *= rgbTint;
|
||||||
|
|
||||||
|
|
||||||
|
// vec2 uvOffset = normalize( dir ) * amount;
|
||||||
|
// vec3 distortion = vec3( parameters.redScale, parameters.greenScale, parameters.blueScale ) * parameters.distortionAmount;
|
||||||
|
|
||||||
|
// int stepsI = min( 10, int( parameters.steps ) );
|
||||||
|
|
||||||
|
vec4 originalColor = imageLoad( inputImage, ivec2( texel_coord ) );
|
||||||
|
vec4 color = imageLoad( inputImage, ivec2( jitterTexel ) ) * tintColor;
|
||||||
|
|
||||||
|
// color = sampleChromatic( uv, uvOffset, size, stepsI, distortion, parameters.smear );
|
||||||
|
|
||||||
|
color = mix( originalColor, color, parameters.amount );
|
||||||
|
imageStore( outputImage, texel_coord, color );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://d4jddifyjhrtj"
|
||||||
|
path="res://.godot/imported/ScanLines.glsl-d4442328b795066fd693e1241ef6b0f8.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Distortion/ScanLines/ScanLines.glsl"
|
||||||
|
dest_files=["res://.godot/imported/ScanLines.glsl-d4442328b795066fd693e1241ef6b0f8.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
#[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 amount;
|
||||||
|
|
||||||
|
float k00;
|
||||||
|
float k01;
|
||||||
|
float k02;
|
||||||
|
|
||||||
|
float k10;
|
||||||
|
float k11;
|
||||||
|
float k12;
|
||||||
|
|
||||||
|
float k20;
|
||||||
|
float k21;
|
||||||
|
float k22;
|
||||||
|
|
||||||
|
float kernelOffset;
|
||||||
|
|
||||||
|
float clampValues;
|
||||||
|
|
||||||
|
} parameters;
|
||||||
|
|
||||||
|
vec4 getPixel( ivec2 pixelUV, int x, int y, int kernelOffset, ivec2 size )
|
||||||
|
{
|
||||||
|
ivec2 xy = ivec2( x, y ) * kernelOffset;
|
||||||
|
ivec2 kernelUV = pixelUV + xy;
|
||||||
|
|
||||||
|
kernelUV.x = clamp( kernelUV.x, 0, size.x - 1 );
|
||||||
|
kernelUV.y = clamp( kernelUV.y, 0, size.y - 1 );
|
||||||
|
|
||||||
|
return imageLoad( inputImage, kernelUV );
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( )
|
||||||
|
{
|
||||||
|
ivec2 size = imageSize( inputImage );
|
||||||
|
ivec2 pixelUV = ivec2( gl_GlobalInvocationID.xy );
|
||||||
|
|
||||||
|
if ( any( greaterThanEqual( pixelUV, size ) ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 color = vec4( 0.0 );
|
||||||
|
|
||||||
|
int kernelOffsetInt = int( parameters.kernelOffset );
|
||||||
|
|
||||||
|
color += parameters.k00 * getPixel( pixelUV, -1, -1, kernelOffsetInt, size );
|
||||||
|
color += parameters.k01 * getPixel( pixelUV, -1, 0, kernelOffsetInt, size );
|
||||||
|
color += parameters.k02 * getPixel( pixelUV, -1, 1, kernelOffsetInt, size );
|
||||||
|
|
||||||
|
color += parameters.k10 * getPixel( pixelUV, 0, -1, kernelOffsetInt, size );
|
||||||
|
color += parameters.k11 * getPixel( pixelUV, 0, 0, kernelOffsetInt, size );
|
||||||
|
color += parameters.k12 * getPixel( pixelUV, 0, 1, kernelOffsetInt, size );
|
||||||
|
|
||||||
|
color += parameters.k20 * getPixel( pixelUV, 1, -1, kernelOffsetInt, size );
|
||||||
|
color += parameters.k21 * getPixel( pixelUV, 1, 0, kernelOffsetInt, size );
|
||||||
|
color += parameters.k22 * getPixel( pixelUV, 1, 1, kernelOffsetInt, size );
|
||||||
|
|
||||||
|
if ( parameters.clampValues > 0.5 )
|
||||||
|
{
|
||||||
|
color = clamp( color, 0.0, 1.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 originalColor = imageLoad( inputImage, pixelUV );
|
||||||
|
|
||||||
|
vec4 mixedColor = mix( originalColor, color, parameters.amount );
|
||||||
|
|
||||||
|
imageStore( outputImage, pixelUV, mixedColor );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="glsl"
|
||||||
|
type="RDShaderFile"
|
||||||
|
uid="uid://of7kmaig5kx8"
|
||||||
|
path="res://.godot/imported/Kernel3.glsl-af00fc9c65ae98562facfc2cc048d423.res"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Kernels/Kernel3/Kernel3.glsl"
|
||||||
|
dest_files=["res://.godot/imported/Kernel3.glsl-af00fc9c65ae98562facfc2cc048d423.res"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Rokojori
|
||||||
|
{
|
||||||
|
public class RG_Kernel3:CEG_ImageProcessor
|
||||||
|
{
|
||||||
|
public static readonly string shaderPath =
|
||||||
|
RDGraph.Path( "Nodes/Processors/Kernels/Kernel3/Kernel3.glsl" );
|
||||||
|
|
||||||
|
public RG_Kernel3( RDGraph graph ):base( graph, shaderPath )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b38a30q5as67r
|
||||||
|
|
@ -122,6 +122,48 @@ float sdSegment( in vec2 p, in vec2 a, in vec2 b )
|
||||||
return length( pa - ba*h );
|
return length( pa - ba*h );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float sdEllipse( in vec2 p, in vec2 ab )
|
||||||
|
{
|
||||||
|
p = abs(p);
|
||||||
|
|
||||||
|
if( p.x > p.y )
|
||||||
|
{
|
||||||
|
p=p.yx;ab=ab.yx;
|
||||||
|
}
|
||||||
|
|
||||||
|
float l = ab.y*ab.y - ab.x*ab.x;
|
||||||
|
float m = ab.x*p.x/l; float m2 = m*m;
|
||||||
|
float n = ab.y*p.y/l; float n2 = n*n;
|
||||||
|
float c = (m2+n2-1.0)/3.0; float c3 = c*c*c;
|
||||||
|
float q = c3 + m2*n2*2.0;
|
||||||
|
float d = c3 + m2*n2;
|
||||||
|
float g = m + m*n2;
|
||||||
|
float co;
|
||||||
|
|
||||||
|
if( d < 0.0 )
|
||||||
|
{
|
||||||
|
float h = acos(q/c3)/3.0;
|
||||||
|
float s = cos(h);
|
||||||
|
float t = sin(h)*sqrt(3.0);
|
||||||
|
float rx = sqrt( -c*(s + t + 2.0) + m2 );
|
||||||
|
float ry = sqrt( -c*(s - t + 2.0) + m2 );
|
||||||
|
co = (ry+sign(l)*rx+abs(g)/(rx*ry)- m)/2.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float h = 2.0*m*n*sqrt( d );
|
||||||
|
float s = sign(q+h)*pow(abs(q+h), 1.0/3.0);
|
||||||
|
float u = sign(q-h)*pow(abs(q-h), 1.0/3.0);
|
||||||
|
float rx = -s - u - c*4.0 + 2.0*m2;
|
||||||
|
float ry = (s - u)*sqrt(3.0);
|
||||||
|
float rm = sqrt( rx*rx + ry*ry );
|
||||||
|
co = (ry/sqrt(rm-rx)+2.0*g/rm-m)/2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 r = ab * vec2(co, sqrt(1.0-co*co));
|
||||||
|
return length(r-p) * sign(p.y-r.y);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
TAKEN FROM
|
TAKEN FROM
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue