Skip to content

Commit 0f8d171

Browse files
authored
Merge pull request #5 from chri11g6/master
Add Height map
2 parents 65459d2 + 1cd1edd commit 0f8d171

1 file changed

Lines changed: 52 additions & 18 deletions

File tree

dks_sp.py

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def execute(self, context):
117117
_file_Roughness = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Roughness',_texture_ext)
118118
_file_ORM = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'OcclusionRoughnessMetallic',_texture_ext)
119119

120+
_file_Height = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Height',_texture_ext)
120121
_file_Normal = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Normal_OpenGL',_texture_ext)
121122

122123
if _file_Normal=="":
@@ -148,7 +149,7 @@ def execute(self, context):
148149
_material_output = _nodes.new('ShaderNodeOutputMaterial')
149150

150151
if not _file_Emissive:
151-
_material_output.location = 600,0
152+
_material_output.location = 800,0
152153
else:
153154
_material_output.location = 1600,0
154155

@@ -241,7 +242,7 @@ def execute(self, context):
241242
# Base Color
242243

243244
node=_nodes.new('ShaderNodeTexImage')
244-
node.location = 0,250
245+
node.location = -140,261
245246
node.name='dks_pbr_texture_base_color'
246247
_material_links.new(node.outputs['Color'], node_mix.inputs['Color1'])
247248

@@ -255,7 +256,7 @@ def execute(self, context):
255256
# Ambient Occlusion
256257

257258
node=_nodes.new('ShaderNodeTexImage')
258-
node.location = 0,0
259+
node.location = -140,0
259260
node.name='dks_pbr_texture_ao'
260261
_material_links.new(node.outputs['Color'], node_mix.inputs['Color2'])
261262
node.image = bpy.data.images.load(_file_Ambient_occlusion)
@@ -293,7 +294,7 @@ def execute(self, context):
293294
if _file_Specular:
294295

295296
node=_nodes.new('ShaderNodeTexImage')
296-
node.location = 0,-250
297+
node.location = -280,-180
297298
node.name='dks_pbr_texture_Specular'
298299
_material_links.new(node.outputs['Color'], node_shader.inputs['Specular'])
299300
node.image = bpy.data.images.load(_file_Specular)
@@ -303,7 +304,7 @@ def execute(self, context):
303304
# Roughness Invert
304305

305306
node_invert=_nodes.new('ShaderNodeInvert')
306-
node_invert.location = 200,-450
307+
node_invert.location = 100,-520
307308
node_invert.name='dks_pbr_invert'
308309
_material_links.new(node_invert.outputs['Color'], node_shader.inputs['Roughness'])
309310

@@ -312,7 +313,7 @@ def execute(self, context):
312313
if _file_Roughness!="":
313314

314315
node=_nodes.new('ShaderNodeTexImage')
315-
node.location = 0,-500
316+
node.location = -280,-520
316317
node.name='dks_pbr_texture_roughness'
317318
_material_links.new(node.outputs['Color'], node_invert.inputs['Color'])
318319
node.image = bpy.data.images.load(_file_Glossiness)
@@ -330,19 +331,52 @@ def execute(self, context):
330331
node.image = bpy.data.images.load(_file_Roughness)
331332
node.image.colorspace_settings.name = 'Non-Color'
332333

333-
# Normal
334+
# Height
335+
if _file_Height:
336+
337+
frame_1= _nodes.new('NodeFrame')
338+
frame_1.location = -390, -837
339+
frame_1.width = 802
340+
frame_1.height = 628
341+
frame_1.label = 'Normal and Height'
342+
343+
node_Bump=_nodes.new('ShaderNodeBump')
344+
node_Bump.location = 250,-870
345+
node_Bump.name='dks_pbr_Bump'
346+
_material_links.new(node_Bump.outputs['Normal'], node_shader.inputs['Normal'])
347+
348+
node_map=_nodes.new('ShaderNodeNormalMap')
349+
node_map.location = -20,-1150
350+
node_map.name='dks_pbr_normal_map'
351+
_material_links.new(node_map.outputs['Normal'], node_Bump.inputs['Normal'])
352+
353+
node=_nodes.new('ShaderNodeTexImage')
354+
node.location = -360,-1180
355+
node.name='dks_pbr_texture_normal'
356+
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
357+
node.image = bpy.data.images.load(_file_Normal)
358+
node.image.colorspace_settings.name = 'Non-Color'
334359

335-
node_map=_nodes.new('ShaderNodeNormalMap')
336-
node_map.location = 200,-700
337-
node_map.name='dks_pbr_normal_map'
338-
_material_links.new(node_map.outputs['Normal'], node_shader.inputs['Normal'])
339-
340-
node=_nodes.new('ShaderNodeTexImage')
341-
node.location = -100,-750
342-
node.name='dks_pbr_texture_normal'
343-
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
344-
node.image = bpy.data.images.load(_file_Normal)
345-
node.image.colorspace_settings.name = 'Non-Color'
360+
node=_nodes.new('ShaderNodeTexImage')
361+
node.location = -360,-870
362+
node.name='dks_pbr_texture_Height'
363+
_material_links.new(node.outputs['Color'], node_Bump.inputs['Height'])
364+
node.image = bpy.data.images.load(_file_Height)
365+
node.image.colorspace_settings.name = 'Non-Color'
366+
367+
else:
368+
# Normal
369+
node_map=_nodes.new('ShaderNodeNormalMap')
370+
node_map.location = 200,-700
371+
node_map.name='dks_pbr_normal_map'
372+
_material_links.new(node_map.outputs['Normal'], node_shader.inputs['Normal'])
373+
374+
node=_nodes.new('ShaderNodeTexImage')
375+
node.location = -100,-750
376+
node.name='dks_pbr_texture_normal'
377+
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
378+
node.image = bpy.data.images.load(_file_Normal)
379+
node.image.colorspace_settings.name = 'Non-Color'
346380

347381
return {'FINISHED'}
348382

0 commit comments

Comments
 (0)