Material work

This commit is contained in:
Lubos Lenco 2016-03-08 14:45:22 +01:00
parent 51adf1ef1c
commit 8098ae931d
6 changed files with 12 additions and 13 deletions

View file

@ -22,7 +22,7 @@ bl_info = {
"name": "Armory format (.json)",
"description": "Armory Exporter",
"author": "Eric Lengyel, Armory by Lubos Lenco",
"version": (16, 2, 0, 0),
"version": (1, 0, 0),
"location": "File > Import-Export",
"wiki_url": "http://lue3d.org/",
"category": "Import-Export"}
@ -2198,9 +2198,9 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
return tex
def parse_material_surface(self, material, c, defs, tree, node):
if node.type == 'GROUP' and node.node_tree.name == 'CG PBR':
if node.type == 'GROUP' and node.node_tree.name == 'PBR':
# Albedo Map
albedo_input = node.inputs[1]
albedo_input = node.inputs[0]
if albedo_input.is_linked:
albedo_node = self.findNodeByLink(tree, node, albedo_input)
if albedo_node.type == 'TEX_IMAGE':
@ -2226,10 +2226,10 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
col = metalness_input.default_value
const = Object()
const.id = "metalness"
const.float = col[0]
const.float = col
c.bind_constants.append(const)
# Roughness Map
roughness_input = node.inputs[5]
roughness_input = node.inputs[2]
if roughness_input.is_linked:
defs.append('_RMTex')
roughness_node = self.findNodeByLink(tree, node, roughness_input)
@ -2239,18 +2239,18 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
col = roughness_input.default_value
const = Object()
const.id = "roughness"
const.float = col[0]
const.float = col
c.bind_constants.append(const)
# Normal Map
normal_input = node.inputs[2]
normal_input = node.inputs[4]
if normal_input.is_linked:
defs.append('_NMTex')
normal_node = self.findNodeByLink(tree, node, normal_input)
tex = self.make_texture('snormal', normal_node)
c.bind_textures.append(tex)
# Occlusion Map
occlusion_input = node.inputs[0]
occlusion_input = node.inputs[1]
if occlusion_input.is_linked:
defs.append('_OMTex')
occlusion_node = self.findNodeByLink(tree, node, occlusion_input)

Binary file not shown.

View file

@ -205,14 +205,14 @@ def load_library():
data_path = output[:-8] + "blender/data/data.blend" # Remove 'Sources/' from haxelib path
with bpy.data.libraries.load(data_path, link=False) as (data_from, data_to):
data_to.node_groups = ['forward_pipeline', 'forward_pipeline_noshadow', 'deferred_pipeline', 'CG PBR']
data_to.node_groups = ['forward_pipeline', 'forward_pipeline_noshadow', 'deferred_pipeline', 'PBR']
# TODO: cannot use for loop
# TODO: import pbr group separately, no need for fake user
bpy.data.node_groups['forward_pipeline'].use_fake_user = True
bpy.data.node_groups['forward_pipeline_noshadow'].use_fake_user = True
bpy.data.node_groups['deferred_pipeline'].use_fake_user = True
bpy.data.node_groups['CG PBR'].use_fake_user = True
bpy.data.node_groups['PBR'].use_fake_user = True
def register():
bpy.utils.register_module(__name__)

View file

@ -5,7 +5,7 @@ bl_info = {
"category": "Game Engine",
"description": "3D Game Engine built for Cycles",
"author": "Lubos Lenco",
"version": (16, 3, 0, 0),
"version": (1, 0, 0),
"wiki_url": "http://cyclesgame.org/"
}

View file

@ -17,7 +17,7 @@ from armory import ArmoryExporter
def defaultSettings():
wrd = bpy.data.worlds[0]
wrd['CGVersion'] = "16.1.0"
wrd['CGVersion'] = "16.3.0"
wrd['CGProjectTarget'] = 0
wrd['CGProjectName'] = "cycles_game"
wrd['CGProjectPackage'] = "game"

View file

@ -193,7 +193,6 @@ void main() {
#ifdef _NMTex
vec3 n = (texture(snormal, texCoord).rgb * 2.0 - 1.0);
n = normalize(TBN * normalize(n));
n = vec3(0.0, 0.0, 1.0);
#else
vec3 n = normalize(normal);
#endif