New approach for node setups, and more competent skin mat
Posted: Thu Jul 04, 2019 9:58 am
Having grown increasingly frustrated with the complexity of the material setup for the importer in the makehuman plugin for blender (MPFB), I've rewritten large parts of it to instead use json templates to setup node groups. This is currently how the default definition file looks:
This will produce this node setup (for Punkduck's sport bra) :
(thanks btw Aranuvir, for doing away with the ugly transparency/mix node setup... this approach is much cleaner)
While being at it, I have also started working on a more competent skin node setup. The added benefit of having rewritten the material setup to use json files, is that I can now simply provide a separate json file for this setup, rather than rewriting the code:
This will create a node group with convenience inputs:
Which internally currently looks like this:
In the longer run I plan on adding support for a generated bump map for skin pores etc, but for now it at least makes it easy to vary skin tone and shininess of imported characters even when they come from the same skin material.
Downside is that I pretty much assume this won't work in blender 2.79, it's 2.80 only.
For now all these changes reside in a feature branch: https://github.com/makehumancommunity/m ... node_setup, but unless someone points out an obvious flaw, I'll probably merge this to master soon.
- Code: Select all
{
"groups": {
},
"nodes" : {
"output": {
"type": "ShaderNodeOutputMaterial",
"label": "Material output",
"location": [350, 100],
"group": "",
"values": {},
"create": true
},
"principled": {
"type": "ShaderNodeBsdfPrincipled",
"label": "Principled",
"location": [0, 100],
"group": "",
"values": {
"Base Color": [0.8, 0.8, 0.8, 1.0]
},
"create": true
},
"diffuseTexture": {
"type": "ShaderNodeTexImage",
"label": "diffuseTexture",
"location": [-400, 100],
"group": "",
"values": {},
"imageData": {
"path": "",
"colorspace_settings_name": "sRGB"
},
"create": false
},
"normalMapTexture": {
"type": "ShaderNodeTexImage",
"label": "normal map texture",
"location": [-600, -500],
"group": "",
"values": {},
"imageData": {
"path": "",
"colorspace_settings_name": "Non-Color"
},
"create": false
},
"bumpMapTexture": {
"type": "ShaderNodeTexImage",
"label": "normal map texture",
"location": [-600, -200],
"group": "",
"values": {},
"imageData": {
"path": "",
"colorspace_settings_name": "Non-Color"
},
"create": false
},
"bumpOrNormal": {
"type": "ShaderNodeNormalMap",
"label": "normal map",
"location": [-300, -300],
"group": "",
"values": {
"Strength": 1.0
},
"create": false
},
"bumpAndNormal": {
"type": "ShaderNodeNormalMap",
"label": "normal map",
"location": [-300, -300],
"group": "",
"values": {
"Strength": 1.0
},
"create": false
},
"bumpMap": {
"type": "ShaderNodeBump",
"label": "bump map",
"location": [-100, -300],
"group": "",
"values": {
"Strength": 0.5
},
"create": false
}
},
"connections" : [
{
"outputNode": "principled",
"outputSocket": "BSDF",
"inputNode": "output",
"inputSocket": "Surface"
},
{
"outputNode": "diffuseTexture",
"outputSocket": "Color",
"inputNode": "principled",
"inputSocket": "Base Color"
},
{
"outputNode": "diffuseTexture",
"outputSocket": "Alpha",
"inputNode": "principled",
"inputSocket": "Alpha"
},
{
"outputNode": "normalMapTexture",
"outputSocket": "Color",
"inputNode": "bumpOrNormal",
"inputSocket": "Color"
},
{
"outputNode": "normalMapTexture",
"outputSocket": "Color",
"inputNode": "bumpAndNormal",
"inputSocket": "Color"
},
{
"outputNode": "bumpOrNormal",
"outputSocket": "Normal",
"inputNode": "principled",
"inputSocket": "Normal"
},
{
"outputNode": "bumpMapTexture",
"outputSocket": "Color",
"inputNode": "bumpMap",
"inputSocket": "Height"
},
{
"outputNode": "bumpAndNormal",
"outputSocket": "Normal",
"inputNode": "bumpMap",
"inputSocket": "Normal"
},
{
"outputNode": "bumpMap",
"outputSocket": "Normal",
"inputNode": "principled",
"inputSocket": "Normal"
}
]
}
This will produce this node setup (for Punkduck's sport bra) :
(thanks btw Aranuvir, for doing away with the ugly transparency/mix node setup... this approach is much cleaner)
While being at it, I have also started working on a more competent skin node setup. The added benefit of having rewritten the material setup to use json files, is that I can now simply provide a separate json file for this setup, rather than rewriting the code:
- Code: Select all
{
"groups": {
"skinGroup": {
"label": "Skin",
"inputs": {
"colorMixIn": {
"type": "NodeSocketColor",
"value": [1.0, 0.2, 0.2, 1.0]
},
"colorMixInStrength": {
"type": "NodeSocketFloat",
"value": 0.05
},
"Roughness": {
"type": "NodeSocketFloat",
"value": 0.5
},
"Brightness": {
"type": "NodeSocketFloat",
"value": 0.0
},
"Contrast": {
"type": "NodeSocketFloat",
"value": 0.0
},
"Clearcoat": {
"type": "NodeSocketFloat",
"value": 0.2
},
"Clearcoat Roughness": {
"type": "NodeSocketFloat",
"value": 0.3
}
},
"outputs": {
"shaderOutput": {
"type": "NodeSocketShader"
}
},
"location": [0, 100],
"create": true
}
},
"nodes" : {
"skinGroupInputs": {
"type": "NodeGroupInput",
"label": "Skin input",
"location": [-800, -100],
"group": "skinGroup",
"values": {},
"create": true
},
"skinGroupOutputs": {
"type": "NodeGroupOutput",
"label": "Skin output",
"location": [600, 100],
"group": "skinGroup",
"values": {},
"create": true
},
"output": {
"type": "ShaderNodeOutputMaterial",
"label": "Material output",
"location": [350, 100],
"group": "",
"values": {},
"create": true
},
"principled": {
"type": "ShaderNodeBsdfPrincipled",
"label": "Principled",
"location": [0, 100],
"group": "skinGroup",
"values": {
"Base Color": [0.8, 0.8, 0.8, 1.0]
},
"create": true
},
"diffuseTexture": {
"type": "ShaderNodeTexImage",
"label": "diffuseTexture",
"location": [-800, 300],
"group": "skinGroup",
"values": {},
"imageData": {
"path": "",
"colorspace_settings_name": "sRGB"
},
"create": false
},
"normalMapTexture": {
"type": "ShaderNodeTexImage",
"label": "normal map texture",
"location": [-600, -500],
"group": "skinGroup",
"values": {},
"imageData": {
"path": "",
"colorspace_settings_name": "Non-Color"
},
"create": false
},
"bumpMapTexture": {
"type": "ShaderNodeTexImage",
"label": "normal map texture",
"location": [-600, -200],
"group": "skinGroup",
"values": {},
"imageData": {
"path": "",
"colorspace_settings_name": "Non-Color"
},
"create": false
},
"bumpOrNormal": {
"type": "ShaderNodeNormalMap",
"label": "normal map",
"location": [-300, -300],
"group": "skinGroup",
"values": {
"Strength": 1.0
},
"create": false
},
"bumpAndNormal": {
"type": "ShaderNodeNormalMap",
"label": "normal map",
"location": [-300, -300],
"group": "skinGroup",
"values": {
"Strength": 1.0
},
"create": false
},
"bumpMap": {
"type": "ShaderNodeBump",
"label": "bump map",
"location": [-100, -300],
"group": "skinGroup",
"values": {},
"create": false
},
"colorMix": {
"type": "ShaderNodeMixRGB",
"label": "Color mix",
"location": [-500, 200],
"group": "skinGroup",
"values": {},
"create": true
},
"brightContrast": {
"type": "ShaderNodeBrightContrast",
"label": "Brightness and Contrast",
"location": [-300, 100],
"group": "skinGroup",
"values": {},
"create": true
}
},
"connections" : [
{
"outputNode": "principled",
"outputSocket": "BSDF",
"inputNode": "skinGroupOutputs",
"inputSocket": "shaderOutput"
},
{
"outputNode": "skinGroup",
"outputSocket": "shaderOutput",
"inputNode": "output",
"inputSocket": "Surface"
},
{
"outputNode": "diffuseTexture",
"outputSocket": "Color",
"inputNode": "colorMix",
"inputSocket": "Color1"
},
{
"outputNode": "skinGroupInputs",
"outputSocket": "colorMixIn",
"inputNode": "colorMix",
"inputSocket": "Color2"
},
{
"outputNode": "skinGroupInputs",
"outputSocket": "colorMixInStrength",
"inputNode": "colorMix",
"inputSocket": "Fac"
},
{
"outputNode": "colorMix",
"outputSocket": "Color",
"inputNode": "brightContrast",
"inputSocket": "Color"
},
{
"outputNode": "brightContrast",
"outputSocket": "Color",
"inputNode": "principled",
"inputSocket": "Base Color"
},
{
"outputNode": "skinGroupInputs",
"outputSocket": "Brightness",
"inputNode": "brightContrast",
"inputSocket": "Bright"
},
{
"outputNode": "skinGroupInputs",
"outputSocket": "Contrast",
"inputNode": "brightContrast",
"inputSocket": "Contrast"
},
{
"outputNode": "skinGroupInputs",
"outputSocket": "Roughness",
"inputNode": "principled",
"inputSocket": "Roughness"
},
{
"outputNode": "skinGroupInputs",
"outputSocket": "Clearcoat Roughness",
"inputNode": "principled",
"inputSocket": "Clearcoat Roughness"
},
{
"outputNode": "skinGroupInputs",
"outputSocket": "Clearcoat",
"inputNode": "principled",
"inputSocket": "Clearcoat"
},
{
"outputNode": "diffuseTexture",
"outputSocket": "Alpha",
"inputNode": "principled",
"inputSocket": "Alpha"
},
{
"outputNode": "normalMapTexture",
"outputSocket": "Color",
"inputNode": "bumpOrNormal",
"inputSocket": "Color"
},
{
"outputNode": "bumpOrNormal",
"outputSocket": "Normal",
"inputNode": "principled",
"inputSocket": "Normal"
}
]
}
This will create a node group with convenience inputs:
Which internally currently looks like this:
In the longer run I plan on adding support for a generated bump map for skin pores etc, but for now it at least makes it easy to vary skin tone and shininess of imported characters even when they come from the same skin material.
Downside is that I pretty much assume this won't work in blender 2.79, it's 2.80 only.
For now all these changes reside in a feature branch: https://github.com/makehumancommunity/m ... node_setup, but unless someone points out an obvious flaw, I'll probably merge this to master soon.