예제 #1
0
def disp_linked(output_node):
    # Armory PBR with unlinked height socket 
    if output_node.inputs[2].is_linked:
        l = output_node.inputs[2].links[0]
        if l.from_node.type == 'GROUP' and l.from_node.node_tree.name.startswith('Armory PBR') and l.from_node.inputs[10].is_linked == False:
            return False
    return armutils.tess_enabled(state.target) and output_node.inputs[2].is_linked
예제 #2
0
def parse_output(node, _vert, _frag, _geom, _tesc, _tese, _parse_surface,
                 _parse_opacity, parse_displacement):
    global parsed  # Compute nodes only once
    global parents
    global normal_written  # Normal socket is linked on shader node - overwrite fs normal
    global curshader  # Active shader - frag for surface / tese for displacement
    global vert
    global frag
    global geom
    global tesc
    global tese
    global parse_surface
    global parse_opacity
    global parsing_basecol
    global parse_teximage_vector
    vert = _vert
    frag = _frag
    geom = _geom
    tesc = _tesc
    tese = _tese
    parse_surface = _parse_surface
    parse_opacity = _parse_opacity
    parsing_basecol = False
    parse_teximage_vector = True

    # Surface
    if parse_surface or parse_opacity:
        parsed = []
        parents = []
        normal_written = False
        curshader = frag

        out_basecol, out_roughness, out_metallic, out_occlusion, out_opacity = parse_shader_input(
            node.inputs[0])
        if parse_surface:
            frag.write('basecol = {0};'.format(out_basecol))
            frag.write('roughness = {0};'.format(out_roughness))
            frag.write('metallic = {0};'.format(out_metallic))
            frag.write('occlusion = {0};'.format(out_occlusion))
        if parse_opacity:
            frag.write('opacity = {0};'.format(out_opacity))

    # Volume
    # parse_volume_input(node.inputs[1])

    # Displacement
    if parse_displacement and armutils.tess_enabled(
            make_state.target) and node.inputs[2].is_linked and tese != None:
        parsed = []
        parents = []
        normal_written = False
        curshader = tese

        out_disp = parse_displacement_input(node.inputs[2])
        tese.write('float disp = {0};'.format(out_disp))
예제 #3
0
def disp_linked(output_node):
    # Armory PBR with unlinked height socket
    linked = output_node.inputs[2].is_linked
    tess_enabled = armutils.tess_enabled(make_state.target)
    if linked:
        l = output_node.inputs[2].links[0]
        if l.from_node.type == 'GROUP' and l.from_node.node_tree.name.startswith(
                'Armory PBR') and l.from_node.inputs[10].is_linked == False:
            return False
    if linked and not tess_enabled:
        log.warn('Tessellation not available on ' + make_state.target)
    return tess_enabled and linked
예제 #4
0
파일: cycles.py 프로젝트: armory3d/armory
def parse_output(node, _vert, _frag, _geom, _tesc, _tese, _parse_surface, _parse_opacity, parse_displacement):
    global parsed # Compute nodes only once
    global parents
    global normal_written # Normal socket is linked on shader node - overwrite fs normal
    global curshader # Active shader - frag for surface / tese for displacement
    global vert
    global frag
    global geom
    global tesc
    global tese
    global parse_surface
    global parse_opacity
    vert = _vert
    frag = _frag
    geom = _geom
    tesc = _tesc
    tese = _tese
    parse_surface = _parse_surface
    parse_opacity = _parse_opacity

    # Surface
    if parse_surface or parse_opacity:
        parsed = []
        parents = []
        normal_written = False
        curshader = frag
        
        out_basecol, out_roughness, out_metallic, out_occlusion, out_opacity = parse_shader_input(node.inputs[0])
        if parse_surface:
            frag.write('basecol = {0};'.format(out_basecol))
            frag.write('roughness = {0};'.format(out_roughness))
            frag.write('metallic = {0};'.format(out_metallic))
            frag.write('occlusion = {0};'.format(out_occlusion))
        if parse_opacity:
            frag.write('opacity = {0};'.format(out_opacity))

    # Volume
    # parse_volume_input(node.inputs[1])

    # Displacement
    if parse_displacement and armutils.tess_enabled(make_state.target) and node.inputs[2].is_linked and tese != None:
        parsed = []
        parents = []
        normal_written = False
        curshader = tese

        out_disp = parse_displacement_input(node.inputs[2])
        tese.write('float disp = {0};'.format(out_disp))