Skip to content

Commit

Permalink
Add height texture
Browse files Browse the repository at this point in the history
Has added height texture into shader.
  • Loading branch information
chri11g6 committed Jul 20, 2019
1 parent 65459d2 commit 257a95d
Showing 1 changed file with 40 additions and 12 deletions.
52 changes: 40 additions & 12 deletions dks_sp.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def execute(self, context):
_file_Roughness = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Roughness',_texture_ext)
_file_ORM = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'OcclusionRoughnessMetallic',_texture_ext)

_file_Height = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Height',_texture_ext)
_file_Normal = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Normal_OpenGL',_texture_ext)

if _file_Normal=="":
Expand Down Expand Up @@ -330,19 +331,46 @@ def execute(self, context):
node.image = bpy.data.images.load(_file_Roughness)
node.image.colorspace_settings.name = 'Non-Color'

# Normal
# Height
if _file_Height:

node_Bump=_nodes.new('ShaderNodeBump')
node_Bump.location = 250,-770
node_Bump.name='dks_pbr_Bump'
_material_links.new(node_Bump.outputs['Normal'], node_shader.inputs['Normal'])

node_map=_nodes.new('ShaderNodeNormalMap')
node_map.location = -20,-1050
node_map.name='dks_pbr_normal_map'
_material_links.new(node_map.outputs['Normal'], node_Bump.inputs['Normal'])

node=_nodes.new('ShaderNodeTexImage')
node.location = -360,-1080
node.name='dks_pbr_texture_normal'
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
node.image = bpy.data.images.load(_file_Normal)
node.image.colorspace_settings.name = 'Non-Color'

node_map=_nodes.new('ShaderNodeNormalMap')
node_map.location = 200,-700
node_map.name='dks_pbr_normal_map'
_material_links.new(node_map.outputs['Normal'], node_shader.inputs['Normal'])

node=_nodes.new('ShaderNodeTexImage')
node.location = -100,-750
node.name='dks_pbr_texture_normal'
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
node.image = bpy.data.images.load(_file_Normal)
node.image.colorspace_settings.name = 'Non-Color'
node=_nodes.new('ShaderNodeTexImage')
node.location = -360,-770
node.name='dks_pbr_texture_Height'
_material_links.new(node.outputs['Color'], node_Bump.inputs['Height'])
node.image = bpy.data.images.load(_file_Height)
node.image.colorspace_settings.name = 'Non-Color'

else:
# Normal
node_map=_nodes.new('ShaderNodeNormalMap')
node_map.location = 200,-700
node_map.name='dks_pbr_normal_map'
_material_links.new(node_map.outputs['Normal'], node_shader.inputs['Normal'])

node=_nodes.new('ShaderNodeTexImage')
node.location = -100,-750
node.name='dks_pbr_texture_normal'
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
node.image = bpy.data.images.load(_file_Normal)
node.image.colorspace_settings.name = 'Non-Color'

return {'FINISHED'}

Expand Down

0 comments on commit 257a95d

Please sign in to comment.