// NOTE: Shader automatically converted from Godot Engine 4.3.rc.mono's StandardMaterial3D.

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

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

uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
uniform float grow : hint_range(-16.0, 16.0, 0.001);

uniform float fresnelSharpness = 2;
uniform float fresnelMultiply = 1;
uniform float fresnelOffset = 0;

void vertex()
{
	VERTEX += NORMAL * grow;
}

void fragment()
{
	vec2 uv = UV;
  float fresnelAmount = fresnel( NORMAL, VIEW, fresnelSharpness) * fresnelMultiply + fresnelOffset;
  fresnelAmount = clamp( fresnelAmount, 0.0, 1.0 );
	vec4 albedo_tex = texture( texture_albedo, uv );

	ALBEDO = albedo.rgb * albedo_tex.rgb;
	ALPHA *= albedo.a * albedo_tex.a * fresnelAmount;
}
