Begin material nodes update

This commit is contained in:
luboslenco
2021-02-01 20:36:14 +01:00
parent 7e85f8d4fa
commit ebb58cd662
3 changed files with 48 additions and 39 deletions
@@ -491,14 +491,6 @@ class MaterialParser {
if (sample_bump) write_bump(node, res);
return res;
}
else if (node.type == "TEX_MUSGRAVE") {
curshader.add_function(ShaderFunctions.str_tex_musgrave);
var co = getCoord(node);
var scale = parse_value_input(node.inputs[1]);
var res = to_vec3('tex_musgrave_f($co * $scale * 0.5)');
if (sample_bump) write_bump(node, res);
return res;
}
else if (node.type == "TEX_NOISE") {
curshader.add_function(ShaderFunctions.str_tex_noise);
var co = getCoord(node);
@@ -823,8 +815,13 @@ class MaterialParser {
}
}
else if (node.type == "OBJECT_INFO") {
curshader.wposition = true;
return "wposition";
if (socket == node.outputs[0]) { // Location
curshader.wposition = true;
return "wposition";
}
else if (socket == node.outputs[1]) { // Color
return "vec3(0.0, 0.0, 0.0)";
}
}
// else if (node.type == "PARTICLE_INFO") {
// if (socket == node.outputs[3]) { // Location
@@ -919,10 +916,10 @@ class MaterialParser {
return res;
}
else if (node.type == "MAPPING") {
var node_translation = parse_vector_input(node.inputs[0]);
var node_rotation = parse_vector_input(node.inputs[1]);
var node_scale = parse_vector_input(node.inputs[2]);
var out = parse_vector_input(node.inputs[3]);
var out = parse_vector_input(node.inputs[0]);
var node_translation = parse_vector_input(node.inputs[1]);
var node_rotation = parse_vector_input(node.inputs[2]);
var node_scale = parse_vector_input(node.inputs[3]);
if (node_scale != 'vec3(1, 1, 1)') {
out = '($out * $node_scale)';
}
@@ -1186,6 +1183,9 @@ class MaterialParser {
else if (socket == node.outputs[7]) { // Pointiness
return "0.0";
}
else if (socket == node.outputs[8]) { // Random Per Island
return "0.0";
}
}
else if (node.type == "HAIR_INFO") {
return "0.5";
@@ -204,6 +204,14 @@ class NodesMaterial {
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.0
},
{
id: 0,
node_id: 0,
name: _tr("Random Per Island"),
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.0
}
],
buttons: []
@@ -479,6 +487,14 @@ class NodesMaterial {
color: 0xff6363c7,
default_value: f32([0.0, 0.0, 0.0])
},
{
id: 0,
node_id: 0,
name: _tr("Color"),
type: "RGBA",
color: 0xffc7c729,
default_value: f32([0.0, 0.0, 0.0, 1.0])
},
{
id: 0,
node_id: 0,
@@ -690,7 +706,7 @@ class NodesMaterial {
},
{
id: 0,
name: _tr("Texture Coord"),
name: _tr("Texture Coordinate"),
type: "TEX_COORD",
x: 0,
y: 0,
@@ -927,7 +943,7 @@ class NodesMaterial {
{
id: 0,
node_id: 0,
name: _tr("Color 3"),
name: _tr("Mortar"),
type: "RGBA",
color: 0xffc7c729,
default_value: f32([0.0, 0.0, 0.0])
@@ -1251,15 +1267,7 @@ class NodesMaterial {
{
id: 0,
node_id: 0,
name: _tr("Color"),
type: "RGBA",
color: 0xffc7c729,
default_value: f32([0.8, 0.8, 0.8, 1.0])
},
{
id: 0,
node_id: 0,
name: _tr("Fac"),
name: _tr("Height"),
type: "VALUE",
color: 0xffa1a1a1,
default_value: 1.0
@@ -1506,7 +1514,7 @@ class NodesMaterial {
},
{
id: 0,
name: _tr("BrightContrast"),
name: _tr("Bright/Contrast"),
type: "BRIGHTCONTRAST",
x: 0,
y: 0,
@@ -1588,7 +1596,7 @@ class NodesMaterial {
},
{
id: 0,
name: _tr("HueSatVal"),
name: _tr("Hue/Saturation"),
type: "HUE_SAT",
x: 0,
y: 0,
@@ -1605,7 +1613,7 @@ class NodesMaterial {
{
id: 0,
node_id: 0,
name: _tr("Sat"),
name: _tr("Saturation"),
type: "VALUE",
color: 0xffa1a1a1,
default_value: 1.0
@@ -1613,7 +1621,7 @@ class NodesMaterial {
{
id: 0,
node_id: 0,
name: _tr("Val"),
name: _tr("Value"),
type: "VALUE",
color: 0xffa1a1a1,
default_value: 1.0
@@ -1669,7 +1677,7 @@ class NodesMaterial {
name: _tr("Color"),
type: "RGBA",
color: 0xffc7c729,
default_value: f32([0.8, 0.8, 0.8, 1.0])
default_value: f32([0.0, 0.0, 0.0, 1.0])
}
],
outputs: [
@@ -1807,6 +1815,14 @@ class NodesMaterial {
y: 0,
color: 0xff522c99,
inputs: [
{
id: 0,
node_id: 0,
name: _tr("Vector"),
type: "VECTOR",
color: 0xff6363c7,
default_value: f32([0.0, 0.0, 0.0])
},
{
id: 0,
node_id: 0,
@@ -1834,14 +1850,6 @@ class NodesMaterial {
color: 0xff6363c7,
default_value: f32([1.0, 1.0, 1.0]),
display: 1
},
{
id: 0,
node_id: 0,
name: _tr("Vector"),
type: "VECTOR",
color: 0xff6363c7,
default_value: f32([0.0, 0.0, 0.0])
}
],
outputs: [