Improve the 3D graphics settings demo

- New graphics settings:
  - Field of view.
  - Volumetric fog.
- Use Godot's built-in 3D viewport facilities instead of using a SubViewport.
  - This also allows for choosing AMD FidelityFX Super Resolution
    for resolution scaling, but it's not working yet due to a Godot bug.
  - Nearest-neighbor scaling is no longer available. It can be
    reimplemented in Godot core and then exposed in the future.
- Separate MSAA from FXAA settings, as both can be used at the same time.
- Add more quality settings for various effect settings.
- Rename sections and setting names to be more "player-oriented"
  (even if this results in the actual Godot terminology not being
  presented).
- Add performance hints to setting values.
- Add FPS counter and viewport resolution display
  (taking the resolution scale into account).
- Add more objects to the test scene and tweak environment settings.
  - ACES tonemapping is now used.
  - Debanding is now enabled, as this scene requires it to avoid visible
    banding.
  - Make the emissive box less bright to prevent MSAA and FXAA from
    being ineffective on it (due to Godot not supporting correct
    HDR antialiasing).
  - Remove unnecessary DirectionalLight3D, VoxelGI and ReflectionProbe.
This commit is contained in:
Hugo Locurcio
2022-04-09 00:28:37 +02:00
parent 06af3f0c2c
commit 48d2ec90fc
8 changed files with 539 additions and 390 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,21 +1,28 @@
# 3D Settings Menu (Graphical Settings)
# 3D Graphics Settings
A demo showing an example of a graphics settings menu.
A demo showing an example of a settings menu.
Included settings are:
- UI Scaling;
- Render Quality;
- Filter;
- Vsync;
- Anti-Aliasing;
- Fullscreen;
- Screen-Space Reflections;
- Ambient Occlusion;
- Indirect lightning;
- Glow;
- Brightness;
- Contrast;
- Saturation.
**Video settings:**
- UI scale.
- Resolution scale.
- Display filter (bilinear or AMD FidelityFX Super Resolution 1.0).
- Fullscreen.
- V-Sync (traditional and adaptive).
- Anti-aliasing (MSAA and FXAA).
- Camera field of view.
**Effect settings:**
- Signed distance field global illumination (SDFGI).
- Bloom (glow).
- Screen-space ambient occlusion (SSAO).
- Screen-Space reflections (SSR).
- Screen-space indirect lighting (SSIL).
- Volumetric fog.
- Screen adjustments: brightness, contrast, saturation.
Language: GDScript

View File

