Skip to content

Commit

Permalink
Merge pull request #3105 from 1k8/main
Browse files Browse the repository at this point in the history
Support for the sheen shader and the musgrave texture that moved into the noise texture type
  • Loading branch information
luboslenco authored Dec 19, 2024
2 parents 048e415 + 3383c25 commit e084bef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions armory/blender/arm/material/cycles.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def parse_shader(node: bpy.types.Node, socket: bpy.types.NodeSocket) -> Tuple[st
'BSDF_PRINCIPLED',
'BSDF_DIFFUSE',
'BSDF_GLOSSY',
'BSDF_SHEEN',
'AMBIENT_OCCLUSION',
'BSDF_ANISOTROPIC',
'EMISSION',
Expand Down
6 changes: 6 additions & 0 deletions armory/blender/arm/material/cycles_nodes/nodes_shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ def parse_bsdfdiffuse(node: bpy.types.ShaderNodeBsdfDiffuse, out_socket: NodeSoc
state.out_roughness = c.parse_value_input(node.inputs[1])
state.out_specular = '0.0'

if bpy.app.version >= (4, 0, 0):
def parse_bsdfsheen(node: bpy.types.ShaderNodeBsdfSheen, out_socket: NodeSocket, state: ParserState) -> None:
if state.parse_surface:
c.write_normal(node.inputs[2])
state.out_basecol = c.parse_vector_input(node.inputs[0])
state.out_roughness = c.parse_value_input(node.inputs[1])

if bpy.app.version < (4, 1, 0):
def parse_bsdfglossy(node: bpy.types.ShaderNodeBsdfGlossy, out_socket: NodeSocket, state: ParserState) -> None:
Expand Down
6 changes: 5 additions & 1 deletion armory/blender/arm/material/cycles_nodes/nodes_texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ def parse_tex_noise(node: bpy.types.ShaderNodeTexNoise, out_socket: bpy.types.No
# Fac
else:
res = 'tex_noise({0} * {1},{2},{3})'.format(co, scale, detail, distortion)

if bpy.app.version >= (4, 1, 0):
# Needs a switch for the new set of types for noise where the musgrave was moved
if node.noise_type == "FBM"
state.curshader.add_function(c_functions.str_tex_musgrave)
res = f'tex_musgrave_f({co} * {scale} * 1.0)'
return res


Expand Down
4 changes: 3 additions & 1 deletion armory/blender/arm/material/node_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ class MaterialNodeMeta:
if bpy.app.version < (4, 1, 0):
ALL_NODES['BSDF_VELVET'] = MaterialNodeMeta(parse_func=nodes_shader.parse_bsdfvelvet)
ALL_NODES['TEX_MUSGRAVE'] = MaterialNodeMeta(parse_func=nodes_texture.parse_tex_musgrave)

if bpy.app.version >= (4, 0, 0):
ALL_NODES['BSDF_SHEEN'] = MaterialNodeMeta(parse_func=nodes_shader.parse_bsdfsheen)

ALL_NODES['BSDF_GLOSSY'] = MaterialNodeMeta(parse_func=nodes_shader.parse_bsdfglossy)

def get_node_meta(node: bpy.types.Node) -> MaterialNodeMeta:
Expand Down

0 comments on commit e084bef

Please sign in to comment.