Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallbacks and mention non-working features when using Compatibility or the Web platform #1132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions 2d/particles/particles.tscn

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions 2d/particles/pause.gd
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
extends Label

var is_compatibility := false


func _ready() -> void:
if ProjectSettings.get_setting_with_override("rendering/renderer/rendering_method") == "gl_compatibility":
is_compatibility = true
text = "Space: Pause/Resume\nG: Toggle glow\n\n\n"
get_parent().get_node("UnsupportedLabel").visible = true
# Increase glow intensity to compensate for lower dynamic range.
get_node("../..").environment.glow_intensity = 4.0


func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_pause"):
get_tree().paused = not get_tree().paused

if event.is_action_pressed("toggle_trails"):
if not is_compatibility and event.is_action_pressed("toggle_trails"):
# Particles disappear if trail type is changed while paused.
# Prevent changing particle type while paused to avoid confusion.
for particles in get_tree().get_nodes_in_group("trailable_particles"):
particles.trail_enabled = not particles.trail_enabled

if event.is_action_pressed("increase_trail_length"):
if not is_compatibility and event.is_action_pressed("increase_trail_length"):
# Particles disappear if trail type is changed while paused.
# Prevent changing particle type while paused to avoid confusion.
for particles in get_tree().get_nodes_in_group("trailable_particles"):
particles.trail_lifetime = clampf(particles.trail_lifetime + 0.05, 0.1, 1.0)

if event.is_action_pressed("decrease_trail_length"):
if not is_compatibility and event.is_action_pressed("decrease_trail_length"):
# Particles disappear if trail type is changed while paused.
# Prevent changing particle type while paused to avoid confusion.
for particles in get_tree().get_nodes_in_group("trailable_particles"):
Expand Down
17 changes: 9 additions & 8 deletions 2d/particles/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ config_version=5

[application]

config/name="2D GPUParticles3D"
config/name="2D GPUParticles"
config/description="This demo showcases how 2D particle systems work in Godot."
config/tags=PackedStringArray("2d", "demo", "official", "rendering")
run/main_scene="res://particles.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
config/icon="res://icon.webp"

[debug]
Expand All @@ -30,28 +30,28 @@ window/stretch/aspect="expand"

