[gd_resource type="SpatialMaterial" load_steps=5 format=2]

$if $(connected:albedo_tex)
[ext_resource path="$(file_prefix)_albedo.png" type="Texture" id=1]
$fi
$if $(connected:ao_tex) or $(connected:roughness_tex) or $(connected:metallic_tex)
[ext_resource path="$(file_prefix)_orm.png" type="Texture" id=2]
$fi
$if $(connected:normal_tex)
[ext_resource path="$(file_prefix)_normal.png" type="Texture" id=3]
$fi
$if $(connected:depth_tex)
[ext_resource path="$(file_prefix)_depth.png" type="Texture" id=4]
$fi
$if $(connected:emission_tex)
[ext_resource path="$(file_prefix)_emission.png" type="Texture" id=5]
$fi


[resource]
albedo_color = Color($(param:albedo_color.r), $(param:albedo_color.g), $(param:albedo_color.b), $(param:albedo_color.a))
$if $(connected:albedo_tex)
albedo_texture = ExtResource( 1 )
$fi
metallic = $(param:metallic)
$if $(connected:metallic_tex)
metallic_texture = ExtResource( 2 )
metallic_texture_channel = 2
$fi
roughness = $(param:roughness)
$if $(connected:ao_tex) or $(connected:roughness_tex) or $(connected:metallic_tex)
roughness_texture = ExtResource( 2 )
roughness_texture_channel = 1
$fi
$if $(connected:normal_tex)
normal_enabled = true
normal_scale = $(param:normal)
normal_texture = ExtResource( 3 )
$fi
$if $(connected:emission_tex)
emission_enabled = true
emission = Color( 0, 0, 0, 1 )
emission_energy = $(param:emission_energy)
emission_operator = 0
emission_on_uv2 = false
emission_texture = ExtResource( 5 )
$fi
$if $(connected:ao_tex)
ao_enabled = true
ao_light_affect = $(param:ao)
ao_texture = ExtResource( 2 )
ao_on_uv2 = false
ao_texture_channel = 0
$fi
$if $(connected:depth_tex)
depth_enabled = true
depth_scale = $(expr:0.2*$(param:depth_scale))
depth_deep_parallax = true
depth_min_layers = 8
depth_max_layers = 32
depth_flip_tangent = false
depth_flip_binormal = false
depth_texture = ExtResource( 4 )
$fi
