89 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			89 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|   | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Textures.gdshaderinc" | ||
|  | 
 | ||
|  | uniform vec4 albedo : source_color; | ||
|  | uniform sampler2D texture_albedo : source_color, filter_linear_mipmap_anisotropic, repeat_enable; | ||
|  | uniform sampler2D texture_opacity:hint_default_white; | ||
|  | uniform float opacity: hint_range(0, 5) = 1; | ||
|  | 
 | ||
|  | #ifdef USE_ALPHA_SCISSOR | ||
|  | uniform float alphaScissorTreshold:hint_range(0,1) = 0.4; | ||
|  | #endif | ||
|  | 
 | ||
|  | #ifdef USE_ALPHA_DISCARD | ||
|  | uniform float alphaDiscardTreshold:hint_range(0,1) = 0.4; | ||
|  | #endif | ||
|  | 
 | ||
|  | uniform sampler2D texture_normal : hint_roughness_normal, filter_linear_mipmap_anisotropic, repeat_enable; | ||
|  | uniform float normal_scale : hint_range(0, 5.0) = 1.0; | ||
|  | 
 | ||
|  | uniform sampler2D texture_roughness : hint_roughness_r, filter_linear_mipmap_anisotropic, repeat_enable; | ||
|  | uniform float roughness : hint_range(0.0, 1.0) = 1.0; | ||
|  | uniform float roughnessOffset : hint_range(-1.0, 1.0) = 0.0; | ||
|  | 
 | ||
|  | uniform sampler2D texture_metallic : hint_default_black, filter_linear_mipmap_anisotropic, repeat_enable; | ||
|  | uniform float metallic : hint_range(0.0, 1.0, 0.01) = 1.0; | ||
|  | uniform float metallicOffset : hint_range(-1.0, 1.0) = 0.0; | ||
|  | 
 | ||
|  | uniform float specular : hint_range(0.0, 1.0); | ||
|  | 
 | ||
|  | uniform sampler2D texture_ambient_occlusion : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable; | ||
|  | uniform float ao_light_affect : hint_range(0.0, 1.0) = 1.0; | ||
|  | uniform float ambientOcclusionAmount : hint_range(0.0, 2.0) = 1.0; | ||
|  | uniform float ambientOcclusionOffset : hint_range(-1.0, 1.0) = 0.0; | ||
|  | 
 | ||
|  | uniform float rim : hint_range(0.0, 1.0); | ||
|  | uniform float rim_tint : hint_range(0.0, 1.0); | ||
|  | 
 | ||
|  | uniform sampler2D texture_emission : source_color, hint_default_black, filter_linear_mipmap_anisotropic, repeat_enable; | ||
|  | uniform vec4 emission : source_color; | ||
|  | uniform float emission_energy : hint_range(0.0, 100.0); | ||
|  | 
 | ||
|  | 
 | ||
|  | uniform vec3 uv1_scale; | ||
|  | uniform vec3 uv1_offset; | ||
|  | 
 | ||
|  | void vertex()  | ||
|  | { | ||
|  | 	UV = UV * uv1_scale.xy + uv1_offset.xy; | ||
|  | } | ||
|  | 
 | ||
|  | void fragment()  | ||
|  | { | ||
|  | 	 | ||
|  | 	ALPHA *= sampleAlpha( texture_opacity, texture_albedo, UV, albedo, opacity ); | ||
|  |    | ||
|  |   #ifdef USE_ALPHA_SCISSOR | ||
|  | 
 | ||
|  |     ALPHA_SCISSOR_THRESHOLD = alphaScissorTreshold; | ||
|  | 
 | ||
|  |   #endif | ||
|  | 
 | ||
|  |   #ifdef USE_ALPHA_DISCARD | ||
|  |    | ||
|  |     if ( ALPHA < alphaDiscardTreshold ) | ||
|  |     { | ||
|  |       discard; | ||
|  |     } | ||
|  |    | ||
|  |   #endif | ||
|  | 
 | ||
|  |   ALBEDO = sampleRGB( texture_albedo, UV, albedo ); | ||
|  |    | ||
|  | 
 | ||
|  | 	METALLIC  = sampleRed( texture_metallic, UV, metallic, metallicOffset ); | ||
|  | 	SPECULAR  = specular; | ||
|  |   ROUGHNESS = sampleRed( texture_roughness, UV, roughness, roughnessOffset ); | ||
|  | 
 | ||
|  | 	NORMAL_MAP = sampleRGB( texture_normal, UV ); | ||
|  | 	NORMAL_MAP_DEPTH = normal_scale; | ||
|  | 
 | ||
|  | 	EMISSION = sampleEmission( texture_emission, UV, emission_energy, emission );   | ||
|  |    | ||
|  | 	RIM = rim; | ||
|  | 	RIM_TINT = rim_tint; | ||
|  | 
 | ||
|  | 	AO = sampleOcclusion( texture_ambient_occlusion, UV, ambientOcclusionAmount, ambientOcclusionOffset ); | ||
|  | 	AO_LIGHT_AFFECT = ao_light_affect; | ||
|  | 
 | ||
|  | } |