toggle_pause={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194313,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194313,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
toggle_trails={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":84,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":84,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
increase_trail_length={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
decrease_trail_length={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
toggle_glow={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":71,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":71,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

Expand All @@ -60,3 +60,4 @@ toggle_glow={
renderer/rendering_method="mobile"
environment/defaults/default_clear_color=Color(0, 0, 0, 1)
anti_aliasing/quality/msaa_2d=2
anti_aliasing/quality/msaa_2d.web=0
6 changes: 6 additions & 0 deletions 2d/polygons_lines/polygons_lines.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
extends Node2D


func _ready() -> void:
if ProjectSettings.get_setting_with_override("rendering/renderer/rendering_method") == "gl_compatibility":
$MSAA.visible = false
$UnsupportedLabel.visible = true


func _on_msaa_option_button_item_selected(index: int) -> void:
get_viewport().msaa_2d = index as Viewport.MSAA
13 changes: 11 additions & 2 deletions 2d/polygons_lines/polygons_lines.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,24 @@ text = "MSAA 2D"

[node name="OptionButton" type="OptionButton" parent="MSAA"]
layout_mode = 2
item_count = 4
selected = 0
item_count = 4
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "2× (Average)"
popup/item_1/id = 1
popup/item_2/text = "4× (Slow)"
popup/item_2/id = 2
popup/item_3/text = "8× (Slowest)"
popup/item_3/id = 3

[node name="UnsupportedLabel" type="Label" parent="."]
visible = false
self_modulate = Color(1, 1, 1, 0.6)
offset_left = 24.0
offset_top = 24.0
offset_right = 282.0
offset_bottom = 47.0
text = "MSAA 2D is not supported
in the Compatibility rendering method."

[connection signal="item_selected" from="MSAA/OptionButton" to="." method="_on_msaa_option_button_item_selected"]
2 changes: 1 addition & 1 deletion 2d/polygons_lines/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ config/description="A demo of solid and textured 2D polygons and lines using Pol
2D antialiasing is also showcased using two techniques:
MSAA 2D and a specially crafted texture applied to a Line2D node."
run/main_scene="res://polygons_lines.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
run/low_processor_mode=true
config/icon="res://icon.webp"

Expand Down
24 changes: 21 additions & 3 deletions 3d/antialiasing/anti_aliasing.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,23 @@ var base_height := int(ProjectSettings.get_setting("display/window/size/viewport
@onready var camera: Camera3D = $CameraHolder/RotationX/Camera3D
@onready var fps_label: Label = $FPSLabel

var is_compatibility := false


func _ready() -> void:
if ProjectSettings.get_setting_with_override("rendering/renderer/rendering_method") == "gl_compatibility":
is_compatibility = true
# Hide unsupported features.
$Antialiasing/FXAAContainer.visible = false
$Antialiasing/TAAContainer.visible = false

# Darken the light's energy to compensate for sRGB blending (without affecting sky rendering).
$DirectionalLight3D.sky_mode = DirectionalLight3D.SKY_MODE_SKY_ONLY
var new_light: DirectionalLight3D = $DirectionalLight3D.duplicate()
new_light.light_energy = 0.3
new_light.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
add_child(new_light)

# 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)
Expand Down Expand Up @@ -99,9 +115,11 @@ func _on_render_scale_value_changed(value: float) -> void:
$Antialiasing/RenderScaleContainer/Value.text = "%d%%" % (value * 100)
# Update viewport resolution text.
_on_viewport_size_changed()
# FSR 1.0 is only effective if render scale is below 100%, so hide the setting if at native resolution or higher.
$Antialiasing/FidelityFXFSR.visible = value < 1.0
$Antialiasing/FSRSharpness.visible = get_viewport().scaling_3d_mode == Viewport.SCALING_3D_MODE_FSR and value < 1.0
if not is_compatibility:
# Only show the feature if supported.
# FSR 1.0 is only effective if render scale is below 100%, so hide the setting if at native resolution or higher.
$Antialiasing/FidelityFXFSR.visible = value < 1.0
$Antialiasing/FSRSharpness.visible = get_viewport().scaling_3d_mode == Viewport.SCALING_3D_MODE_FSR and value < 1.0


func _on_amd_fidelityfx_fsr1_toggled(button_pressed: bool) -> void:
Expand Down
15 changes: 5 additions & 10 deletions 3d/antialiasing/anti_aliasing.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,9 @@ vertical_alignment = 1
[node name="MSAA" type="OptionButton" parent="Antialiasing/MSAAContainer"]
custom_minimum_size = Vector2(235, 2.08165e-12)
layout_mode = 2
item_count = 4
selected = 0
item_count = 4
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "2× (Average)"
popup/item_1/id = 1
popup/item_2/text = "4× (Slow)"
Expand All @@ -927,10 +926,9 @@ vertical_alignment = 1
[node name="FXAA" type="OptionButton" parent="Antialiasing/FXAAContainer"]
custom_minimum_size = Vector2(235, 2.08165e-12)
layout_mode = 2
item_count = 2
selected = 0
item_count = 2
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Enabled (Fast)"
popup/item_1/id = 1

Expand All @@ -950,10 +948,9 @@ vertical_alignment = 1
[node name="TAA" type="OptionButton" parent="Antialiasing/TAAContainer"]
custom_minimum_size = Vector2(235, 2.08165e-12)
layout_mode = 2
item_count = 2
selected = 0
item_count = 2
popup/item_0/text = "Disabled (Fastest)"
popup/item_0/id = 0
popup/item_1/text = "Enabled (Average)"
popup/item_1/id = 1

Expand All @@ -972,10 +969,9 @@ vertical_alignment = 1
[node name="VSync" type="OptionButton" parent="Antialiasing/VSyncContainer"]
custom_minimum_size = Vector2(235, 2.08165e-12)
layout_mode = 2
item_count = 3
selected = 0
item_count = 3
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "Adaptive"
popup/item_1/id = 1
popup/item_2/text = "Enabled"
Expand Down Expand Up @@ -1053,10 +1049,9 @@ text = "AMD FidelityFX Super Resolution 1.0"
[node name="FSRSharpness" type="OptionButton" parent="Antialiasing"]
visible = false
layout_mode = 2
item_count = 5
selected = 3
item_count = 5
popup/item_0/text = "No FSR Sharpness"
popup/item_0/id = 0
popup/item_1/text = "Low FSR Sharpness"
popup/item_1/id = 1
popup/item_2/text = "Medium FSR Sharpness"
Expand Down
2 changes: 2 additions & 0 deletions 3d/antialiasing/polyhaven/dutch_ship_medium_1k.gltf.import
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
Expand All @@ -28,6 +29,7 @@ animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=0
Expand Down
2 changes: 1 addition & 1 deletion 3d/antialiasing/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config/name="3D Anti-Aliasing"
config/description="This project showcases the various 3D antialiasing techniques supported by Godot."
config/tags=PackedStringArray("3d", "demo", "official")
run/main_scene="res://anti_aliasing.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
config/icon="res://icon.webp"

[debug]
Expand Down
9 changes: 9 additions & 0 deletions 3d/csg/csg.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ var base_height := int(ProjectSettings.get_setting("display/window/size/viewport
@onready var rotation_x: Node3D = $CameraHolder/RotationX
@onready var camera: Camera3D = $CameraHolder/RotationX/Camera3D


func _ready() -> void:
if ProjectSettings.get_setting_with_override("rendering/renderer/rendering_method") == "gl_compatibility":
# Darken the light's energy to compensate for sRGB blending (without affecting sky rendering).
$DirectionalLight3D.sky_mode = DirectionalLight3D.SKY_MODE_SKY_ONLY
var new_light: DirectionalLight3D = $DirectionalLight3D.duplicate()
new_light.light_energy = 0.3
new_light.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
add_child(new_light)

camera_holder.transform.basis = Basis.from_euler(Vector3(0, rot_y, 0))
rotation_x.transform.basis = Basis.from_euler(Vector3(rot_x, 0, 0))
update_gui()
Expand Down
1 change: 1 addition & 0 deletions 3d/global_illumination/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ lights_and_shadows/directional_shadow/soft_shadow_filter_quality=3
lights_and_shadows/positional_shadow/soft_shadow_filter_quality=3
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_debanding=true
anti_aliasing/quality/msaa_3d.web=2
Loading