Merge pull request #134 from Calinou/add-fxaa-setting

This commit is contained in:
Hugo Locurcio
2022-09-11 18:56:05 +02:00
committed by GitHub
4 changed files with 78 additions and 30 deletions

View File

@@ -30,6 +30,9 @@ func _ready():
# reducing the number of draw calls significantly.
propagate_call("set", ["shadow_enabled", false])
if Settings.fxaa:
get_viewport().fxaa = true
if Settings.ssao_quality == Settings.SSAOQuality.HIGH:
world_environment.environment.ssao_enabled = true
world_environment.environment.ssao_quality = world_environment.environment.SSAO_QUALITY_HIGH

View File

@@ -33,6 +33,10 @@ onready var shadow_menu = settings_menu.get_node(@"Shadow")
onready var shadow_enabled = shadow_menu.get_node(@"Enabled")
onready var shadow_disabled = shadow_menu.get_node(@"Disabled")
onready var fxaa_menu = settings_menu.get_node(@"FXAA")
onready var fxaa_enabled = fxaa_menu.get_node(@"Enabled")
onready var fxaa_disabled = fxaa_menu.get_node(@"Disabled")
onready var ssao_menu = settings_menu.get_node(@"SSAO")
onready var ssao_high = ssao_menu.get_node(@"High")
onready var ssao_low = ssao_menu.get_node(@"Low")
@@ -133,6 +137,11 @@ func _on_settings_pressed():
else:
shadow_disabled.pressed = true
if Settings.fxaa:
fxaa_enabled.pressed = true
else:
fxaa_disabled.pressed = true
if Settings.ssao_quality == Settings.SSAOQuality.HIGH:
ssao_high.pressed = true
elif Settings.ssao_quality == Settings.SSAOQuality.LOW:
@@ -188,6 +197,7 @@ func _on_apply_pressed():
Settings.aa_quality = Settings.AAQuality.DISABLED
Settings.shadow_enabled = shadow_enabled.pressed
Settings.fxaa = fxaa_enabled.pressed
if ssao_high.pressed:
Settings.ssao_quality = Settings.SSAOQuality.HIGH

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=43 format=2]
[gd_scene load_steps=44 format=2]
[ext_resource path="res://menu/menu.gd" type="Script" id=1]
[ext_resource path="res://menu/experiment.hdr" type="Texture" id=2]
@@ -92,6 +92,8 @@ Label/styles/normal = null
[sub_resource type="ButtonGroup" id=11]
[sub_resource type="ButtonGroup" id=23]
[sub_resource type="ButtonGroup" id=22]
[sub_resource type="ButtonGroup" id=12]
@@ -208,9 +210,6 @@ margin_left = -4.10107
margin_top = 2.05054
margin_right = -4.10107
margin_bottom = 2.05054
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Play" type="TextureButton" parent="UI/Main"]
margin_left = 100.0
@@ -245,10 +244,10 @@ texture_hover = ExtResource( 12 )
[node name="Settings" type="VBoxContainer" parent="UI"]
visible = false
anchor_left = 0.109896
anchor_top = 0.268518
anchor_top = 0.23148
anchor_right = 0.808854
anchor_bottom = 0.931481
custom_constants/separation = 30
anchor_bottom = 1.00278
custom_constants/separation = 25
__meta__ = {
"_edit_use_anchors_": true
}
@@ -299,9 +298,9 @@ group = SubResource( 10 )
text = "Disabled"
[node name="AA" type="HBoxContainer" parent="UI/Settings"]
margin_top = 87.0
margin_top = 82.0
margin_right = 1342.0
margin_bottom = 144.0
margin_bottom = 139.0
custom_constants/separation = 30
__meta__ = {
"_edit_group_": true,
@@ -314,7 +313,7 @@ margin_bottom = 57.0
rect_min_size = Vector2( 400, 0 )
size_flags_vertical = 1
custom_colors/font_color = Color( 1, 1, 1, 1 )
text = "Anti Aliasing:"
text = "Antialiasing (MSAA):"
[node name="8X" type="Button" parent="UI/Settings/AA"]
margin_left = 430.0
@@ -353,10 +352,44 @@ toggle_mode = true
group = SubResource( 11 )
text = "Disabled"
[node name="Shadow" type="HBoxContainer" parent="UI/Settings"]
margin_top = 174.0
[node name="FXAA" type="HBoxContainer" parent="UI/Settings"]
margin_top = 164.0
margin_right = 1342.0
margin_bottom = 231.0
margin_bottom = 221.0
custom_constants/separation = 30
[node name="Label" type="Label" parent="UI/Settings/FXAA"]
margin_right = 400.0
margin_bottom = 57.0
rect_min_size = Vector2( 400, 0 )
size_flags_vertical = 1
custom_colors/font_color = Color( 1, 1, 1, 1 )
text = "Antialiasing (FXAA):"
[node name="Enabled" type="Button" parent="UI/Settings/FXAA"]
margin_left = 430.0
margin_right = 871.0
margin_bottom = 57.0
size_flags_horizontal = 3
toggle_mode = true
pressed = true
keep_pressed_outside = true
group = SubResource( 23 )
text = "Enabled"
[node name="Disabled" type="Button" parent="UI/Settings/FXAA"]
margin_left = 901.0
margin_right = 1342.0
margin_bottom = 57.0
size_flags_horizontal = 3
toggle_mode = true
group = SubResource( 23 )
text = "Disabled"
[node name="Shadow" type="HBoxContainer" parent="UI/Settings"]
margin_top = 246.0
margin_right = 1342.0
margin_bottom = 303.0
custom_constants/separation = 30
[node name="Label" type="Label" parent="UI/Settings/Shadow"]
@@ -366,9 +399,6 @@ margin_bottom = 55.0
rect_min_size = Vector2( 400, 0 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
text = "Shadow Mapping:"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Enabled" type="Button" parent="UI/Settings/Shadow"]
margin_left = 430.0
@@ -390,12 +420,13 @@ group = SubResource( 22 )
text = "Disabled"
[node name="SSAO" type="HBoxContainer" parent="UI/Settings"]
margin_top = 261.0
margin_top = 328.0
margin_right = 1342.0
margin_bottom = 318.0
margin_bottom = 385.0
custom_constants/separation = 30
__meta__ = {
"_edit_group_": true
"_edit_group_": true,
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="UI/Settings/SSAO"]
@@ -438,9 +469,9 @@ group = SubResource( 12 )
text = "Disabled"
[node name="Bloom" type="HBoxContainer" parent="UI/Settings"]
margin_top = 348.0
margin_top = 410.0
margin_right = 1342.0
margin_bottom = 405.0
margin_bottom = 467.0
custom_constants/separation = 30
__meta__ = {
"_edit_group_": true
@@ -486,9 +517,9 @@ group = SubResource( 13 )
text = "Disabled"
[node name="Resolution" type="HBoxContainer" parent="UI/Settings"]
margin_top = 435.0
margin_top = 492.0
margin_right = 1342.0
margin_bottom = 492.0
margin_bottom = 549.0
custom_constants/separation = 30
__meta__ = {
"_edit_group_": true
@@ -543,9 +574,9 @@ group = SubResource( 14 )
text = "540"
[node name="Fullscreen" type="HBoxContainer" parent="UI/Settings"]
margin_top = 522.0
margin_top = 574.0
margin_right = 1342.0
margin_bottom = 579.0
margin_bottom = 631.0
custom_constants/separation = 30
[node name="Label" type="Label" parent="UI/Settings/Fullscreen"]
@@ -580,15 +611,15 @@ text = "No"
[node name="HSeparator" type="HSeparator" parent="UI/Settings"]
modulate = Color( 1, 1, 1, 0 )
margin_top = 609.0
margin_top = 656.0
margin_right = 1342.0
margin_bottom = 629.0
margin_bottom = 676.0
rect_min_size = Vector2( 0, 20 )
[node name="Actions" type="HBoxContainer" parent="UI/Settings"]
margin_top = 659.0
margin_top = 701.0
margin_right = 1342.0
margin_bottom = 716.0
margin_bottom = 758.0
custom_constants/separation = 50
[node name="Apply" type="Button" parent="UI/Settings/Actions"]

View File

@@ -35,6 +35,7 @@ enum Resolution {
var gi_quality = GIQuality.LOW
var aa_quality = AAQuality.AA_2X
var shadow_enabled = true
var fxaa = true
var ssao_quality = SSAOQuality.DISABLED
var bloom_quality = BloomQuality.HIGH
var resolution = Resolution.NATIVE
@@ -70,6 +71,9 @@ func load_settings():
if "shadow_enabled" in d:
shadow_enabled = bool(d.shadow_enabled)
if "fxaa" in d:
fxaa = bool(d.fxaa)
if "ssao" in d:
ssao_quality = int(d.ssao)
@@ -88,5 +92,5 @@ func save_settings():
var error = f.open("user://settings.json", File.WRITE)
assert(not error)
var d = { "gi":gi_quality, "aa":aa_quality, "shadow_enabled":shadow_enabled, "ssao":ssao_quality, "bloom":bloom_quality, "resolution":resolution, "fullscreen":fullscreen }
var d = { "gi":gi_quality, "aa":aa_quality, "shadow_enabled":shadow_enabled, "fxaa":fxaa, "ssao":ssao_quality, "bloom":bloom_quality, "resolution":resolution, "fullscreen":fullscreen }
f.store_line(to_json(d))