| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  | shader_type spatial; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | render_mode  unshaded; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc" | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc" | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Noise.gdshaderinc" | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform vec4 albedo : source_color; | 
					
						
							|  |  |  | uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; | 
					
						
							|  |  |  | uniform float alpha_scissor_threshold : hint_range(0.0, 1.0, 0.001); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform float alpha_antialiasing_edge : hint_range(0.0, 1.0, 0.01); | 
					
						
							|  |  |  | uniform ivec2 albedo_texture_size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform float centerDistance = 100; | 
					
						
							|  |  |  | uniform float rangeDistance  = 50; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | void vertex() | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | void fragment() | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   vec4 albedo_tex = texture( texture_albedo, UV); | 
					
						
							|  |  |  |   vec3 worldPosition = ( INV_VIEW_MATRIX * vec4( VERTEX, 1.0 ) ).xyz; | 
					
						
							|  |  |  |   float worldDistance = length( worldPosition - CAMERA_POSITION_WORLD ); | 
					
						
							|  |  |  |   float range = rangeDistance / 2.0; | 
					
						
							|  |  |  |   float value = normalizeToRange01( worldDistance, | 
					
						
							|  |  |  |    centerDistance - range, centerDistance + range | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  | 	ALBEDO = vec3( 1, 1, 1 ) * value; | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  | 	ALPHA *= albedo.a * albedo_tex.a; | 
					
						
							|  |  |  | 	ALPHA_SCISSOR_THRESHOLD = alpha_scissor_threshold; | 
					
						
							|  |  |  | 	ALPHA_ANTIALIASING_EDGE = alpha_antialiasing_edge; | 
					
						
							|  |  |  | 	ALPHA_TEXTURE_COORDINATE = UV * vec2(albedo_texture_size); | 
					
						
							|  |  |  | } |