Skip to content

Commit

Permalink
shader graph : add dissolve node
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoVgr committed Jan 18, 2024
1 parent 3a58083 commit 75a73e4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions hrt/shgraph/nodes/Dissolve.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package hrt.shgraph.nodes;

using hxsl.Ast;

@name("Dissolve")
@description("Dissolve input")
@width(150)
@group("Math")
class Dissolve extends ShaderNodeHxsl {

static var SRC = {
@sginput(1.0) var channel : Float;
@sginput(1.0) var progress : Float;
@sginput(0.0) var saturation : Float;
@sginput(1.0) var width : Float;
@sgoutput var output : Float;

function fragment() {
var edge = mix(1.0 + width, -width, progress);
var ramp = saturate((1.0 + saturation) * (width - abs(edge - channel)) / width);
output = channel * ramp;
}
};
}

0 comments on commit 75a73e4

Please sign in to comment.