Begin blur node

This commit is contained in:
luboslenco
2019-11-22 06:46:16 +01:00
parent 7cee89c641
commit ab80a17c3a
2 changed files with 52 additions and 0 deletions
+15
View File
@@ -598,12 +598,27 @@ class Material {
curshader.add_function(MaterialFunctions.str_brightcontrast);
return 'brightcontrast($out_col, $bright, $contr)';
}
else if (node.type == 'GAMMA') {
var out_col = parse_vector_input(node.inputs[0]);
var gamma = parse_value_input(node.inputs[1]);
return 'pow($out_col, ' + to_vec3('$gamma') + ')';
}
else if (node.type == 'BLUR') {
var out_col = parse_vector_input(node.inputs[0]);
var strength = parse_value_input(node.inputs[1]);
curshader.write('vec3 res1 = vec3(0, 0, 0);');
curshader.write('for (int i = -6; i <= 6; ++i) {');
curshader.write('for (int j = -6; j <= 6; ++j) {');
curshader.write('texCoord += vec2(i, j) / 100;');
curshader.write('res1 += $out_col;');
curshader.write('}');
curshader.write('}');
curshader.write('res1 /= 13 * 13;');
return 'res1';
}
else if (node.type == 'HUE_SAT') {
curshader.add_function(MaterialFunctions.str_hue_sat);
var hue = parse_value_input(node.inputs[0]);
+37
View File
@@ -1196,6 +1196,43 @@ class NodesMaterial {
],
buttons: []
},
{
id: 0,
name: "Blur",
type: "BLUR", // extension
x: 0,
y: 0,
color: 0xff448c6d,
inputs: [
{
id: 0,
node_id: 0,
name: "Color",
type: "RGBA",
color: 0xffc7c729,
default_value: [0.8, 0.8, 0.8, 1.0]
},
{
id: 0,
node_id: 0,
name: "Strength",
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.5
}
],
outputs: [
{
id: 0,
node_id: 0,
name: "Color",
type: "RGBA",
color: 0xffc7c729,
default_value: [0.8, 0.8, 0.8, 1.0]
}
],
buttons: []
},
{
id: 0,
name: "HueSatVal",