Material fixes

This commit is contained in:
Phillip Stephens 2015-09-19 13:36:46 -07:00
parent ea2c5b9722
commit 3acddce766
2 changed files with 40 additions and 12 deletions

View File

@ -567,9 +567,17 @@ def make_pass_tran():
grp_out = new_grp.nodes.new('NodeGroupOutput') grp_out = new_grp.nodes.new('NodeGroupOutput')
grp_out.location = (0, 0) grp_out.location = (0, 0)
# Multiply
mul1 = new_grp.nodes.new('ShaderNodeMath')
mul1.operation = 'MULTIPLY'
mul1.inputs[0].default_value = 1.0
mul1.location = (-400, 0)
# Links # Links
new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0]) new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0])
new_grp.links.new(grp_in.outputs[2], grp_out.inputs[1]) new_grp.links.new(grp_in.outputs[1], mul1.inputs[0])
new_grp.links.new(grp_in.outputs[2], mul1.inputs[1])
new_grp.links.new(mul1.outputs[0], grp_out.inputs[1])
# Opacity Map Inverted # Opacity Map Inverted
def make_pass_tran_inv(): def make_pass_tran_inv():
@ -590,16 +598,23 @@ def make_pass_tran_inv():
grp_out = new_grp.nodes.new('NodeGroupOutput') grp_out = new_grp.nodes.new('NodeGroupOutput')
grp_out.location = (0, 0) grp_out.location = (0, 0)
# Subtract # Multiply
sub1 = new_grp.nodes.new('ShaderNodeMath') mul1 = new_grp.nodes.new('ShaderNodeMath')
sub1.operation = 'SUBTRACT' mul1.operation = 'MULTIPLY'
sub1.inputs[0].default_value = 1.0 mul1.inputs[0].default_value = 1.0
sub1.location = (-400, 0) mul1.location = (-400, 0)
# Invert
inv1 = new_grp.nodes.new('ShaderNodeInvert')
inv1.inputs[0].default_value = 1.0
inv1.location = (-600, 0)
# Links # Links
new_grp.links.new(grp_in.outputs[0], sub1.inputs[1]) new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0])
new_grp.links.new(sub1.outputs[0], grp_out.inputs[0]) new_grp.links.new(grp_in.outputs[1], mul1.inputs[1])
new_grp.links.new(grp_in.outputs[2], grp_out.inputs[1]) new_grp.links.new(grp_in.outputs[2], inv1.inputs[1])
new_grp.links.new(inv1.outputs[0], mul1.inputs[0])
new_grp.links.new(mul1.outputs[0], grp_out.inputs[1])
# Incandescence Map # Incandescence Map
def make_pass_inca(): def make_pass_inca():

View File

@ -89,6 +89,8 @@ void MaterialSet::ConstructMaterial(Stream& out,
for (const Material::SectionFactory& factory : material.sections) for (const Material::SectionFactory& factory : material.sections)
{ {
factory.section->constructNode(out, pakRouter, entry, prevSection, i++, texMapIdx, texMtxIdx, kColorIdx); factory.section->constructNode(out, pakRouter, entry, prevSection, i++, texMapIdx, texMtxIdx, kColorIdx);
Material::SectionPASS* pass = dynamic_cast<Material::SectionPASS*>(factory.section.get());
if (!pass || (pass && pass->subtype.toUint32() != Material::SectionPASS::RFLV))
prevSection = factory.section.get(); prevSection = factory.section.get();
} }
@ -161,21 +163,32 @@ void Material::SectionPASS::constructNode(HECL::BlenderConnection::PyOutStream&
{ {
case DIFF: case DIFF:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassDIFF']\n"; out << "pnode.node_tree = bpy.data.node_groups['RetroPassDIFF']\n";
linkRAS = true;
break; break;
case RIML: case RIML:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassRIML']\n"; out << "pnode.node_tree = bpy.data.node_groups['RetroPassRIML']\n";
if (idx == 0)
linkRAS = true;
break; break;
case BLOL: case BLOL:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassBLOL']\n"; out << "pnode.node_tree = bpy.data.node_groups['RetroPassBLOL']\n";
if (idx == 0)
linkRAS = true;
break; break;
case BLOD: case BLOD:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassBLOD']\n"; out << "pnode.node_tree = bpy.data.node_groups['RetroPassBLOD']\n";
if (idx == 0)
linkRAS = true;
break; break;
case CLR: case CLR:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassCLR']\n"; out << "pnode.node_tree = bpy.data.node_groups['RetroPassCLR']\n";
if (idx == 0)
linkRAS = true; linkRAS = true;
break; break;
case TRAN: case TRAN:
if (flags.TRANInvert())
out << "pnode.node_tree = bpy.data.node_groups['RetroPassTRANInv']\n";
else
out << "pnode.node_tree = bpy.data.node_groups['RetroPassTRAN']\n"; out << "pnode.node_tree = bpy.data.node_groups['RetroPassTRAN']\n";
break; break;
case INCA: case INCA: