1
- [gd_scene load_steps =19 format =3 uid ="uid://d1d6jy84lcpg7" ]
1
+ [gd_scene load_steps =26 format =3 uid ="uid://d1d6jy84lcpg7" ]
2
2
3
3
[ext_resource type ="Script" path ="res://camera.gd" id ="1_mfjvp" ]
4
4
[ext_resource type ="CompressedTexture3D" uid ="uid://bpvy0e34otmhk" path ="res://icon_outlined.png" id ="2_8fjmj" ]
@@ -19,6 +19,40 @@ tonemap_mode = 2
19
19
glow_enabled = true
20
20
volumetric_fog_enabled = true
21
21
22
+ [sub_resource type ="Gradient" id ="Gradient_cqs75" ]
23
+ offsets = PackedFloat32Array (0 , 0.313433 , 1 )
24
+ colors = PackedColorArray (0 , 0 , 0 , 1 , 0.473976 , 0.473976 , 0.473976 , 1 , 1 , 1 , 1 , 1 )
25
+
26
+ [sub_resource type ="FastNoiseLite" id ="FastNoiseLite_cjmew" ]
27
+ frequency = 0.005
28
+ fractal_type = 2
29
+ fractal_octaves = 4
30
+ fractal_lacunarity = 3.0
31
+ fractal_gain = 2.0
32
+ fractal_weighted_strength = 0.4
33
+ domain_warp_enabled = true
34
+
35
+ [sub_resource type ="NoiseTexture2D" id ="NoiseTexture2D_6pkhb" ]
36
+ seamless = true
37
+ as_normal_map = true
38
+ bump_strength = 0.5
39
+ color_ramp = SubResource ("Gradient_cqs75" )
40
+ noise = SubResource ("FastNoiseLite_cjmew" )
41
+
42
+ [sub_resource type ="NoiseTexture2D" id ="NoiseTexture2D_8w53i" ]
43
+ seamless = true
44
+ color_ramp = SubResource ("Gradient_cqs75" )
45
+ noise = SubResource ("FastNoiseLite_cjmew" )
46
+
47
+ [sub_resource type ="StandardMaterial3D" id ="StandardMaterial3D_qrpkj" ]
48
+ albedo_color = Color (0 , 0 , 0 , 1 )
49
+ roughness_texture = SubResource ("NoiseTexture2D_8w53i" )
50
+ normal_enabled = true
51
+ normal_texture = SubResource ("NoiseTexture2D_6pkhb" )
52
+ uv1_scale = Vector3 (0.25 , 0.25 , 0.25 )
53
+ uv1_triplanar = true
54
+ texture_filter = 5
55
+
22
56
[sub_resource type ="FogMaterial" id ="FogMaterial_sfd8y" ]
23
57
density = -1.6842
24
58
@@ -149,6 +183,79 @@ emission = Color(0, 0.501961, 1, 1)
149
183
edge_fade = 0.0
150
184
density_texture = ExtResource ("2_8fjmj" )
151
185
186
+ [sub_resource type ="Shader" id ="Shader_1xpcs" ]
187
+ code = "shader_type fog ;
188
+
189
+ /* main fog shader */
190
+ uniform float base_density : hint_range (0 , 1 ) = 0.8 ;
191
+ uniform vec3 base_color : source_color ;
192
+ uniform float fade_out_height = 2.0 ;
193
+ uniform float fade_out_distance = 1.5 ;
194
+
195
+ uniform vec3 noise_amounts = vec3 (0.4 , 0.35 , 0.25 ); // should add up to 1
196
+ uniform vec3 noise_scales = vec3 (1.0 , 2.0 , 4.0 );
197
+ uniform vec3 noise_velocity1 = vec3 (0.5 , 0.0 , 0.0 );
198
+ uniform vec3 noise_velocity2 = vec3 (1 , 0.0 , - 1 );
199
+ uniform vec3 noise_velocity3 = vec3 (0.0 , 0.6 , 0.3 );
200
+
201
+
202
+ /* gradient_noise_3d.gdshaderinc */
203
+ // The MIT License
204
+ // Copyright © 2013 Inigo Quilez
205
+ // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
206
+
207
+ // All noise functions here:
208
+ //
209
+ // https://www.shadertoy.com/playlist/fXlXzf&from=0&num=12
210
+
211
+ vec3 hash (vec3 p ) {
212
+ p = vec3 (dot (p ,vec3 (127.1 ,311.7 , 74.7 )),
213
+ dot (p ,vec3 (269.5 ,183.3 ,246.1 )),
214
+ dot (p ,vec3 (113.5 ,271.9 ,124.6 )));
215
+
216
+ return - 1.0 + 2.0 * fract (sin (p ) * 43758.5453123 );
217
+ }
218
+
219
+ // 3D gradient noise function
220
+ float noise (vec3 p ) {
221
+ vec3 i = floor (p );
222
+ vec3 f = fract (p );
223
+
224
+ vec3 u = f * f * (3.0 - 2.0 * f );
225
+
226
+ return mix ( mix ( mix ( dot ( hash ( i + vec3 (0.0 ,0.0 ,0.0 ) ), f - vec3 (0.0 ,0.0 ,0.0 ) ),
227
+ dot ( hash ( i + vec3 (1.0 ,0.0 ,0.0 ) ), f - vec3 (1.0 ,0.0 ,0.0 ) ), u .x ),
228
+ mix ( dot ( hash ( i + vec3 (0.0 ,1.0 ,0.0 ) ), f - vec3 (0.0 ,1.0 ,0.0 ) ),
229
+ dot ( hash ( i + vec3 (1.0 ,1.0 ,0.0 ) ), f - vec3 (1.0 ,1.0 ,0.0 ) ), u .x ), u .y ),
230
+ mix ( mix ( dot ( hash ( i + vec3 (0.0 ,0.0 ,1.0 ) ), f - vec3 (0.0 ,0.0 ,1.0 ) ),
231
+ dot ( hash ( i + vec3 (1.0 ,0.0 ,1.0 ) ), f - vec3 (1.0 ,0.0 ,1.0 ) ), u .x ),
232
+ mix ( dot ( hash ( i + vec3 (0.0 ,1.0 ,1.0 ) ), f - vec3 (0.0 ,1.0 ,1.0 ) ),
233
+ dot ( hash ( i + vec3 (1.0 ,1.0 ,1.0 ) ), f - vec3 (1.0 ,1.0 ,1.0 ) ), u .x ), u .y ), u .z );
234
+ }
235
+
236
+ void fog () {
237
+ vec3 base_pos = WORLD_POSITION * vec3 (0.1 , 0.5 , 0.1 );
238
+ DENSITY = base_density ;
239
+ float noise1 = noise (base_pos * noise_scales .x + TIME * noise_velocity1 ) * noise_amounts .x ;
240
+ float noise2 = noise (base_pos * noise_scales .y + TIME * noise_velocity2 ) * noise_amounts .y ;
241
+ float noise3 = noise (base_pos * noise_scales .z + TIME * noise_velocity3 ) * noise_amounts .z ;
242
+ DENSITY *= smoothstep (- 0.1 , 0.0 , noise1 + noise2 + noise3 );
243
+ DENSITY *= 1.0 - smoothstep (fade_out_height , fade_out_height + fade_out_distance , WORLD_POSITION .y );
244
+ ALBEDO = base_color ;
245
+ }"
246
+
247
+ [sub_resource type ="ShaderMaterial" id ="ShaderMaterial_481nw" ]
248
+ shader = SubResource ("Shader_1xpcs" )
249
+ shader_parameter/base_density = 1.0
250
+ shader_parameter/base_color = Color (1 , 0 , 0 , 1 )
251
+ shader_parameter/fade_out_height = 0.0
252
+ shader_parameter/fade_out_distance = 8.0
253
+ shader_parameter/noise_amounts = Vector3 (0.4 , 0.35 , 0.25 )
254
+ shader_parameter/noise_scales = Vector3 (1 , 2 , 4 )
255
+ shader_parameter/noise_velocity1 = Vector3 (0.5 , 0 , 0 )
256
+ shader_parameter/noise_velocity2 = Vector3 (1 , 0 , -1 )
257
+ shader_parameter/noise_velocity3 = Vector3 (0 , 0.6 , 0.3 )
258
+
152
259
[node name ="Node3D" type ="Node3D" ]
153
260
154
261
[node name ="WorldEnvironment" type ="WorldEnvironment" parent ="." ]
@@ -173,7 +280,9 @@ offset_right = 812.0
173
280
offset_bottom = 299.0
174
281
theme_override_colors/font_outline_color = Color (0 , 0 , 0 , 1 )
175
282
theme_override_constants/outline_size = 4
176
- text = "Temporal reprojection: Disabled"
283
+ text = "Fog density: 0.05
284
+ Temporal reprojection: Disabled
285
+ Volumetric fog quality: 64×64×64"
177
286
178
287
[node name ="HelpLabel" type ="Label" parent ="Camera3D" ]
179
288
anchors_preset = 2
@@ -189,29 +298,35 @@ theme_override_constants/outline_size = 4
189
298
text = "W/A/S/D/Mouse: Move
190
299
Left/Right arrows: Adjust global fog density
191
300
Space: Toggle temporal reprojection
192
- Up/Down arrows or mouse wheel: Adjust temporal reprojection intensity"
301
+ Up/Down arrows or mouse wheel: Adjust temporal reprojection intensity
302
+ Page Up/Down: Adjust volumetric fog quality"
193
303
194
304
[node name ="Ground" type ="CSGBox3D" parent ="." ]
195
305
size = Vector3 (1024 , 1.99 , 1024 )
306
+ material = SubResource ("StandardMaterial3D_qrpkj" )
196
307
197
308
[node name ="Ground2" type ="CSGBox3D" parent ="Ground" ]
198
309
transform = Transform3D (1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , -10.282 , 0 , 5.62229 )
199
310
operation = 2
200
311
size = Vector3 (3 , 2 , 4 )
312
+ material = SubResource ("StandardMaterial3D_qrpkj" )
201
313
202
314
[node name ="Ground3" type ="CSGBox3D" parent ="Ground" ]
203
315
transform = Transform3D (1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , -7.87312 , 0 , 2.69763 )
204
316
operation = 2
205
317
size = Vector3 (3 , 2 , 4 )
318
+ material = SubResource ("StandardMaterial3D_qrpkj" )
206
319
207
320
[node name ="CSGBox3D" type ="CSGBox3D" parent ="." ]
208
321
transform = Transform3D (1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 5 , 0 )
209
322
size = Vector3 (8 , 8 , 8 )
323
+ material = SubResource ("StandardMaterial3D_qrpkj" )
210
324
211
325
[node name ="CSGBox3D" type ="CSGBox3D" parent ="CSGBox3D" ]
212
326
transform = Transform3D (1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0.4 )
213
327
operation = 2
214
328
size = Vector3 (7.5 , 7.5 , 7.5 )
329
+ material = SubResource ("StandardMaterial3D_qrpkj" )
215
330
216
331
[node name ="FogVolumeNegativeDensity" type ="FogVolume" parent ="." ]
217
332
transform = Transform3D (1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 5 , 0 )
@@ -263,6 +378,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.67463, 1.836, -4.89264)
263
378
light_color = Color (1 , 0.337255 , 0 , 1 )
264
379
light_energy = 0.1
265
380
light_volumetric_fog_energy = 500.0
381
+ light_specular = 0.0
266
382
omni_range = 3.0
267
383
268
384
[node name ="OmniLight3DShadow" type ="OmniLight3D" parent ="." ]
@@ -273,20 +389,22 @@ shadow_enabled = true
273
389
omni_range = 6.0
274
390
275
391
[node name ="SpotLight3D" type ="SpotLight3D" parent ="." ]
276
- transform = Transform3D (0.966384 , -0.226046 , -0.1225 , 0 , 0.476461 , -0.879196 , 0.257105 , 0.84964 , 0.460444 , -7.19085 , -3.7099 , 10.7572 )
392
+ transform = Transform3D (0.966384 , -0.226045 , -0.1225 , 0 , 0.476461 , -0.879196 , 0.257105 , 0.84964 , 0.460444 , -9.82684 , -3.7099 , 4.88511 )
277
393
light_color = Color (0 , 0.439216 , 1 , 1 )
278
394
light_energy = 4.0
395
+ light_volumetric_fog_energy = 25.0
396
+ spot_angle = 35.0
279
397
280
398
[node name ="FogVolumeAlbedoTweak" type ="FogVolume" parent ="." ]
281
399
transform = Transform3D (-0.89393 , -0.0897075 , -0.439138 , 0 , 0.979766 , -0.200148 , 0.448207 , -0.178918 , -0.875842 , -15.8913 , -15.118 , 8.26876 )
282
400
size = Vector3 (8 , 8 , 8 )
283
401
material = SubResource ("FogMaterial_8xcc6" )
284
402
285
403
[node name ="AnimationPlayer" type ="AnimationPlayer" parent ="." ]
286
- autoplay = "move_fog_volume"
287
404
libraries = {
288
405
"" : SubResource ("AnimationLibrary_avffy" )
289
406
}
407
+ autoplay = "move_fog_volume"
290
408
291
409
[node name ="MovingBox" type ="MeshInstance3D" parent ="." ]
292
410
transform = Transform3D (1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 2 , 10 )
@@ -300,3 +418,8 @@ material = SubResource("FogMaterial_ktn3i")
300
418
transform = Transform3D (-2 .98023e-08, 4 .82913e-08, -1 , -4 .2222e-08, -1 , -4 .82913e-08, -1 , 4 .2222e-08, -1 .49012e-08, 17 , 17 , 12 )
301
419
size = Vector3 (32 , 32 , 4 )
302
420
material = SubResource ("FogMaterial_yomn8" )
421
+
422
+ [node name ="FogVolumeShader" type ="FogVolume" parent ="." ]
423
+ transform = Transform3D (-2 .98023e-08, 4 .82913e-08, -1 , -4 .2222e-08, -1 , -4 .82913e-08, -1 , 4 .2222e-08, -1 .49012e-08, -34.4124 , 5 , 12 )
424
+ size = Vector3 (32 , 8 , 32 )
425
+ material = SubResource ("ShaderMaterial_481nw" )
0 commit comments