// NOTE: Shader automatically converted from Godot Engine 4.4.stable.mono's StandardMaterial3D.

shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;

#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc"

uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;

uniform sampler2D texture_normal : hint_roughness_normal, filter_linear_mipmap, repeat_enable;
uniform float normal_scale : hint_range(0, 2) = 0.1;

uniform float roughness : hint_range(0, 1) = 0.2;

uniform float irisRange : hint_range(0.1, 10) = 5;
uniform float irisPower : hint_range(0.1, 10) = 5;
uniform float irisScale:hint_range(0.01,2.0) = 1;

//void vertex() 
//{ 
  //UV = scale( UV, vec2(0.5), vec2(uvScale) );
//}

void fragment() 
{ 
	vec2 base_uv = UV;
  float d = ( irisRange * length( UV - vec2( 0.5, 0.5 ) ) ) / length( vec2( 0.5, 0.5 ) );
  d = clamp( d, 0, 1 );
  d = pow( d, irisPower );
  base_uv = mix( UV, scale( UV, vec2(0.5), vec2(2.0 - irisScale) ), 1.0 - d);

	vec4 albedo_tex = texture(texture_albedo, base_uv);
	ALBEDO = albedo_tex.rgb;
  //ALBEDO = vec3( d );
  
  ROUGHNESS = mix( roughness, 1, d );

	NORMAL_MAP = texture(texture_normal, base_uv).rgb;
  //ALBEDO = normalize( vec3( UV.rg*0.5, 1) ); 
	NORMAL_MAP_DEPTH = normal_scale;
}
