Godot Version
4.2.1
Question
I’m updating a Godot 3.5 project to 4.2
There are settings in an animation player that no longer exist in Godot 4.2. I’m not sure how to convert these.
environment:fog_depth_end
environment:fog_depth_curve
environment:fog_height_curve
environment:fog_height_min
environment:fog_height_max
environment:fog_sun_color
environment:background_energy
I did make my best effort to find new fog settings that will work, but it just doesn’t look the same.
I see background_energy_multiplier which obviously must replace background_energy, but it doesn’t seem to be working the same.
I appreciate any help you all can provide. Thank you!
Most of those settings were removed in Godot 4 as a lot of rendering features were significantly refactored. So unfortunately, there is no 1-to-1 translation between Godot 3.5 and Godot 4.
That being said, there is a PR to reintroduce those settings. It isn’t quite finished though, so I can’t say what version of Godot 4 it will make it into. It will be in 4.3 at the earliest, but only if it is finished in time
godotengine:master
← expressobits:distance-fog
opened 01:52PM - 12 Nov 23 UTC
Continuation of the PR created as a draft here https://github.com/godotengine/go… dot/pull/66030
Summary:
- `fog_mode`: Adds option to choose between normal fog called here exponential and new fog called fog depth, fog depth used in a specialization constant in the relevant scene shaders. This addresses the performance caveat discussed in https://github.com/godotengine/godot/pull/55388 by ensuring that when only exponential fog is used, the branch is never present in the compiled program. It is not possible to use quadratic fog exclusively at the shader level in this implementation, but you can set the parameters of the environment such that the exponential fog density is 0 while still having quadratic fog if you must have no exponential fog at all. During project conversion, this property should be set to true if fog was enabled, the new fog density should be set to 0, and the sky affect scale should also be set to 0.
fog_depth_curve: Same as in Godot 3.x
- `fog_density`: In fog exponential it continues with its same functionality, but in fog depth it replaces the alpha value of fog_depth_color in Godot 3.x. Project conversion should take the fog color's alpha and put it in this property instead.
- `fog_depth_begin`: Same as in Godot 3.x
- `fog_depth_end`: Same as in Godot 3.x

✅ Merged successfully
✅ Removed unnecessary pads
✅ Added enum option in the environment inspector

✅ Added conditional in shader to execute correct fog mode
I was wondering if there is a better way to define this if
scene.glsl:
```
#ifndef DISABLE_FOG_DEPTH
if (scene_data.fog_mode == 1) {
float fog_far = scene_data.fog_depth_end > 0.0 ? scene_data.fog_depth_end : scene_data.z_far;
float fog_z = smoothstep(scene_data.fog_depth_begin, fog_far, length(vertex));
float fog_quad_amount = pow(fog_z, scene_data.fog_depth_curve) * scene_data.fog_density;
fog_amount = fog_quad_amount;
}
#else
if (scene_data.fog_mode == 0) {
fog_amount = 1 - exp(min(0.0, -length(vertex) * scene_data.fog_density));
}
```
✅ Possible to add negative values in fog begin
https://github.com/godotengine/godot/assets/1673249/f44b9a2f-b946-4e59-99d3-b42ebce7510d
1 Like
system
Closed
February 26, 2024, 1:36am
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.