mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 14:36:13 +01:00
1.17.1
This commit is contained in:
parent
37d6676dbc
commit
7f8a171325
3 changed files with 63 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
|||
function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _group) constructor {
|
||||
name = "Extra Perlins";
|
||||
name = "Extra Perlins";
|
||||
shader = sh_perlin_extra;
|
||||
|
||||
inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
|
@ -14,7 +14,7 @@ function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
|
|||
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2);
|
||||
addShaderProp(SHADER_UNIFORM.integer, "iteration");
|
||||
|
||||
inputs[| 4] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
inputs[| 4] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Tiling only works with integer scale, and some effect type doesn't support tiling.");
|
||||
addShaderProp(SHADER_UNIFORM.integer, "tile");
|
||||
|
||||
inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999));
|
||||
|
@ -37,21 +37,25 @@ function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
|
|||
addShaderProp(SHADER_UNIFORM.float, "colorRanB");
|
||||
|
||||
inputs[| 10] = nodeValue("Noise type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Absolute worley", "Fluid", "Noisy perlin", "Camo" ]);
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Absolute worley", "Fluid", "Noisy", "Camo", "Blocky", "Max", "Vine" ]);
|
||||
addShaderProp(SHADER_UNIFORM.integer, "type");
|
||||
|
||||
inputs[| 11] = nodeValue("Parameter A", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
addShaderProp(SHADER_UNIFORM.float, "param");
|
||||
addShaderProp(SHADER_UNIFORM.float, "paramA");
|
||||
|
||||
inputs[| 12] = nodeValue("Parameter B", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
|
||||
addShaderProp(SHADER_UNIFORM.float, "paramB");
|
||||
|
||||
input_display_list = [
|
||||
["Output", true], 0, 5,
|
||||
["Noise", false], 10, 1, 2, 3, 4, 11,
|
||||
["Noise", false], 10, 1, 2, 3, 4, 11, 12,
|
||||
["Render", false], 6, 7, 8, 9,
|
||||
];
|
||||
|
||||
static step = function() { #region
|
||||
var _col = getInputData(6);
|
||||
var _typ = getInputData(10);
|
||||
|
||||
inputs[| 7].setVisible(_col != 0);
|
||||
inputs[| 8].setVisible(_col != 0);
|
||||
|
@ -60,6 +64,9 @@ function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
|
|||
inputs[| 7].name = _col == 1? "Color R range" : "Color H range";
|
||||
inputs[| 8].name = _col == 1? "Color G range" : "Color S range";
|
||||
inputs[| 9].name = _col == 1? "Color B range" : "Color V range";
|
||||
|
||||
inputs[| 11].setVisible(_typ > 0);
|
||||
inputs[| 12].setVisible(false);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
|
|
|
@ -84,7 +84,7 @@ function Panel_Patreon() : PanelContent() constructor {
|
|||
var _y = (_yy + h) / 2;
|
||||
|
||||
draw_set_text(f_p0, fa_center, fa_bottom, COLORS._main_value_positive);
|
||||
draw_text(w / 2, _y - 16, "Patreon verified, thank you for supporting Pixel Composer.");
|
||||
draw_text(w / 2, _y - 16, "Patreon verified, thank you for supporting Pixel Composer.\nRestart to enable extra contents.");
|
||||
|
||||
var _bw = 200;
|
||||
var _bh = TEXTBOX_HEIGHT + ui(8);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//
|
||||
// Simple passthrough fragment shader
|
||||
//
|
||||
#define TAU 6.28318530718
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
|
@ -11,9 +10,11 @@ uniform vec2 u_resolution;
|
|||
uniform vec2 scale;
|
||||
uniform int iteration;
|
||||
uniform float seed;
|
||||
uniform float param;
|
||||
uniform int tile;
|
||||
|
||||
uniform float paramA;
|
||||
uniform float paramB;
|
||||
|
||||
uniform int colored;
|
||||
uniform vec2 colorRanR;
|
||||
uniform vec2 colorRanG;
|
||||
|
@ -34,6 +35,16 @@ float randomFloat (in vec2 st, float seed) { #region
|
|||
return mix(random(st, sedSt), random(st, sedSt + 1.), sedFr);
|
||||
} #endregion
|
||||
|
||||
float smooth(in float n, in float itr) { #region
|
||||
float _fr = fract(itr);
|
||||
float _itr = floor(itr);
|
||||
|
||||
for(float i = 0.; i < _itr; i++)
|
||||
n = n * n * (3.0 - 2.0 * n);
|
||||
float _n1 = n * n * (3.0 - 2.0 * n);
|
||||
return mix(n, _n1, _fr);
|
||||
} #endregion
|
||||
|
||||
vec2 random2 (in vec2 st, float seed) { return vec2(randomFloat(st, seed), randomFloat(st, seed + 1.864354564)); }
|
||||
|
||||
float noise (in vec2 st, in vec2 scale) { #region
|
||||
|
@ -47,6 +58,10 @@ float noise (in vec2 st, in vec2 scale) { #region
|
|||
|
||||
vec2 f = fract(st);
|
||||
vec2 u = f * f * (3.0 - 2.0 * f);
|
||||
if(type == 4) {
|
||||
u.x = smooth(f.x, 2. + paramA * 4.);
|
||||
u.y = smooth(f.y, 2. + paramA * 4.);
|
||||
}
|
||||
|
||||
float a = 0., b = 0., c = 0., d = 0.;
|
||||
|
||||
|
@ -57,7 +72,7 @@ float noise (in vec2 st, in vec2 scale) { #region
|
|||
d = dot( random2(vec2(cellMax.x, cellMax.y) * 2. - 1., seed), f - vec2(1., 1.) );
|
||||
|
||||
return abs(mix(mix(a, b, u.x), mix(c, d, u.x), u.y));
|
||||
} else if(type == 1 || type == 2 || type == 3) {
|
||||
} else {
|
||||
a = randomFloat(vec2(cellMin.x, cellMin.y), seed);
|
||||
b = randomFloat(vec2(cellMax.x, cellMin.y), seed);
|
||||
c = randomFloat(vec2(cellMin.x, cellMax.y), seed);
|
||||
|
@ -71,7 +86,7 @@ float noise (in vec2 st, in vec2 scale) { #region
|
|||
return 0.;
|
||||
} #endregion
|
||||
|
||||
float perlin(in vec2 st) { #region
|
||||
float _perlin(in vec2 st) { #region
|
||||
float amp = pow(2., float(iteration) - 1.) / (pow(2., float(iteration)) - 1.);
|
||||
if(type == 0) amp = pow(2., float(iteration) + 1.) / (pow(2., float(iteration)) - 1.);
|
||||
if(type == 3) amp *= 1.25;
|
||||
|
@ -89,7 +104,7 @@ float perlin(in vec2 st) { #region
|
|||
if(type == 3) {
|
||||
m += _n * amp;
|
||||
if(mod(i, 3.) == 2.) {
|
||||
n += smoothstep(0.5 - param, 0.5 + param, m) * amp;
|
||||
n += smoothstep(0.5 - paramA, 0.5 + paramA, m) * amp;
|
||||
m = 0.;
|
||||
|
||||
sc /= 1.5;
|
||||
|
@ -100,30 +115,51 @@ float perlin(in vec2 st) { #region
|
|||
amp *= .75;
|
||||
pos *= 1.5;
|
||||
}
|
||||
} else if(type == 4) {
|
||||
n += smooth(_n, 1. + paramA * 5. * i / it) * amp;
|
||||
} else if(type == 5) {
|
||||
n = max(n, _n);
|
||||
sc *= 1. + paramA * 0.1;
|
||||
pos *= 1. + paramA * 0.1;
|
||||
} else
|
||||
n += _n * amp;
|
||||
|
||||
pos += random2(vec2(float(i)), 0.574186) * sc;
|
||||
|
||||
if(type == 0) {
|
||||
if(type == 1) {
|
||||
sc *= 2.;
|
||||
amp *= .5;
|
||||
pos *= 2.;
|
||||
} else if(type == 1) {
|
||||
sc *= 2.;
|
||||
amp *= .5;
|
||||
pos *= 1. + _n + param;
|
||||
pos *= 1. + _n + paramA;
|
||||
} else if(type == 2) {
|
||||
sc *= 2.;
|
||||
amp *= .5;
|
||||
pos += random2(vec2(n), seed) / sc;
|
||||
pos *= (2. + param);
|
||||
pos *= (2. + paramA);
|
||||
} else if(type == 3) {
|
||||
} else if(type == 5) {
|
||||
} else {
|
||||
sc *= 2.;
|
||||
amp *= .5;
|
||||
pos *= 2.;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return n;
|
||||
} #endregion
|
||||
|
||||
float perlin(in vec2 st) { #region
|
||||
if(type == 6) {
|
||||
float p1 = _perlin(st - vec2(1., 0.) / scale * (1. + paramA));
|
||||
float p2 = _perlin(st - vec2(0., 1.) / scale * (1. + paramA));
|
||||
float p3 = _perlin(st - vec2(-1., 0.) / scale * (1. + paramA));
|
||||
float p4 = _perlin(st - vec2(0., -1.) / scale * (1. + paramA));
|
||||
return abs(p1 - p3) + abs(p2 - p4);
|
||||
}
|
||||
|
||||
return _perlin(st);
|
||||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
if(colored == 0) {
|
||||
vec2 pos = (v_vTexcoord + position) * scale;
|
||||
|
|
Loading…
Reference in a new issue