Add new levels and models
This commit is contained in:
220
core/resources/shaders/ground_repetition.tres
Normal file
220
core/resources/shaders/ground_repetition.tres
Normal file
@@ -0,0 +1,220 @@
|
||||
[gd_resource type="VisualShader" load_steps=20 format=3 uid="uid://c66rr4lq10okt"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://0nwylr3o4b27" path="res://assets/textures/grass_rock/aerial_grass_rock_diff_1k.jpg" id="1_fvu23"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeVec2Constant" id="VisualShaderNodeVec2Constant_0gqw2"]
|
||||
constant = Vector2(0.5, 0.5)
|
||||
|
||||
[sub_resource type="VisualShaderNodeExpression" id="VisualShaderNodeExpression_e4ora"]
|
||||
size = Vector2(468, 400)
|
||||
expression = "uv_in -= pivot;
|
||||
float rotation_radians = radians(rotation_degrees);
|
||||
float c = cos(rotation_degrees);
|
||||
float s = sin(rotation_degrees);
|
||||
|
||||
uv_out.x = uv_in.x * c + uv_in.y * s;
|
||||
uv_out.y = uv_in.y * c - uv_in.x * s;
|
||||
|
||||
uv_out += pivot;"
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_o4sga"]
|
||||
texture = ExtResource("1_fvu23")
|
||||
texture_type = 1
|
||||
|
||||
[sub_resource type="VisualShaderNodeUVFunc" id="VisualShaderNodeUVFunc_wtcp4"]
|
||||
function = 1
|
||||
|
||||
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_vyfqc"]
|
||||
input_name = "uv"
|
||||
|
||||
[sub_resource type="VisualShaderNodeFloatConstant" id="VisualShaderNodeFloatConstant_ygstf"]
|
||||
constant = 50.0
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_5ogwx"]
|
||||
noise_type = 2
|
||||
frequency = 0.1
|
||||
fractal_type = 0
|
||||
cellular_return_type = 0
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_du4hg"]
|
||||
noise = SubResource("FastNoiseLite_5ogwx")
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_3u3s1"]
|
||||
texture = SubResource("NoiseTexture2D_du4hg")
|
||||
|
||||
[sub_resource type="VisualShaderNodeRemap" id="VisualShaderNodeRemap_qfmdb"]
|
||||
default_input_values = [1, 0.0, 2, 1.0, 3, 0.0, 4, 360.0]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_f1ne1"]
|
||||
offsets = PackedFloat32Array(0, 0.157692, 0.273077)
|
||||
colors = PackedColorArray(1, 1, 1, 1, 0.444444, 0.444444, 0.444444, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_3uqdu"]
|
||||
noise_type = 2
|
||||
frequency = 0.1
|
||||
fractal_type = 0
|
||||
cellular_return_type = 4
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_3esh7"]
|
||||
color_ramp = SubResource("Gradient_f1ne1")
|
||||
noise = SubResource("FastNoiseLite_3uqdu")
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_w50n5"]
|
||||
texture = SubResource("NoiseTexture2D_3esh7")
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_yqwyb"]
|
||||
texture = ExtResource("1_fvu23")
|
||||
texture_type = 1
|
||||
|
||||
[sub_resource type="VisualShaderNodeMix" id="VisualShaderNodeMix_7xmur"]
|
||||
default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(1, 1, 1), 2, Vector3(0.5, 0.5, 0.5)]
|
||||
op_type = 3
|
||||
|
||||
[sub_resource type="VisualShaderNodeUVFunc" id="VisualShaderNodeUVFunc_lhnbm"]
|
||||
function = 1
|
||||
|
||||
[sub_resource type="VisualShaderNodeRemap" id="VisualShaderNodeRemap_q66io"]
|
||||
default_input_values = [1, 0.0, 2, 1.0, 3, 0.8, 4, 1.2]
|
||||
|
||||
[resource]
|
||||
code = "shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;
|
||||
|
||||
uniform sampler2D tex_frg_26;
|
||||
uniform sampler2D tex_frg_21 : source_color;
|
||||
uniform sampler2D tex_frg_29 : source_color;
|
||||
uniform sampler2D tex_frg_28;
|
||||
|
||||
|
||||
|
||||
void fragment() {
|
||||
// Input:24
|
||||
vec2 n_out24p0 = UV;
|
||||
|
||||
|
||||
// FloatConstant:25
|
||||
float n_out25p0 = 50.000000;
|
||||
|
||||
|
||||
// UVFunc:23
|
||||
vec2 n_in23p2 = vec2(0.00000, 0.00000);
|
||||
vec2 n_out23p0 = (n_out24p0 - n_in23p2) * vec2(n_out25p0) + n_in23p2;
|
||||
|
||||
|
||||
// Texture2D:26
|
||||
vec4 n_out26p0 = texture(tex_frg_26, UV);
|
||||
|
||||
|
||||
float n_out32p0;
|
||||
// Remap:32
|
||||
float n_in32p1 = 0.00000;
|
||||
float n_in32p2 = 1.00000;
|
||||
float n_in32p3 = 0.80000;
|
||||
float n_in32p4 = 1.20000;
|
||||
{
|
||||
float __input_range = n_in32p2 - n_in32p1;
|
||||
float __output_range = n_in32p4 - n_in32p3;
|
||||
n_out32p0 = n_in32p3 + __output_range * ((n_out26p0.x - n_in32p1) / __input_range);
|
||||
}
|
||||
|
||||
|
||||
// UVFunc:31
|
||||
vec2 n_in31p2 = vec2(0.00000, 0.00000);
|
||||
vec2 n_out31p0 = (n_out23p0 - n_in31p2) * vec2(n_out32p0) + n_in31p2;
|
||||
|
||||
|
||||
// Vector2Constant:19
|
||||
vec2 n_out19p0 = vec2(0.500000, 0.500000);
|
||||
|
||||
|
||||
float n_out27p0;
|
||||
// Remap:27
|
||||
float n_in27p1 = 0.00000;
|
||||
float n_in27p2 = 1.00000;
|
||||
float n_in27p3 = 0.00000;
|
||||
float n_in27p4 = 360.00000;
|
||||
{
|
||||
float __input_range = n_in27p2 - n_in27p1;
|
||||
float __output_range = n_in27p4 - n_in27p3;
|
||||
n_out27p0 = n_in27p3 + __output_range * ((n_out26p0.x - n_in27p1) / __input_range);
|
||||
}
|
||||
|
||||
|
||||
vec2 n_out20p0;
|
||||
// Expression:20
|
||||
n_out20p0 = vec2(0.0, 0.0);
|
||||
{
|
||||
n_out31p0 -= n_out19p0;
|
||||
float rotation_radians = radians(n_out27p0);
|
||||
float c = cos(n_out27p0);
|
||||
float s = sin(n_out27p0);
|
||||
|
||||
n_out20p0.x = n_out31p0.x * c + n_out31p0.y * s;
|
||||
n_out20p0.y = n_out31p0.y * c - n_out31p0.x * s;
|
||||
|
||||
n_out20p0 += n_out19p0;
|
||||
}
|
||||
|
||||
|
||||
// Texture2D:21
|
||||
vec4 n_out21p0 = texture(tex_frg_21, n_out20p0);
|
||||
|
||||
|
||||
// Texture2D:29
|
||||
vec4 n_out29p0 = texture(tex_frg_29, n_out23p0);
|
||||
|
||||
|
||||
// Texture2D:28
|
||||
vec4 n_out28p0 = texture(tex_frg_28, UV);
|
||||
|
||||
|
||||
// Mix:30
|
||||
vec3 n_out30p0 = mix(vec3(n_out21p0.xyz), vec3(n_out29p0.xyz), vec3(n_out28p0.xyz));
|
||||
|
||||
|
||||
// Output:0
|
||||
ALBEDO = n_out30p0;
|
||||
|
||||
|
||||
}
|
||||
"
|
||||
nodes/fragment/0/position = Vector2(1000, 220)
|
||||
nodes/fragment/19/node = SubResource("VisualShaderNodeVec2Constant_0gqw2")
|
||||
nodes/fragment/19/position = Vector2(-2120, 580)
|
||||
nodes/fragment/20/node = SubResource("VisualShaderNodeExpression_e4ora")
|
||||
nodes/fragment/20/position = Vector2(-1040, 420)
|
||||
nodes/fragment/20/size = Vector2(468, 400)
|
||||
nodes/fragment/20/input_ports = "0,3,uv_in;1,3,pivot;2,0,rotation_degrees;"
|
||||
nodes/fragment/20/output_ports = "0,3,uv_out;"
|
||||
nodes/fragment/20/expression = "uv_in -= pivot;
|
||||
float rotation_radians = radians(rotation_degrees);
|
||||
float c = cos(rotation_degrees);
|
||||
float s = sin(rotation_degrees);
|
||||
|
||||
uv_out.x = uv_in.x * c + uv_in.y * s;
|
||||
uv_out.y = uv_in.y * c - uv_in.x * s;
|
||||
|
||||
uv_out += pivot;"
|
||||
nodes/fragment/21/node = SubResource("VisualShaderNodeTexture_o4sga")
|
||||
nodes/fragment/21/position = Vector2(-60, 340)
|
||||
nodes/fragment/23/node = SubResource("VisualShaderNodeUVFunc_wtcp4")
|
||||
nodes/fragment/23/position = Vector2(-1680, 200)
|
||||
nodes/fragment/24/node = SubResource("VisualShaderNodeInput_vyfqc")
|
||||
nodes/fragment/24/position = Vector2(-2200, 360)
|
||||
nodes/fragment/25/node = SubResource("VisualShaderNodeFloatConstant_ygstf")
|
||||
nodes/fragment/25/position = Vector2(-2100, 460)
|
||||
nodes/fragment/26/node = SubResource("VisualShaderNodeTexture_3u3s1")
|
||||
nodes/fragment/26/position = Vector2(-2040, 720)
|
||||
nodes/fragment/27/node = SubResource("VisualShaderNodeRemap_qfmdb")
|
||||
nodes/fragment/27/position = Vector2(-1600, 940)
|
||||
nodes/fragment/28/node = SubResource("VisualShaderNodeTexture_w50n5")
|
||||
nodes/fragment/28/position = Vector2(-120, 960)
|
||||
nodes/fragment/29/node = SubResource("VisualShaderNodeTexture_yqwyb")
|
||||
nodes/fragment/29/position = Vector2(-60, 640)
|
||||
nodes/fragment/30/node = SubResource("VisualShaderNodeMix_7xmur")
|
||||
nodes/fragment/30/position = Vector2(280, 540)
|
||||
nodes/fragment/31/node = SubResource("VisualShaderNodeUVFunc_lhnbm")
|
||||
nodes/fragment/31/position = Vector2(-1360, 200)
|
||||
nodes/fragment/32/node = SubResource("VisualShaderNodeRemap_q66io")
|
||||
nodes/fragment/32/position = Vector2(-1680, 680)
|
||||
nodes/fragment/connections = PackedInt32Array(19, 0, 20, 1, 24, 0, 23, 0, 25, 0, 23, 1, 26, 0, 27, 0, 27, 0, 20, 2, 20, 0, 21, 0, 21, 0, 30, 0, 29, 0, 30, 1, 28, 0, 30, 2, 30, 0, 0, 0, 31, 0, 20, 0, 23, 0, 31, 0, 26, 0, 32, 0, 32, 0, 31, 1, 23, 0, 29, 0)
|
||||
98
core/resources/shaders/ground_texture.gdshader
Normal file
98
core/resources/shaders/ground_texture.gdshader
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
確率論的プロシージャルテクスチャ シェーダー for Godot Engine / Ported by あるる(きのもと 結衣) @arlez80
|
||||
Stochastic Procedural Texture Shader for Godot Engine / Ported by Yui Kinomoto @arlez80
|
||||
|
||||
MIT License
|
||||
|
||||
References:
|
||||
https://eheitzresearch.wordpress.com/722-2/
|
||||
High-Performance By-Example Noise using a Histogram-Preserving Blending Operator
|
||||
https://eheitzresearch.wordpress.com/738-2/
|
||||
Procedural Stochastic Textures by Tiling and Blending
|
||||
*/
|
||||
shader_type spatial;
|
||||
|
||||
uniform vec2 uv_scale = vec2( 1.0, 1.0 );
|
||||
|
||||
uniform sampler2D t_input : hint_default_white;
|
||||
uniform sampler2D inv_t : hint_default_white;
|
||||
|
||||
uniform vec3 color_space_vector1;
|
||||
uniform vec3 color_space_vector2;
|
||||
uniform vec3 color_space_vector3;
|
||||
uniform vec3 color_space_origin;
|
||||
|
||||
vec3 return_to_original_color_space( vec3 c )
|
||||
{
|
||||
return pow(
|
||||
color_space_origin
|
||||
+ color_space_vector1 * c.r
|
||||
+ color_space_vector2 * c.g
|
||||
+ color_space_vector3 * c.b
|
||||
, vec3( 2.2 ) );
|
||||
}
|
||||
|
||||
void triangle_grid( vec2 uv, out float w1, out float w2, out float w3, out ivec2 vertex1, out ivec2 vertex2, out ivec2 vertex3 )
|
||||
{
|
||||
uv *= 3.464; // 2 * sqrt(3)
|
||||
|
||||
vec2 skewed_coord = mat2( vec2( 1.0, 0.0 ), vec2( -0.57735027, 1.15470054 ) ) * uv;
|
||||
ivec2 base_id = ivec2( floor( skewed_coord ) );
|
||||
vec3 temp = vec3( fract( skewed_coord ), 0.0 );
|
||||
temp.z = 1.0 - temp.x - temp.y;
|
||||
|
||||
if( 0.0 < temp.z ) {
|
||||
w1 = temp.z;
|
||||
w2 = temp.y;
|
||||
w3 = temp.x;
|
||||
vertex1 = base_id;
|
||||
vertex2 = base_id + ivec2( 0, 1 );
|
||||
vertex3 = base_id + ivec2( 1, 0 );
|
||||
}else {
|
||||
w1 = -temp.z;
|
||||
w2 = 1.0 - temp.y;
|
||||
w3 = 1.0 - temp.x;
|
||||
vertex1 = base_id + ivec2( 1, 1 );
|
||||
vertex2 = base_id + ivec2( 1, 0 );
|
||||
vertex3 = base_id + ivec2( 0, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
vec2 hash( vec2 p )
|
||||
{
|
||||
return fract( sin( p * mat2( vec2( 127.1, 311.7 ), vec2( 269.5, 183.3 ) ) ) * 43758.5453 );
|
||||
}
|
||||
|
||||
vec3 by_example_procedural_noise( vec2 uv )
|
||||
{
|
||||
float w1, w2, w3;
|
||||
ivec2 vertex1, vertex2, vertex3;
|
||||
triangle_grid( uv, w1, w2, w3, vertex1, vertex2, vertex3 );
|
||||
|
||||
vec2 uv1 = uv + hash( vec2( vertex1 ) );
|
||||
vec2 uv2 = uv + hash( vec2( vertex2 ) );
|
||||
vec2 uv3 = uv + hash( vec2( vertex3 ) );
|
||||
|
||||
vec2 duvdx = dFdx( uv );
|
||||
vec2 duvdy = dFdy( uv );
|
||||
|
||||
vec3 g1 = textureGrad( t_input, uv1, duvdx, duvdy ).rgb;
|
||||
vec3 g2 = textureGrad( t_input, uv2, duvdx, duvdy ).rgb;
|
||||
vec3 g3 = textureGrad( t_input, uv3, duvdx, duvdy ).rgb;
|
||||
|
||||
vec3 g = w1*g1 + w2*g2 + w3*g3 - vec3( 0.5 );
|
||||
g = g * inversesqrt( w1*w1 + w2*w2 + w3*w3 );
|
||||
g = g + vec3( 0.5 );
|
||||
|
||||
//float lod = textureQueryLod( t_input, uv ).y / float( textureSize( inv_t, 0 ).y );
|
||||
return return_to_original_color_space( vec3(
|
||||
texture( inv_t, vec2( g.r, 0.0 ) ).r
|
||||
, texture( inv_t, vec2( g.g, 0.0 ) ).g
|
||||
, texture( inv_t, vec2( g.b, 0.0 ) ).b
|
||||
) );
|
||||
}
|
||||
|
||||
void fragment( )
|
||||
{
|
||||
ALBEDO = by_example_procedural_noise( UV * uv_scale );
|
||||
}
|
||||
Reference in New Issue
Block a user