@@ -5,6 +5,20 @@
[ext_resource type="Texture2D" uid="uid://c5ujmv8i0y1pn" path="res://icon.png" id="3_xpykm"]
[sub_resource type="Environment" id="Environment_1f0b2"]
background_mode = 1
background_color = Color(0.6, 0.6, 0.6, 1)
tonemap_mode = 3
tonemap_white = 6.0
sdfgi_cascades = 2
sdfgi_min_cell_size = 0.1
sdfgi_cascade0_distance = 6.4
sdfgi_max_distance = 25.6
sdfgi_y_scale = 0
glow_intensity = 1.0
glow_hdr_threshold = 0.5
glow_hdr_scale = 0.2
volumetric_fog_density = 0.0
volumetric_fog_temporal_reprojection_amount = 0.95
adjustment_enabled = true
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_w3j8l"]
@@ -22,22 +36,11 @@ script = ExtResource( "1_gm54x" )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( "Environment_1f0b2" )
[node name="SubViewportContainer" type="SubViewportContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
stretch = true
[node name="SubViewport" type="SubViewport" parent="SubViewportContainer"]
handle_input_locally = false
size = Vector2i(1024, 600)
render_target_update_mode = 4
[node name="Node3D" parent="SubViewportContainer/SubViewport" instance=ExtResource( "2_hsbu5" )]
[node name="Node3D" parent="." instance=ExtResource( "2_hsbu5" )]
[node name="SettingsMenu" type="PanelContainer" parent="."]
anchor_bottom = 1.0
offset_right = 372.0
grow_horizontal = 2
offset_right = 429.0
grow_vertical = 2
theme_override_styles/panel = SubResource( "StyleBoxFlat_w3j8l" )
@@ -45,25 +48,26 @@ theme_override_styles/panel = SubResource( "StyleBoxFlat_w3j8l" )
clip_contents = false
offset_left = 20.0
offset_top = 50.0
offset_right = 352.0
offset_right = 409.0
offset_bottom = 590.0
[node name="VBoxContainer" type="VBoxContainer" parent="SettingsMenu/ScrollContainer"]
offset_right = 324.0
offset_bottom = 613.0
offset_right = 358.0
offset_bottom = 710.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 10
[node name="UISection" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_right = 324.0
offset_right = 381.0
offset_bottom = 26.0
text = "UI Section"
theme_override_colors/font_color = Color(0.683425, 0.916893, 1, 1)
text = "User Interface Settings"
horizontal_alignment = 1
[node name="GridContainer" type="GridContainer" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_top = 36.0
offset_right = 324.0
offset_right = 381.0
offset_bottom = 69.0
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -72,7 +76,7 @@ columns = 2
[node name="UIScaleLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer"]
offset_top = 3.0
offset_right = 160.0
offset_right = 188.0
offset_bottom = 29.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
@@ -80,106 +84,120 @@ text = "UI Scale:"
[node name="UIScaleOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_right = 324.0
offset_left = 192.0
offset_right = 380.0
offset_bottom = 33.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 5
selected = 2
popup/item_0/text = "Extra Small"
popup/item_0/text = "Smaller (66%)"
popup/item_0/id = 0
popup/item_1/text = "Small"
popup/item_1/text = "Small (80%)"
popup/item_1/id = 1
popup/item_2/text = "Normal"
popup/item_2/text = "Medium (100%)"
popup/item_2/id = 2
popup/item_3/text = "Big"
popup/item_3/text = "Large (133%)"
popup/item_3/id = 3
popup/item_4/text = "Extra Big"
popup/item_4/text = "Larger (200%)"
popup/item_4/id = 4
[node name="ViewportSection" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_top = 79.0
offset_right = 324.0
offset_right = 381.0
offset_bottom = 105.0
text = "Quality Section"
theme_override_colors/font_color = Color(0.683425, 0.916893, 1, 1)
text = "Video Settings"
horizontal_alignment = 1
[node name="GridContainer2" type="GridContainer" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_top = 115.0
offset_right = 324.0
offset_bottom = 296.0
offset_right = 381.0
offset_bottom = 356.0
columns = 2
[node name="QualityLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 3.0
offset_right = 160.0
offset_bottom = 29.0
offset_right = 188.0
offset_bottom = 26.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Quality:"
text = "Resolution Scale:"
[node name="QualityOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_right = 324.0
offset_bottom = 33.0
[node name="QualitySlider" type="HSlider" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_left = 192.0
offset_right = 380.0
offset_bottom = 26.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 5
selected = 2
popup/item_0/text = "Extra Low"
popup/item_0/id = 0
popup/item_1/text = "Low"
popup/item_1/id = 1
popup/item_2/text = "Medium"
popup/item_2/id = 2
popup/item_3/text = "High"
popup/item_3/id = 3
popup/item_4/text = "Extra High"
popup/item_4/id = 4
size_flags_vertical = 1
min_value = 0.25
max_value = 2.0
step = 0.05
value = 1.0
[node name="FilterLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 40.0
offset_right = 160.0
offset_bottom = 66.0
offset_top = 33.0
offset_right = 188.0
offset_bottom = 59.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Filter:"
text = "Display Filter:"
[node name="FilterOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_top = 37.0
offset_right = 324.0
offset_bottom = 70.0
offset_left = 192.0
offset_top = 30.0
offset_right = 380.0
offset_bottom = 63.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 2
selected = 1
selected = 0
popup/item_0/text = "Bilinear (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "FSR 1.0 (Fast)"
popup/item_1/id = 1
[node name="FullscreenLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 70.0
offset_right = 188.0
offset_bottom = 96.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Fullscreen:"
[node name="FullscreenOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
minimum_size = Vector2(100, 33)
offset_left = 192.0
offset_top = 67.0
offset_right = 380.0
offset_bottom = 100.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 2
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "Enabled"
popup/item_1/id = 1
[node name="VsyncLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 77.0
offset_right = 160.0
offset_bottom = 103.0
offset_top = 107.0
offset_right = 188.0
offset_bottom = 133.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Vsync:"
text = "V-Sync:"
[node name="VsyncOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_top = 74.0
offset_right = 324.0
offset_bottom = 107.0
offset_left = 192.0
offset_top = 104.0
offset_right = 380.0
offset_bottom = 137.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 3
selected = 2
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "Adaptive"
@@ -188,252 +206,313 @@ popup/item_2/text = "Enabled"
popup/item_2/id = 2
[node name="AALabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 114.0
offset_right = 160.0
offset_bottom = 140.0
offset_top = 144.0
offset_right = 188.0
offset_bottom = 170.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Anti-Aliasing:"
text = "Anti-Aliasing (MSAA):"
[node name="AAOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_top = 111.0
offset_right = 324.0
offset_bottom = 144.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 5
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "FXAA"
popup/item_1/id = 1
popup/item_2/text = "2x"
popup/item_2/id = 2
popup/item_3/text = "4x"
popup/item_3/id = 3
popup/item_4/text = "8x"
popup/item_4/id = 4
[node name="FullscreenLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 151.0
offset_right = 160.0
offset_bottom = 177.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Fullscreen:"
[node name="FullscreenOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_top = 148.0
offset_right = 324.0
offset_bottom = 181.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 2
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "Enabled"
popup/item_1/id = 1
[node name="EnvironmentSection" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_top = 306.0
offset_right = 324.0
offset_bottom = 332.0
text = "Environment Section"
horizontal_alignment = 1
[node name="GridContainer3" type="GridContainer" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_top = 342.0
offset_right = 324.0
offset_bottom = 613.0
columns = 2
[node name="SSReflectionsLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 3.0
offset_right = 160.0
offset_bottom = 29.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "SS Reflections:"
[node name="SSReflectionsOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_right = 324.0
offset_bottom = 33.0
offset_left = 192.0
offset_top = 141.0
offset_right = 380.0
offset_bottom = 174.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 4
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Low"
popup/item_1/text = "2× (Average)"
popup/item_1/id = 1
popup/item_2/text = "Medium"
popup/item_2/text = "4× (Slow)"
popup/item_2/id = 2
popup/item_3/text = "High"
popup/item_3/text = "8× (Slower)"
popup/item_3/id = 3
[node name="SSAOLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 40.0
offset_right = 160.0
offset_bottom = 66.0
[node name="FXAALabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 181.0
offset_right = 188.0
offset_bottom = 207.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "SSAO:"
text = "Anti-Aliasing (FXAA):"
[node name="SSAOOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
[node name="FXAAOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_top = 37.0
offset_right = 324.0
offset_bottom = 70.0
offset_left = 192.0
offset_top = 178.0
offset_right = 380.0
offset_bottom = 211.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 2
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Enabled"
popup/item_1/text = "FXAA (Fast)"
popup/item_1/id = 1
[node name="SSILLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 77.0
offset_right = 160.0
offset_bottom = 103.0
[node name="FOVLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_top = 215.0
offset_right = 188.0
offset_bottom = 241.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "SSIL:"
text = "Field of View:"
[node name="SSILOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_top = 74.0
offset_right = 324.0
offset_bottom = 107.0
[node name="FOVSlider" type="HSlider" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
offset_left = 192.0
offset_top = 215.0
offset_right = 380.0
offset_bottom = 241.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 2
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "Enabled"
popup/item_1/id = 1
size_flags_vertical = 1
min_value = 50.0
step = 0.1
value = 75.0
[node name="EnvironmentSection" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_top = 366.0
offset_right = 381.0
offset_bottom = 392.0
theme_override_colors/font_color = Color(0.683425, 0.916893, 1, 1)
text = "Effect Settings"
horizontal_alignment = 1
[node name="GridContainer3" type="GridContainer" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
offset_top = 402.0
offset_right = 381.0
offset_bottom = 710.0
columns = 2
[node name="SDFGILabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 114.0
offset_right = 160.0
offset_bottom = 140.0
offset_top = 3.0
offset_right = 188.0
offset_bottom = 29.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "SDFGI:"
text = "Global Illumination:"
[node name="SDFGIOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_top = 111.0
offset_right = 324.0
offset_bottom = 144.0
offset_left = 192.0
offset_right = 380.0
offset_bottom = 33.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 2
item_count = 3
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Enabled"
popup/item_1/text = "Low (Average)"
popup/item_1/id = 1
popup/item_2/text = "High (Slow)"
popup/item_2/id = 2
[node name="GlowLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 151.0
offset_right = 160.0
offset_bottom = 177.0
offset_top = 40.0
offset_right = 188.0
offset_bottom = 66.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Glow:"
text = "Bloom:"
[node name="GlowOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 164.0
offset_left = 192.0
offset_top = 37.0
offset_right = 380.0
offset_bottom = 70.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 3
selected = 0
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Low (Fast)"
popup/item_1/id = 1
popup/item_2/text = "High (Average)"
popup/item_2/id = 2
[node name="SSAOLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 77.0
offset_right = 188.0
offset_bottom = 103.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Ambient Occlusion:"
[node name="SSAOOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 192.0
offset_top = 74.0
offset_right = 380.0
offset_bottom = 107.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 5
selected = 0
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Very Low (Fast)"
popup/item_1/id = 1
popup/item_2/text = "Low (Fast)"
popup/item_2/id = 2
popup/item_3/text = "Medium (Average)"
popup/item_3/id = 3
popup/item_4/text = "High (Slow)"
popup/item_4/id = 4
[node name="SSReflectionsLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 116.0
offset_right = 188.0
offset_bottom = 139.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 14
text = "Screen-Space Reflections:"
[node name="SSReflectionsOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 192.0
offset_top = 111.0
offset_right = 380.0
offset_bottom = 144.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 4
selected = 0
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Low (Average)"
popup/item_1/id = 1
popup/item_2/text = "Medium (Slow)"
popup/item_2/id = 2
popup/item_3/text = "High (Slower)"
popup/item_3/id = 3
[node name="SSILLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 151.0
offset_right = 188.0
offset_bottom = 177.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Screen-Space Lighting:"
[node name="SSILOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 192.0
offset_top = 148.0
offset_right = 324.0
offset_right = 380.0
offset_bottom = 181.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 2
item_count = 5
selected = 0
popup/item_0/text = "Disabled"
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Enabled"
popup/item_1/text = "Very Low (Fast)"
popup/item_1/id = 1
popup/item_2/text = "Low (Average)"
popup/item_2/id = 2
popup/item_3/text = "Medium (Slow)"
popup/item_3/id = 3
popup/item_4/text = "High (Slower)"
popup/item_4/id = 4
[node name="VolumetricFogLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 188.0
offset_right = 188.0
offset_bottom = 214.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Volumetric Fog:"
[node name="VolumetricFogOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
minimum_size = Vector2(100, 33)
offset_left = 192.0
offset_top = 185.0
offset_right = 380.0
offset_bottom = 218.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
item_count = 3
selected = 0
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Low (Fast)"
popup/item_1/id = 1
popup/item_2/text = "High (Average)"
popup/item_2/id = 2
[node name="BrightnessLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 185.0
offset_right = 160.0
offset_bottom = 211.0
offset_top = 222.0
offset_right = 188.0
offset_bottom = 248.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Brightness:"
[node name="BrightnessSlider" type="HSlider" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_left = 164.0
offset_top = 185.0
offset_right = 324.0
offset_bottom = 211.0
offset_left = 192.0
offset_top = 222.0
offset_right = 380.0
offset_bottom = 248.0
size_flags_horizontal = 3
size_flags_vertical = 1
min_value = 0.5
max_value = 4.0
step = 0.2
max_value = 2.0
step = 0.01
value = 1.0
[node name="ContrastLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 215.0
offset_right = 160.0
offset_bottom = 241.0
offset_top = 252.0
offset_right = 188.0
offset_bottom = 278.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Contrast:"
[node name="ContrastSlider" type="HSlider" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_left = 164.0
offset_top = 215.0
offset_right = 324.0
offset_bottom = 241.0
offset_left = 192.0
offset_top = 252.0
offset_right = 380.0
offset_bottom = 278.0
size_flags_horizontal = 3
size_flags_vertical = 1
min_value = 0.5
max_value = 4.0
step = 0.2
max_value = 2.0
step = 0.01
value = 1.0
[node name="SaturationLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_top = 245.0
offset_right = 160.0
offset_bottom = 271.0
offset_top = 282.0
offset_right = 188.0
offset_bottom = 308.0
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 16
text = "Saturation:"
[node name="SaturationSlider" type="HSlider" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3"]
offset_left = 164.0
offset_top = 245.0
offset_right = 324.0
offset_bottom = 271.0
offset_left = 192.0
offset_top = 282.0
offset_right = 380.0
offset_bottom = 308.0
size_flags_horizontal = 3
size_flags_vertical = 1
min_value = 0.5
max_value = 10.0
step = 0.2
min_value = 0.01
max_value = 2.0
step = 0.01
value = 1.0
[node name="HideShowButton" type="CheckButton" parent="."]
[node name="HideShowButton" type="Button" parent="."]
offset_right = 149.0
offset_bottom = 31.0
focus_mode = 0
theme_override_font_sizes/font_size = 16
toggle_mode = true
button_pressed = true
text = "Hide settings"
@@ -448,17 +527,40 @@ grow_horizontal = 0
grow_vertical = 0
texture = ExtResource( "3_xpykm" )
[node name="FPSLabel" type="Label" parent="."]
anchor_left = 1.0
anchor_right = 1.0
offset_left = -56.0
offset_top = 16.0
offset_right = -16.0
offset_bottom = 39.0
grow_horizontal = 0
horizontal_alignment = 2
[node name="ResolutionLabel" type="Label" parent="."]
anchor_left = 1.0
anchor_right = 1.0
offset_left = -56.0
offset_top = 48.0
offset_right = -16.0
offset_bottom = 71.0
grow_horizontal = 0
horizontal_alignment = 2
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer/UIScaleOptionButton" to="." method="_on_ui_scale_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/QualityOptionButton" to="." method="_on_quality_option_button_item_selected"]
[connection signal="value_changed" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/QualitySlider" to="." method="_on_quality_slider_value_changed"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FilterOptionButton" to="." method="_on_filter_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FullscreenOptionButton" to="." method="_on_fullscreen_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/VsyncOptionButton" to="." method="_on_vsync_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/AAOptionButton" to="." method="_on_aa_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FullscreenOptionButton" to="." method="_on_fullscreen_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SSReflectionsOptionButton" to="." method="_on_ss_reflections_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SSAOOptionButton" to="." method="_on_ssao_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SSILOptionButton" to="." method="_on_ssil_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FXAAOptionButton" to="." method="_on_fxaa_option_button_item_selected"]
[connection signal="value_changed" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FOVSlider" to="." method="_on_fov_slider_value_changed"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SDFGIOptionButton" to="." method="_on_sdfgi_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/GlowOptionButton" to="." method="_on_glow_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SSAOOptionButton" to="." method="_on_ssao_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SSReflectionsOptionButton" to="." method="_on_ss_reflections_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SSILOptionButton" to="." method="_on_ssil_option_button_item_selected"]
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/VolumetricFogOptionButton" to="." method="_on_volumetric_fog_option_button_item_selected"]
[connection signal="value_changed" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/BrightnessSlider" to="." method="_on_brightness_slider_value_changed"]
[connection signal="value_changed" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/ContrastSlider" to="." method="_on_contrast_slider_value_changed"]
[connection signal="value_changed" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer3/SaturationSlider" to="." method="_on_saturation_slider_value_changed"]

View File

@@ -10,7 +10,7 @@ config_version=5
[application]
config/name="3D Graphics Settings Demo"
config/name="3D Graphics Settings"
run/main_scene="res://control.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0", "Vulkan Clustered")
@@ -19,3 +19,7 @@ config/features=PackedStringArray("4.0", "Vulkan Clustered")
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[rendering]
anti_aliasing/quality/use_debanding=true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 299 KiB

View File

@@ -1,33 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dv27oyy6q3nuj"
path="res://.godot/imported/interface.png-d66f41b9831e9844ce0f39a7fbe98037.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://screenshots/interface.png"
dest_files=["res://.godot/imported/interface.png-d66f41b9831e9844ce0f39a7fbe98037.ctex"]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,23 +1,39 @@
extends Control
# Window project settings:
# - Viewport size is set to 1920x1080
# - Stretch mode is set to "canvas_items" (in godot 3.x known as 2d)
# - Stretch aspect is set to "expand"
@onready var sub_viewport := $SubViewportContainer/SubViewport
@onready var sub_viewport_container := $SubViewportContainer
@onready var world_environment := $WorldEnvironment
var current_quality := 2 # This is needed for when screen size changes
var viewport_start_size := Vector2.ZERO
# Window project settings:
# - Stretch mode is set to `canvas_items` (`2d` in Godot 3.x)
# - Stretch aspect is set to `expand`
@onready var world_environment := $WorldEnvironment
@onready var camera := $Node3D/Camera3D
@onready var fps_label := $FPSLabel
@onready var resolution_label := $ResolutionLabel
# When the screen changes size, we need to update the 3D
# viewport quality setting. If we don't do this, the viewport will take
# the size from the main viewport.
var viewport_start_size := Vector2(
ProjectSettings.get_setting(&"display/window/size/viewport_width"),
ProjectSettings.get_setting(&"display/window/size/viewport_height")
)
func _ready() -> void:
# When the screen changes size, we need to update the 3D
# viewport quality setting. If we don't do this, the viewport will take
# the size from the main viewport.
viewport_start_size.x = ProjectSettings.get_setting(&"display/window/size/viewport_width")
viewport_start_size.y = ProjectSettings.get_setting(&"display/window/size/viewport_height")
sub_viewport.connect(&"size_changed", self._on_quality_option_button_item_selected)
get_viewport().connect(&"size_changed", update_resolution_label)
update_resolution_label()
# Disable V-Sync to uncap framerate on supported platforms. This makes performance comparison
# easier on high-end machines that easily reach the monitor's refresh rate.
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
func _process(delta: float) -> void:
fps_label.text = "%d FPS (%.2f mspf)" % [Engine.get_frames_per_second(), 1000.0 / Engine.get_frames_per_second()]
func update_resolution_label() -> void:
var viewport_render_size = get_viewport().size * get_viewport().scaling_3d_scale
resolution_label.text = "3D viewport resolution: %d × %d (%d%%)" \
% [viewport_render_size.x, viewport_render_size.y, round(get_viewport().scaling_3d_scale * 100)]
func _on_HideShowButton_toggled(show_settings: bool) -> void:
@@ -34,50 +50,40 @@ func _on_HideShowButton_toggled(show_settings: bool) -> void:
func _on_ui_scale_option_button_item_selected(index: int) -> void:
# For changing the UI, we take the viewport size, which we set in the project settings.
var new_size := viewport_start_size
if index == 0: # Extra small
new_size *= 1.50
elif index == 1: # Small
if index == 0: # Smaller (66%)
new_size *= 1.5
elif index == 1: # Small (80%)
new_size *= 1.25
elif index == 2: # Normal
elif index == 2: # Medium (100%)
new_size *= 1.0
elif index == 3: # Big
elif index == 3: # Large (133%)
new_size *= 0.75
elif index == 4: # Extra big
new_size *= 0.50
elif index == 4: # Larger (200%)
new_size *= 0.5
get_tree().root.set_content_scale_size(new_size)
func _on_quality_option_button_item_selected(index: int = current_quality) -> void:
# Setting the overal screen quality can be done by changing
# the sub viewport size. When the screen size changed, this function
# will get called with the current_quality variable.
var new_size : Vector2
current_quality = index
if index == 0: # Extra low
new_size = get_viewport().size * 0.50
elif index == 1: # Low
new_size = get_viewport().size * 0.75
elif index == 2: # Medium
new_size = get_viewport().size
elif index == 3: # High
new_size = get_viewport().size * 1.25
elif index == 4: # Extra high
new_size = get_viewport().size * 1.50
sub_viewport.set_size(new_size)
func _on_quality_slider_value_changed(value: float) -> void:
get_viewport().scaling_3d_scale = value
update_resolution_label()
func _on_filter_option_button_item_selected(index: int) -> void:
# Texture filter setting. This can smooth out hard edges, but can also make
# the scene appear more blurry when quality is set to low.
if index == 0: # Disabled
sub_viewport_container.set_texture_filter(CanvasItem.TEXTURE_FILTER_NEAREST)
elif index == 1: # Enabled
sub_viewport_container.set_texture_filter(CanvasItem.TEXTURE_FILTER_LINEAR)
# Viewport scale mode setting.
if index == 0: # Bilinear (Fastest)
get_viewport().scaling_3d_mode = Viewport.SCALING_3D_MODE_BILINEAR
elif index == 1: # FSR 1.0 (Fast)
push_warning("FSR is currently not working. The shader is run, but no visual difference appears on screen.")
get_viewport().scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR
func _on_vsync_option_button_item_selected(index: int) -> void:
# Vsync is enabled by default.
# Vertical synchronization locks framerate and makes screen tearing not visible.
# Vertical synchronization locks framerate and makes screen tearing not visible at the cost of
# higher input latency and stuttering when the framerate target is not met.
# Adaptive V-Sync automatically disables V-Sync when the framerate target is not met, and enables
# V-Sync otherwise. This prevents suttering and reduces input latency when the framerate target
# is not met, at the cost of visible tearing.
if index == 0: # Disabled
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
elif index == 1: # Adaptive
@@ -87,25 +93,22 @@ func _on_vsync_option_button_item_selected(index: int) -> void:
func _on_aa_option_button_item_selected(index: int) -> void:
# Because this option is only for the 3D objects, we need to
# change this setting on the sub viewport.
# MSAA = Better quality at a higher performance cost.
# FXAA = Low performance cost but can appear blurry.
# Multi-sample anti-aliasing. High quality, but slow. It also does not smooth out the edges of
# transparent (alpha scissor) textures.
if index == 0: # Disabled
sub_viewport.set_msaa(Viewport.MSAA_DISABLED)
sub_viewport.set_screen_space_aa(Viewport.SCREEN_SPACE_AA_DISABLED)
elif index == 1: # FXAA
sub_viewport.set_msaa(Viewport.MSAA_DISABLED)
sub_viewport.set_screen_space_aa(Viewport.SCREEN_SPACE_AA_FXAA)
elif index == 2: # 2x
sub_viewport.set_msaa(Viewport.MSAA_2X)
sub_viewport.set_screen_space_aa(Viewport.SCREEN_SPACE_AA_DISABLED)
elif index == 3: # 4x
sub_viewport.set_msaa(Viewport.MSAA_4X)
sub_viewport.set_screen_space_aa(Viewport.SCREEN_SPACE_AA_DISABLED)
elif index == 4: # 8x
sub_viewport.set_msaa(Viewport.MSAA_8X)
sub_viewport.set_screen_space_aa(Viewport.SCREEN_SPACE_AA_DISABLED)
get_viewport().msaa = Viewport.MSAA_DISABLED
elif index == 1: # 2×
get_viewport().msaa = Viewport.MSAA_2X
elif index == 2: # 4×
get_viewport().msaa = Viewport.MSAA_4X
elif index == 3: # 8×
get_viewport().msaa = Viewport.MSAA_8X
func _on_fxaa_option_button_item_selected(index: int) -> void:
# Fast approximate anti-aliasing. Much faster than FXAA (and works on alpha scissor edges),
# but blurs the whole scene rendering slightly.
get_viewport().screen_space_aa = index == 1
func _on_fullscreen_option_button_item_selected(index: int) -> void:
@@ -118,6 +121,10 @@ func _on_fullscreen_option_button_item_selected(index: int) -> void:
get_tree().root.set_mode(Window.MODE_FULLSCREEN)
func _on_fov_slider_value_changed(value: float) -> void:
camera.fov = value
func _on_ss_reflections_option_button_item_selected(index: int) -> void:
# This is a setting that is attached to the environment.
# If your game requires you to change the environment,
@@ -132,19 +139,27 @@ func _on_ss_reflections_option_button_item_selected(index: int) -> void:
world_environment.environment.set_ssr_max_steps(32)
elif index == 3: # High
world_environment.environment.set_ssr_enabled(true)
world_environment.environment.set_ssr_max_steps(64)
# We set the fade in higher (default is 0.15) so it looks
# a better and cleaner.
world_environment.environment.set_ssr_fade_in(0.7)
world_environment.environment.set_ssr_max_steps(56)
func _on_ssao_option_button_item_selected(index: int) -> void:
# This is a setting that is attached to the environment.
# If your game requires you to change the environment,
# then be sure to run this function again to set the settings correct.
if index == 0: # Disabled
world_environment.environment.set_ssao_enabled(false)
elif index == 1: # Enabled
world_environment.environment.set_ssao_enabled(true)
world_environment.environment.ssao_enabled = false
if index == 1: # Very Low
world_environment.environment.ssao_enabled = true
RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_VERY_LOW, true, 0.5, 2, 50, 300)
if index == 2: # Low
world_environment.environment.ssao_enabled = true
RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_VERY_LOW, true, 0.5, 2, 50, 300)
if index == 3: # Medium
world_environment.environment.ssao_enabled = true
RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_MEDIUM, true, 0.5, 2, 50, 300)
if index == 4: # High
world_environment.environment.ssao_enabled = true
RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_HIGH, true, 0.5, 2, 50, 300)
func _on_ssil_option_button_item_selected(index: int) -> void:
@@ -152,9 +167,19 @@ func _on_ssil_option_button_item_selected(index: int) -> void:
# If your game requires you to change the environment,
# then be sure to run this function again to set the settings correct.
if index == 0: # Disabled
world_environment.environment.set_ssil_enabled(false)
elif index == 1: # Enabled
world_environment.environment.set_ssil_enabled(true)
world_environment.environment.ssil_enabled = false
if index == 1: # Very Low
world_environment.environment.ssil_enabled = true
RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_VERY_LOW, true, 0.5, 4, 50, 300)
if index == 2: # Low
world_environment.environment.ssil_enabled = true
RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_LOW, true, 0.5, 4, 50, 300)
if index == 3: # Medium
world_environment.environment.ssil_enabled = true
RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_MEDIUM, true, 0.5, 4, 50, 300)
if index == 4: # High
world_environment.environment.ssil_enabled = true
RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_HIGH, true, 0.5, 4, 50, 300)
func _on_sdfgi_option_button_item_selected(index: int) -> void:
@@ -162,9 +187,13 @@ func _on_sdfgi_option_button_item_selected(index: int) -> void:
# If your game requires you to change the environment,
# then be sure to run this function again to set the settings correct.
if index == 0: # Disabled
world_environment.environment.set_sdfgi_enabled(false)
elif index == 1: # Enabled
world_environment.environment.set_sdfgi_enabled(true)
world_environment.environment.sdfgi_enabled = false
if index == 1: # Low
world_environment.environment.sdfgi_enabled = true
RenderingServer.gi_set_use_half_resolution(true)
if index == 2: # High
world_environment.environment.sdfgi_enabled = true
RenderingServer.gi_set_use_half_resolution(false)
func _on_glow_option_button_item_selected(index: int) -> void:
@@ -172,9 +201,24 @@ func _on_glow_option_button_item_selected(index: int) -> void:
# If your game requires you to change the environment,
# then be sure to run this function again to set the settings correct.
if index == 0: # Disabled
world_environment.environment.set_glow_enabled(false)
elif index == 1: # Enabled
world_environment.environment.set_glow_enabled(true)
world_environment.environment.glow_enabled = false
if index == 1: # Low
world_environment.environment.glow_enabled = true
RenderingServer.environment_glow_set_use_high_quality(false)
if index == 2: # High
world_environment.environment.glow_enabled = true
RenderingServer.environment_glow_set_use_high_quality(true)
func _on_volumetric_fog_option_button_item_selected(index: int) -> void:
if index == 0: # Disabled
world_environment.environment.volumetric_fog_enabled = false
if index == 1: # Low
world_environment.environment.volumetric_fog_enabled = true
RenderingServer.environment_set_volumetric_fog_filter_active(false)
if index == 2: # High
world_environment.environment.volumetric_fog_enabled = true
RenderingServer.environment_set_volumetric_fog_filter_active(true)
func _on_brightness_slider_value_changed(value: float) -> void: