Skip to content

Commit 257a95d

Browse files
committed
Add height texture
Has added height texture into shader.
1 parent 65459d2 commit 257a95d

1 file changed

Lines changed: 40 additions & 12 deletions

File tree

dks_sp.py

Lines changed: 40 additions & 12 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=="":
@@ -330,19 +331,46 @@ 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+
node_Bump=_nodes.new('ShaderNodeBump')
338+
node_Bump.location = 250,-770
339+
node_Bump.name='dks_pbr_Bump'
340+
_material_links.new(node_Bump.outputs['Normal'], node_shader.inputs['Normal'])
341+
342+
node_map=_nodes.new('ShaderNodeNormalMap')
343+
node_map.location = -20,-1050
344+
node_map.name='dks_pbr_normal_map'
345+
_material_links.new(node_map.outputs['Normal'], node_Bump.inputs['Normal'])
346+
347+
node=_nodes.new('ShaderNodeTexImage')
348+
node.location = -360,-1080
349+
node.name='dks_pbr_texture_normal'
350+
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
351+
node.image = bpy.data.images.load(_file_Normal)
352+
node.image.colorspace_settings.name = 'Non-Color'
334353

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'
354+
node=_nodes.new('ShaderNodeTexImage')
355+
node.location = -360,-770
356+
node.name='dks_pbr_texture_Height'
357+
_material_links.new(node.outputs['Color'], node_Bump.inputs['Height'])
358+
node.image = bpy.data.images.load(_file_Height)
359+
node.image.colorspace_settings.name = 'Non-Color'
360+
361+
else:
362+
# Normal
363+
node_map=_nodes.new('ShaderNodeNormalMap')
364+
node_map.location = 200,-700
365+
node_map.name='dks_pbr_normal_map'
366+
_material_links.new(node_map.outputs['Normal'], node_shader.inputs['Normal'])
367+
368+
node=_nodes.new('ShaderNodeTexImage')
369+
node.location = -100,-750
370+
node.name='dks_pbr_texture_normal'
371+
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
372+
node.image = bpy.data.images.load(_file_Normal)
373+
node.image.colorspace_settings.name = 'Non-Color'
346374

347375
return {'FINISHED'}
348376

0 commit comments

Comments
 (0)