14
14
15
15
# Constants for the terrain
16
16
WIDTH , HEIGHT = 1920 , 1080
17
- GRID_SIZE = 750 #1000 # Number of vertices along one side of the terrain
18
- SCALE = 0.25 #0.5 # Distance between vertices in the grid
17
+ GRID_SIZE = 3000 #1000 # Number of vertices along one side of the terrain
18
+ SCALE = 0.1 #0.5 # Distance between vertices in the grid
19
19
AMPLITUDE = 100 #50 # Height amplitude for the noise
20
20
21
21
def load_texture (filepath , context ):
@@ -28,7 +28,7 @@ def generate_perlin_noise(noise, grid_size, scale, amplitude):
28
28
29
29
for i in range (grid_size ):
30
30
for j in range (grid_size ):
31
- y = noise .generate_2D_perlin_noise (i / 600 .0 , j / 600 .0 , new_range = [0 , amplitude ])
31
+ y = noise .generate_2D_perlin_noise (i / 2500 .0 , j / 2500 .0 , new_range = [0 , amplitude ])
32
32
noise_values [i * grid_size + j ] = y
33
33
34
34
return noise_values
@@ -79,7 +79,7 @@ def generate_terrain(noise, grid_size, scale, amplitude):
79
79
float radius = length(in_vert.xz);
80
80
81
81
// Determine the maximum radius for the animation based on the terrain size
82
- float max_radius = 250 .0; // Adjust as necessary depending on the grid size
82
+ float max_radius = 700 .0; // Adjust as necessary depending on the grid size 250
83
83
84
84
float pi = 3.141592653589793238462643383279502884197169/2;
85
85
@@ -88,7 +88,7 @@ def generate_terrain(noise, grid_size, scale, amplitude):
88
88
89
89
// Fade out effect for far away points
90
90
float fade_start = 60; // 60
91
- float fade_end = 100 ; // 85
91
+ float fade_end = 700 ; // 85
92
92
float fade_factor = 1-smoothstep(fade_start, fade_end, radius);
93
93
94
94
// Apply the animation effect
@@ -211,6 +211,9 @@ def get_height_at_origin(vertices, grid_size):
211
211
# Access the height (Y coordinate) at the origin
212
212
height_at_origin = vertices [index_at_origin ][1 ] # [1] for the Y component
213
213
214
+ if height_at_origin < 20 :
215
+ height_at_origin = 20
216
+
214
217
return height_at_origin
215
218
216
219
TAU = math .pi * 2
0 commit comments