mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-05 23:40:07 +01:00
Add fallbacks and mention non-working features when using Compatibility or the Web platform (#1132)
- Make 3D lights with shadows darker when using Compatibility to better
match the appearance of Forward+/Mobile, due to the use of sRGB blending
for those lights.
- Silence some warnings when running projects with the Compatibility
rendering method, such as the one about 2D MSAA not being supported.
- Rebake lightmaps in Global Illumination to improve quality and reduce
light leaking with improvements from 4.3.
- Increase probe density for dynamic objects, and mark the moving box
as a dynamic object for GI purposes.
This is done to improve the experience with the web-based demos,
which always run with the Compatibility rendering method.
This commit is contained in:
@@ -721,3 +721,18 @@ T: Toggle particle trails
|
||||
Up/Down arrows: Adjust particle trail length
|
||||
G: Toggle glow"
|
||||
script = ExtResource("6_5a71v")
|
||||
|
||||
[node name="UnsupportedLabel" type="Label" parent="CanvasLayer"]
|
||||
process_mode = 3
|
||||
visible = false
|
||||
self_modulate = Color(1, 1, 1, 0.6)
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 16.0
|
||||
offset_top = -65.0
|
||||
offset_right = 357.0
|
||||
offset_bottom = -16.0
|
||||
grow_vertical = 0
|
||||
text = "Trails are not supported
|
||||
in the Compatibility rendering method."
|
||||
|
||||
@@ -1,23 +1,34 @@
|
||||
extends Label
|
||||
|
||||
var is_compatibility := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_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"):
|
||||
|
||||
@@ -10,7 +10,7 @@ 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"
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_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
|
||||
|
||||
@@ -146,10 +146,9 @@ 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)"
|
||||
@@ -157,4 +156,14 @@ 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"]
|
||||
|
||||
@@ -15,7 +15,23 @@ var camera_distance := 2.0
|
||||
@onready var camera: Camera3D = $CameraHolder/RotationX/Camera3D
|
||||
@onready var fps_label: Label = $FPSLabel
|
||||
|
||||
var is_compatibility := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_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)
|
||||
@@ -98,9 +114,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:
|
||||
|
||||
@@ -905,7 +905,6 @@ layout_mode = 2
|
||||
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)"
|
||||
@@ -932,7 +931,6 @@ layout_mode = 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
|
||||
|
||||
@@ -955,7 +953,6 @@ layout_mode = 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
|
||||
|
||||
@@ -977,7 +974,6 @@ layout_mode = 2
|
||||
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"
|
||||
@@ -1058,7 +1054,6 @@ layout_mode = 2
|
||||
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"
|
||||
|
||||
@@ -14,7 +14,16 @@ var camera_distance := 4.0
|
||||
@onready var rotation_x: Node3D = $CameraHolder/RotationX
|
||||
@onready var camera: Camera3D = $CameraHolder/RotationX/Camera3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,15 +9,6 @@ enum GIMode {
|
||||
MAX, # Maximum value of the enum, used internally.
|
||||
}
|
||||
|
||||
# Keep this in sync with the GIMode enum (except for MAX).
|
||||
const GI_MODE_TEXTS = [
|
||||
"Environment Lighting (Fastest)",
|
||||
"Baked Lightmap All (Fast)",
|
||||
"Baked Lightmap Indirect (Average)",
|
||||
"VoxelGI (Slow)",
|
||||
"SDFGI (Slow)",
|
||||
]
|
||||
|
||||
enum ReflectionProbeMode {
|
||||
NONE,
|
||||
ONCE,
|
||||
@@ -25,13 +16,6 @@ enum ReflectionProbeMode {
|
||||
MAX,
|
||||
}
|
||||
|
||||
# Keep this in sync with the ReflectionProbeMode enum (except for MAX).
|
||||
const REFLECTION_PROBE_MODE_TEXTS = [
|
||||
"Disabled - Using environment, VoxelGI or SDFGI reflections (Fast)",
|
||||
"Enabled - \"Once\" Update Mode (Average)",
|
||||
"Enabled - \"Always\" Update Mode (Slow)",
|
||||
]
|
||||
|
||||
enum SSILMode {
|
||||
NONE,
|
||||
SSAO,
|
||||
@@ -48,10 +32,31 @@ const SSIL_MODE_TEXTS = [
|
||||
"SSAO + SSIL (Slow)",
|
||||
]
|
||||
|
||||
# Keep this in sync with the ReflectionProbeMode enum (except for MAX).
|
||||
var reflection_probe_mode_texts: Array[String] = [
|
||||
"Disabled - Using environment, VoxelGI or SDFGI reflections (Fast)",
|
||||
"Enabled - \"Once\" Update Mode (Average)",
|
||||
"Enabled - \"Always\" Update Mode (Slow)",
|
||||
]
|
||||
|
||||
# Keep this in sync with the GIMode enum (except for MAX).
|
||||
var gi_mode_texts: Array[String] = [
|
||||
"Environment Lighting (Fastest)",
|
||||
"Baked Lightmap All (Fast)",
|
||||
"Baked Lightmap Indirect (Average)",
|
||||
"VoxelGI (Slow)",
|
||||
"SDFGI (Slow)",
|
||||
]
|
||||
|
||||
var gi_mode := GIMode.NONE
|
||||
var reflection_probe_mode := ReflectionProbeMode.NONE
|
||||
var ssil_mode := SSILMode.NONE
|
||||
var is_compatibility := false
|
||||
|
||||
# This is replaced further below if using Compatibility to point to a newly created DirectionalLight3D
|
||||
# (which does not affect sky rendering).
|
||||
@onready var sun: DirectionalLight3D = $Sun
|
||||
@onready var lightmap_gi_all_data: LightmapGIData = $LightmapGIAll.light_data
|
||||
@onready var environment: Environment = $WorldEnvironment.environment
|
||||
@onready var gi_mode_label: Label = $GIMode
|
||||
@onready var reflection_probe_mode_label: Label = $ReflectionProbeMode
|
||||
@@ -59,20 +64,44 @@ var ssil_mode := SSILMode.NONE
|
||||
@onready var ssil_mode_label: Label = $SSILMode
|
||||
|
||||
# Several copies of the level mesh are required to cycle between different GI modes.
|
||||
@onready var zdm2_no_lightmap: Node3D = $Zdm2NoLightmap
|
||||
@onready var zdm2_lightmap_all: Node3D = $Zdm2LightmapAll
|
||||
@onready var zdm2_lightmap_indirect: Node3D = $Zdm2LightmapIndirect
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_gi_mode(gi_mode)
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
is_compatibility = true
|
||||
# Remove unsupported VoxelGI/SDFGI references from the label.
|
||||
reflection_probe_mode_texts[0] = "Disabled - Using environment reflections (Fast)"
|
||||
set_gi_mode(GIMode.NONE)
|
||||
# Darken lights's energy to compensate for sRGB blending (without affecting sky rendering).
|
||||
# This only applies to lights with shadows enabled.
|
||||
$GrateOmniLight.light_energy = 0.25
|
||||
$GarageOmniLight.light_energy = 0.5
|
||||
sun.sky_mode = DirectionalLight3D.SKY_MODE_SKY_ONLY
|
||||
sun = sun.duplicate()
|
||||
sun.light_energy = 0.15
|
||||
sun.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
|
||||
add_child(sun)
|
||||
$Help.text = """Space: Cycle between GI modes
|
||||
R: Cycle between reflection probe modes
|
||||
Escape or F10: Toggle mouse capture"""
|
||||
else:
|
||||
set_gi_mode(gi_mode)
|
||||
|
||||
set_reflection_probe_mode(reflection_probe_mode)
|
||||
set_ssil_mode(ssil_mode)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("cycle_gi_mode"):
|
||||
set_gi_mode(wrapi(gi_mode + 1, 0, GIMode.MAX))
|
||||
if is_compatibility:
|
||||
# Only LightmapGI is supported in Compatibility.
|
||||
# Note that the actual GI mode is the opposite of what's being set here, due to a bug
|
||||
# in the Compatibility rendering method.
|
||||
set_gi_mode(wrapi(gi_mode + 1, 0, GIMode.VOXEL_GI))
|
||||
else:
|
||||
set_gi_mode(wrapi(gi_mode + 1, 0, GIMode.MAX))
|
||||
|
||||
if event.is_action_pressed("cycle_reflection_probe_mode"):
|
||||
set_reflection_probe_mode(wrapi(reflection_probe_mode + 1, 0, ReflectionProbeMode.MAX))
|
||||
@@ -83,12 +112,15 @@ func _input(event: InputEvent) -> void:
|
||||
|
||||
func set_gi_mode(p_gi_mode: GIMode) -> void:
|
||||
gi_mode = p_gi_mode
|
||||
gi_mode_label.text = "Global illumination: %s " % GI_MODE_TEXTS[gi_mode]
|
||||
gi_mode_label.text = "Global illumination: %s " % gi_mode_texts[gi_mode]
|
||||
|
||||
match p_gi_mode:
|
||||
GIMode.NONE:
|
||||
$Zdm2NoLightmap.visible = true
|
||||
$Zdm2LightmapAll.visible = false
|
||||
if is_compatibility:
|
||||
# Work around Compatibility bug where lightmaps are still visible if the LightmapGI node is hidden.
|
||||
$LightmapGIAll.light_data = null
|
||||
|
||||
$Zdm2LightmapAll.visible = true
|
||||
$Zdm2LightmapIndirect.visible = false
|
||||
|
||||
# Halve sky contribution to prevent shaded areas from looking too bright and blue.
|
||||
@@ -100,15 +132,16 @@ func set_gi_mode(p_gi_mode: GIMode) -> void:
|
||||
|
||||
# There is no difference between Indirect and Disabled when no GI is used.
|
||||
# Pick the default value (which is Indirect).
|
||||
$Sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GrateOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GarageOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$CornerSpotLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$Camera/Box.gi_mode = GeometryInstance3D.GI_MODE_DISABLED
|
||||
|
||||
GIMode.LIGHTMAP_GI_ALL:
|
||||
$Zdm2NoLightmap.visible = false
|
||||
$Zdm2LightmapAll.visible = true
|
||||
$Zdm2LightmapIndirect.visible = false
|
||||
$LightmapGIAll.light_data = lightmap_gi_all_data
|
||||
|
||||
# Halve sky contribution to prevent dynamic objects from looking too bright and blue.
|
||||
# (When using lightmaps, this property doesn't affect lightmapped surfaces.)
|
||||
@@ -119,13 +152,15 @@ func set_gi_mode(p_gi_mode: GIMode) -> void:
|
||||
environment.sdfgi_enabled = false
|
||||
|
||||
# Make lights not affect baked surfaces by setting their bake mode to All.
|
||||
$Sun.light_bake_mode = Light3D.BAKE_STATIC
|
||||
|
||||
sun.light_bake_mode = Light3D.BAKE_STATIC
|
||||
$GrateOmniLight.light_bake_mode = Light3D.BAKE_STATIC
|
||||
$GarageOmniLight.light_bake_mode = Light3D.BAKE_STATIC
|
||||
$CornerSpotLight.light_bake_mode = Light3D.BAKE_STATIC
|
||||
$Camera/Box.gi_mode = GeometryInstance3D.GI_MODE_DYNAMIC
|
||||
|
||||
GIMode.LIGHTMAP_GI_INDIRECT:
|
||||
$Zdm2NoLightmap.visible = false
|
||||
$LightmapGIAll.light_data = lightmap_gi_all_data
|
||||
$Zdm2LightmapAll.visible = false
|
||||
$Zdm2LightmapIndirect.visible = true
|
||||
|
||||
@@ -137,14 +172,20 @@ func set_gi_mode(p_gi_mode: GIMode) -> void:
|
||||
$VoxelGI.visible = false
|
||||
environment.sdfgi_enabled = false
|
||||
|
||||
$Sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GrateOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GarageOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$CornerSpotLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
# Mark box as dynamic so it benefits from lightmap probes.
|
||||
# Don't do this in other GI modes to avoid the heavy performance impact that
|
||||
# happens with VoxelGI for dynamic objects.
|
||||
$Camera/Box.gi_mode = GeometryInstance3D.GI_MODE_DYNAMIC
|
||||
|
||||
GIMode.VOXEL_GI:
|
||||
$Zdm2NoLightmap.visible = true
|
||||
$Zdm2LightmapAll.visible = false
|
||||
# Work around bug where VoxelGI is not visible if the LightmapGI node is hidden (with LightmapGIData still present).
|
||||
$LightmapGIAll.light_data = null
|
||||
|
||||
$Zdm2LightmapAll.visible = true
|
||||
$Zdm2LightmapIndirect.visible = false
|
||||
|
||||
environment.ambient_light_sky_contribution = 1.0
|
||||
@@ -155,14 +196,17 @@ func set_gi_mode(p_gi_mode: GIMode) -> void:
|
||||
|
||||
# Bake mode must be Indirect, not Disabled. Otherwise, GI will
|
||||
# not be visible for those lights.
|
||||
$Sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GrateOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GarageOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$CornerSpotLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$Camera/Box.gi_mode = GeometryInstance3D.GI_MODE_DISABLED
|
||||
|
||||
GIMode.SDFGI:
|
||||
$Zdm2NoLightmap.visible = true
|
||||
$Zdm2LightmapAll.visible = false
|
||||
# Work around bug where SDFGI is not visible if the LightmapGI node is hidden (with LightmapGIData still present).
|
||||
$LightmapGIAll.light_data = null
|
||||
|
||||
$Zdm2LightmapAll.visible = true
|
||||
$Zdm2LightmapIndirect.visible = false
|
||||
|
||||
environment.ambient_light_sky_contribution = 1.0
|
||||
@@ -173,15 +217,16 @@ func set_gi_mode(p_gi_mode: GIMode) -> void:
|
||||
|
||||
# Bake mode must be Indirect, not Disabled. Otherwise, GI will
|
||||
# not be visible for those lights.
|
||||
$Sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
sun.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GrateOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$GarageOmniLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$CornerSpotLight.light_bake_mode = Light3D.BAKE_DYNAMIC
|
||||
$Camera/Box.gi_mode = GeometryInstance3D.GI_MODE_DISABLED
|
||||
|
||||
|
||||
func set_reflection_probe_mode(p_reflection_probe_mode: ReflectionProbeMode) -> void:
|
||||
reflection_probe_mode = p_reflection_probe_mode
|
||||
reflection_probe_mode_label.text = "Reflection probe: %s " % REFLECTION_PROBE_MODE_TEXTS[reflection_probe_mode]
|
||||
reflection_probe_mode_label.text = "Reflection probe: %s " % reflection_probe_mode_texts[reflection_probe_mode]
|
||||
|
||||
match p_reflection_probe_mode:
|
||||
ReflectionProbeMode.NONE:
|
||||
@@ -197,7 +242,12 @@ func set_reflection_probe_mode(p_reflection_probe_mode: ReflectionProbeMode) ->
|
||||
|
||||
func set_ssil_mode(p_ssil_mode: SSILMode) -> void:
|
||||
ssil_mode = p_ssil_mode
|
||||
ssil_mode_label.text = "Screen-space lighting effects: %s " % SSIL_MODE_TEXTS[ssil_mode]
|
||||
if is_compatibility:
|
||||
ssil_mode_label.text = "Screen-space lighting effects: Not supported on Compatibility"
|
||||
ssil_mode_label.self_modulate.a = 0.6
|
||||
return
|
||||
else:
|
||||
ssil_mode_label.text = "Screen-space lighting effects: %s " % SSIL_MODE_TEXTS[ssil_mode]
|
||||
|
||||
match p_ssil_mode:
|
||||
SSILMode.NONE:
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
[ext_resource type="PackedScene" uid="uid://djbrxyh5s8j2o" path="res://zdm2.glb" id="1"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2lbhsefub1o5" path="res://cube.glb" id="3"]
|
||||
[ext_resource type="VoxelGIData" uid="uid://duykbpl6evu0r" path="res://test_VoxelGIData.res" id="3_1netx"]
|
||||
[ext_resource type="LightmapGIData" uid="uid://bqpu20db0gmry" path="res://zdm2_all.lmbake" id="4_7vqwx"]
|
||||
[ext_resource type="LightmapGIData" uid="uid://c7ltminhf5o56" path="res://zdm2_all.lmbake" id="4_7vqwx"]
|
||||
[ext_resource type="Script" uid="uid://b33gdc1jklq5" path="res://test.gd" id="5"]
|
||||
[ext_resource type="LightmapGIData" uid="uid://brs3ywo1ouol0" path="res://zdm2_indirect.lmbake" id="5_14bmd"]
|
||||
[ext_resource type="LightmapGIData" uid="uid://xmpb2se1j30h" path="res://zdm2_indirect.lmbake" id="5_14bmd"]
|
||||
[ext_resource type="Script" uid="uid://bbfpss6nqbjeu" path="res://camera.gd" id="6"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_30v8t"]
|
||||
@@ -59,30 +59,28 @@ script = ExtResource("5")
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_bau0c")
|
||||
|
||||
[node name="Zdm2NoLightmap" parent="." instance=ExtResource("1")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
|
||||
|
||||
[node name="Zdm2LightmapAll" parent="." instance=ExtResource("1")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
|
||||
visible = false
|
||||
|
||||
[node name="Zdm2LightmapIndirect" parent="." instance=ExtResource("1")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
|
||||
visible = false
|
||||
|
||||
[node name="VoxelGI" type="VoxelGI" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 6, 2.5)
|
||||
visible = false
|
||||
size = Vector3(78, 37, 60)
|
||||
data = ExtResource("3_1netx")
|
||||
|
||||
[node name="LightmapGIAll" type="LightmapGI" parent="."]
|
||||
visible = false
|
||||
quality = 3
|
||||
generate_probes_subdiv = 3
|
||||
light_data = ExtResource("4_7vqwx")
|
||||
|
||||
[node name="LightmapGIIndirect" type="LightmapGI" parent="."]
|
||||
visible = false
|
||||
quality = 3
|
||||
generate_probes_subdiv = 3
|
||||
light_data = ExtResource("5_14bmd")
|
||||
|
||||
[node name="Sun" type="DirectionalLight3D" parent="."]
|
||||
@@ -134,6 +132,7 @@ script = ExtResource("6")
|
||||
[node name="Box" type="MeshInstance3D" parent="Camera"]
|
||||
transform = Transform3D(0.999999, -5.12227e-09, 9.68575e-08, 2.79397e-09, 0.999999, 8.9407e-08, 7.45058e-09, -1.11759e-07, 0.999999, -1.4, -0.999998, -3.99998)
|
||||
layers = 2
|
||||
gi_mode = 0
|
||||
mesh = SubResource("8")
|
||||
|
||||
[node name="BlobShadow" type="Decal" parent="Camera/Box"]
|
||||
@@ -148,6 +147,7 @@ cull_mask = 1048573
|
||||
[node name="ReflectiveSphere" type="MeshInstance3D" parent="Camera"]
|
||||
transform = Transform3D(-0.997523, -8.41886e-09, -0.0703376, -0.00719589, 0.994753, 0.102052, 0.0699685, 0.102305, -0.992289, 0.16733, -1.22931, -3.81225)
|
||||
layers = 2
|
||||
gi_mode = 0
|
||||
mesh = SubResource("2")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_7doxp")
|
||||
|
||||
@@ -195,14 +195,15 @@ theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 4
|
||||
text = "Screen-space lighting effects: Disabled (Fast)"
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
[node name="Help" type="Label" parent="."]
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 16.0
|
||||
offset_top = -120.0
|
||||
offset_top = -117.0
|
||||
offset_right = 537.0
|
||||
offset_bottom = -16.0
|
||||
grow_vertical = 0
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 4
|
||||
text = "Space: Cycle between GI modes
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="2d_array_texture"
|
||||
type="CompressedTexture2DArray"
|
||||
uid="uid://cnetwnfnv5way"
|
||||
uid="uid://k0tida8bignh"
|
||||
path="res://.godot/imported/zdm2_all.exr-90621151e6c7cdb548fd3797293f06e7.ctexarray"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
@@ -15,7 +15,7 @@ dest_files=["res://.godot/imported/zdm2_all.exr-90621151e6c7cdb548fd3797293f06e7
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=3
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
|
||||
Binary file not shown.
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="2d_array_texture"
|
||||
type="CompressedTexture2DArray"
|
||||
uid="uid://d26s2indfdskr"
|
||||
uid="uid://bykd8ka4a55ny"
|
||||
path="res://.godot/imported/zdm2_indirect.exr-1fd4bc76ec648c4d2e6230b7d974087b.ctexarray"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
@@ -15,7 +15,7 @@ dest_files=["res://.godot/imported/zdm2_indirect.exr-1fd4bc76ec648c4d2e6230b7d97
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=3
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
|
||||
Binary file not shown.
@@ -147,10 +147,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.342018, -1.18089, 0.661332
|
||||
material = SubResource("FogMaterial_tldur")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "move"
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_m14lt")
|
||||
}
|
||||
autoplay = "move"
|
||||
|
||||
[node name="SpotLight3D" type="SpotLight3D" parent="."]
|
||||
transform = Transform3D(0.0245702, 0.999698, -0.000796034, 0, 0.000796274, 1, 0.999698, -0.0245702, 1.95646e-05, -0.864742, 2.11809, 3.11561)
|
||||
|
||||
@@ -138,6 +138,14 @@ theme_override_colors/font_color = Color(0.683425, 0.916893, 1, 1)
|
||||
text = "Video Settings"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="UnsupportedLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
self_modulate = Color(1, 1, 1, 0.6)
|
||||
layout_mode = 2
|
||||
text = "Some settings are not supported
|
||||
on the Compatibility rendering method."
|
||||
|
||||
[node name="GridContainer2" type="GridContainer" parent="SettingsMenu/ScrollContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
columns = 2
|
||||
@@ -164,6 +172,7 @@ theme_override_font_sizes/font_size = 16
|
||||
text = "Display Filter:"
|
||||
|
||||
[node name="FilterOptionButton" type="OptionButton" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 16
|
||||
@@ -206,9 +215,9 @@ theme_override_font_sizes/font_size = 16
|
||||
selected = 0
|
||||
item_count = 3
|
||||
popup/item_0/text = "Disabled"
|
||||
popup/item_1/text = "Enabled"
|
||||
popup/item_1/text = "Enabled (Borderless)"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Exclusive"
|
||||
popup/item_2/text = "Enabled (Exclusive)"
|
||||
popup/item_2/id = 2
|
||||
|
||||
[node name="VsyncLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
|
||||
|
||||
@@ -20,8 +20,30 @@ var viewport_start_size := Vector2(
|
||||
ProjectSettings.get_setting(&"display/window/size/viewport_height")
|
||||
)
|
||||
|
||||
var is_compatibility := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
is_compatibility = true
|
||||
%UnsupportedLabel.visible = true
|
||||
mark_as_unsupported(%FilterOptionButton)
|
||||
mark_as_unsupported(%TAAOptionButton)
|
||||
mark_as_unsupported(%FXAAOptionButton)
|
||||
mark_as_unsupported(%SDFGIOptionButton)
|
||||
mark_as_unsupported(%SSAOOptionButton)
|
||||
mark_as_unsupported(%SSReflectionsOptionButton)
|
||||
mark_as_unsupported(%SSILOptionButton)
|
||||
mark_as_unsupported(%VolumetricFogOptionButton)
|
||||
# Darken lights's energy to compensate for sRGB blending (without affecting sky rendering).
|
||||
$Node3D/OmniLight3D.light_energy = 0.5
|
||||
$Node3D/SpotLight3D.light_energy = 0.5
|
||||
$Node3D/DirectionalLight3D.sky_mode = DirectionalLight3D.SKY_MODE_SKY_ONLY
|
||||
var new_light: DirectionalLight3D = $Node3D/DirectionalLight3D.duplicate()
|
||||
new_light.light_energy = 0.35
|
||||
new_light.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
|
||||
$Node3D.add_child(new_light)
|
||||
|
||||
get_viewport().size_changed.connect(update_resolution_label)
|
||||
update_resolution_label()
|
||||
|
||||
@@ -175,9 +197,15 @@ func _on_shadow_size_option_button_item_selected(index):
|
||||
# Higher resolutions can use a lower bias without suffering from shadow acne.
|
||||
directional_light.shadow_bias = 0.06
|
||||
|
||||
# Disable positional (omni/spot) light shadows entirely to further improve performance.
|
||||
# These often don't contribute as much to a scene compared to directional light shadows.
|
||||
get_viewport().positional_shadow_atlas_size = 0
|
||||
|
||||
if is_compatibility:
|
||||
# Work around bug in Compatibility where setting the positional shadow atlas size to 0 breaks rendering.
|
||||
get_viewport().positional_shadow_atlas_size = 512
|
||||
else:
|
||||
# Disable positional (omni/spot) light shadows entirely to further improve performance.
|
||||
# These often don't contribute as much to a scene compared to directional light shadows.
|
||||
get_viewport().positional_shadow_atlas_size = 0
|
||||
|
||||
if index == 1: # Very Low
|
||||
RenderingServer.directional_shadow_atlas_set_size(1024, true)
|
||||
directional_light.shadow_bias = 0.04
|
||||
@@ -457,3 +485,9 @@ func update_preset() -> void:
|
||||
%SSReflectionsOptionButton.item_selected.emit(%SSReflectionsOptionButton.selected)
|
||||
%SSILOptionButton.item_selected.emit(%SSILOptionButton.selected)
|
||||
%VolumetricFogOptionButton.item_selected.emit(%VolumetricFogOptionButton.selected)
|
||||
|
||||
|
||||
func mark_as_unsupported(button: OptionButton) -> void:
|
||||
button.disabled = true
|
||||
button.add_item("Unsupported")
|
||||
button.select(button.item_count - 1)
|
||||
|
||||
@@ -27,6 +27,11 @@ var backgrounds: Array[Dictionary] = [
|
||||
@onready var camera: Camera3D = $CameraHolder/RotationX/Camera
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
# Tweak scene brightness to better match Forward+/Mobile.
|
||||
$WorldEnvironment.environment.tonemap_mode = Environment.TONE_MAPPER_FILMIC
|
||||
$WorldEnvironment.environment.background_energy_multiplier = 2.0
|
||||
|
||||
for background in backgrounds:
|
||||
get_node(^"UI/Background").add_item(background.name)
|
||||
|
||||
|
||||
14
3d/platformer/stage/stage.gd
Normal file
14
3d/platformer/stage/stage.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
# Use PCF13 shadow filtering to improve quality (Medium maps to PCF5 instead).
|
||||
RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH)
|
||||
|
||||
# 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.25
|
||||
new_light.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
|
||||
add_child(new_light)
|
||||
@@ -1,5 +1,6 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dohp772jyjxb7"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dohp772jyjxb7"]
|
||||
|
||||
[ext_resource type="Script" path="res://stage/stage.gd" id="1_re4bd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmlvwah3ypol0" path="res://stage/grid_map.scn" id="1_t0f53"]
|
||||
[ext_resource type="Texture2D" uid="uid://qdur4kpvvtdg" path="res://stage/panorama.webp" id="2_36a8a"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://ba7lhk44sk366" path="res://stage/meshes/floor.res" id="2_vkxfl"]
|
||||
@@ -22,6 +23,7 @@ fog_density = 0.0015
|
||||
fog_sky_affect = 0.0
|
||||
|
||||
[node name="Stage" type="Node3D"]
|
||||
script = ExtResource("1_re4bd")
|
||||
|
||||
[node name="GridMap" parent="." instance=ExtResource("1_t0f53")]
|
||||
data = {
|
||||
@@ -32,7 +34,7 @@ metadata/_editor_floor_ = Vector3(4, 4, 0)
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_vpofs")
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight3D" parent="."]
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.965926, -0.166366, 0.198267, 1.42109e-14, 0.766044, 0.642788, -0.258819, 0.620886, -0.739941, 0, 0, 0)
|
||||
shadow_enabled = true
|
||||
shadow_bias = 0.02
|
||||
|
||||
@@ -25,6 +25,6 @@ offset_bottom = 24.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 6
|
||||
theme_override_constants/outline_size = 8
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "Generating textures, please wait…"
|
||||
|
||||
@@ -222,10 +222,10 @@ enable_shadows = true
|
||||
ambient_mode = 0
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "animate_textures"
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_sin37")
|
||||
}
|
||||
autoplay = "animate_textures"
|
||||
|
||||
[node name="CameraHolder" type="Node3D" parent="."]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0.125, 26)
|
||||
|
||||
@@ -8,6 +8,7 @@ var tester_index := 0
|
||||
var rot_x := deg_to_rad(-22.5) # This must be kept in sync with RotationX.
|
||||
var rot_y := deg_to_rad(90) # This must be kept in sync with CameraHolder.
|
||||
var zoom := 2.5
|
||||
var is_compatibility := false
|
||||
|
||||
@onready var testers: Node3D = $Testers
|
||||
@onready var camera_holder: Node3D = $CameraHolder # Has a position and rotates on Y.
|
||||
@@ -15,6 +16,17 @@ var zoom := 2.5
|
||||
@onready var camera: Camera3D = $CameraHolder/RotationX/Camera3D
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
# Use PCF13 shadow filtering to improve quality (Medium maps to PCF5 instead).
|
||||
RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH)
|
||||
|
||||
# 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.25
|
||||
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()
|
||||
|
||||
@@ -4,6 +4,18 @@ extends Node
|
||||
|
||||
|
||||
func _ready():
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
# Use PCF13 shadow filtering to improve quality (Medium maps to PCF5 instead).
|
||||
RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH)
|
||||
|
||||
# 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.35
|
||||
new_light.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
|
||||
add_child(new_light)
|
||||
|
||||
|
||||
$UserInterface/Retry.hide()
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ shape = SubResource("WorldBoundaryShape3D_i5n5q")
|
||||
transform = Transform3D(1, 5.96046e-08, -1.42109e-14, 3.82137e-15, -2.18557e-07, -1, -5.96046e-08, 1, -2.18557e-07, 9.53674e-07, 10, -20)
|
||||
shape = SubResource("WorldBoundaryShape3D_i5n5q")
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight3D" parent="."]
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.5, -0.777049, 0.382355, 0, 0.441506, 0.897258, -0.866025, -0.448629, 0.220753, 0, 12.5592, 14.7757)
|
||||
shadow_enabled = true
|
||||
shadow_bias = 0.04
|
||||
|
||||
@@ -10,6 +10,23 @@ enum Mood {
|
||||
|
||||
var mood := Mood.DAY: set = set_mood
|
||||
|
||||
# Only assigned when using the Compatibility rendering method.
|
||||
# This is used to darken the sunlight to compensate for sRGB blending (without affecting sky rendering).
|
||||
var compatibility_light: DirectionalLight3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
# Use PCF13 shadow filtering to improve quality (Medium maps to PCF5 instead).
|
||||
RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH)
|
||||
|
||||
# Darken the light's energy to compensate for sRGB blending (without affecting sky rendering).
|
||||
$DirectionalLight3D.sky_mode = DirectionalLight3D.SKY_MODE_SKY_ONLY
|
||||
compatibility_light = $DirectionalLight3D.duplicate()
|
||||
compatibility_light.light_energy = $DirectionalLight3D.light_energy * 0.2
|
||||
compatibility_light.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
|
||||
add_child(compatibility_light)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed(&"cycle_mood"):
|
||||
@@ -24,8 +41,8 @@ func set_mood(p_mood: Mood) -> void:
|
||||
$DirectionalLight3D.rotation_degrees = Vector3(-20, -150, -137)
|
||||
$DirectionalLight3D.light_color = Color(0.414, 0.377, 0.25)
|
||||
$DirectionalLight3D.light_energy = 4.0
|
||||
$WorldEnvironment.environment.fog_light_color = Color(0.686, 0.6, 0.467)
|
||||
$WorldEnvironment.environment.sky.sky_material = preload("res://town/sky_morning.tres")
|
||||
$WorldEnvironment.environment.fog_light_color = Color(0.686, 0.6, 0.467)
|
||||
$ArtificialLights.visible = false
|
||||
Mood.DAY:
|
||||
$DirectionalLight3D.rotation_degrees = Vector3(-55, -120, -31)
|
||||
@@ -48,3 +65,9 @@ func set_mood(p_mood: Mood) -> void:
|
||||
$WorldEnvironment.environment.sky.sky_material = preload("res://town/sky_night.tres")
|
||||
$WorldEnvironment.environment.fog_light_color = Color(0.2, 0.149, 0.125)
|
||||
$ArtificialLights.visible = true
|
||||
|
||||
if compatibility_light:
|
||||
# Darken the light's energy to compensate for sRGB blending (without affecting sky rendering).
|
||||
compatibility_light.rotation_degrees = $DirectionalLight3D.rotation_degrees
|
||||
compatibility_light.light_color = $DirectionalLight3D.light_color
|
||||
compatibility_light.light_energy = $DirectionalLight3D.light_energy * 0.2
|
||||
|
||||
13
3d/waypoints/main.gd
Normal file
13
3d/waypoints/main.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends Node3D
|
||||
|
||||
func _ready() -> void:
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
|
||||
# Use PCF13 shadow filtering to improve quality (Medium maps to PCF5 instead).
|
||||
RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH)
|
||||
|
||||
# Darken the light's energy to compensate for sRGB blending (without affecting sky rendering).
|
||||
$Sun.sky_mode = DirectionalLight3D.SKY_MODE_SKY_ONLY
|
||||
var new_light: DirectionalLight3D = $Sun.duplicate()
|
||||
new_light.light_energy = 0.35
|
||||
new_light.sky_mode = DirectionalLight3D.SKY_MODE_LIGHT_ONLY
|
||||
add_child(new_light)
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=18 format=3 uid="uid://rj7yrj3c672g"]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://rj7yrj3c672g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cx0dkr482ui5p" path="res://camera.gd" id="1"]
|
||||
[ext_resource type="Script" path="res://camera.gd" id="1"]
|
||||
[ext_resource type="Script" path="res://main.gd" id="1_nvv4i"]
|
||||
[ext_resource type="PackedScene" uid="uid://deqpan4silm2n" path="res://waypoint.tscn" id="2"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="5"]
|
||||
@@ -54,6 +55,7 @@ sky = SubResource("Sky_47fsp")
|
||||
tonemap_mode = 4
|
||||
|
||||
[node name="Main" type="Node3D"]
|
||||
script = ExtResource("1_nvv4i")
|
||||
|
||||
[node name="BlueCube" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -5)
|
||||
@@ -124,8 +126,8 @@ mesh = SubResource("4")
|
||||
[node name="Environment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_ob0ys")
|
||||
|
||||
[node name="Sun" type="DirectionalLight3D" parent="Environment"]
|
||||
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866026, -0.5, 0.75, -0.433013, 0, 0, 0)
|
||||
[node name="Sun" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
|
||||
shadow_enabled = true
|
||||
shadow_bias = 0.04
|
||||
shadow_blur = 1.5
|
||||
|
||||
@@ -2,7 +2,15 @@ extends Control
|
||||
|
||||
@onready var variable_font_variation: FontVariation = $"TabContainer/Variable fonts/VariableFontPreview".get_theme_font("font")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if OS.has_feature("web"):
|
||||
$"TabContainer/System fonts/LabelVarInfo".text = "Loading system fonts is not supported on the Web platform."
|
||||
$"TabContainer/System fonts/ValueSetter".visible = false
|
||||
$"TabContainer/System fonts/Italic".visible = false
|
||||
$"TabContainer/System fonts/Weight".visible = false
|
||||
$"TabContainer/System fonts/VBoxContainer".visible = false
|
||||
|
||||
var tree: Tree = $"TabContainer/Text direction/Tree"
|
||||
var root := tree.create_item()
|
||||
tree.set_hide_root(true)
|
||||
@@ -15,6 +23,7 @@ func _ready() -> void:
|
||||
var fourth := tree.create_item(third)
|
||||
fourth.set_text(0, "fourth")
|
||||
|
||||
|
||||
func _on_Tree_item_selected() -> void:
|
||||
var tree: Tree = $"TabContainer/Text direction/Tree"
|
||||
var path := ""
|
||||
@@ -25,12 +34,15 @@ func _on_Tree_item_selected() -> void:
|
||||
$"TabContainer/Text direction/LineEditST".text = path
|
||||
$"TabContainer/Text direction/LineEditNoST".text = path
|
||||
|
||||
|
||||
func _on_LineEditCustomSTDst_text_changed(new_text: String) -> void:
|
||||
$"TabContainer/Text direction/LineEditCustomSTSource".text = new_text
|
||||
|
||||
|
||||
func _on_LineEditCustomSTSource_text_changed(new_text: String) -> void:
|
||||
$"TabContainer/Text direction/LineEditCustomSTDst".text = new_text
|
||||
|
||||
|
||||
func _on_LineEditCustomSTDst_tree_entered() -> void:
|
||||
# Refresh text to apply custom script once it's loaded.
|
||||
$"TabContainer/Text direction/LineEditCustomSTDst".text = $"TabContainer/Text direction/LineEditCustomSTSource".text
|
||||
@@ -123,7 +135,3 @@ func _on_system_font_italic_toggled(button_pressed: bool) -> void:
|
||||
func _on_system_font_name_text_changed(new_text: String) -> void:
|
||||
var system_font: SystemFont = $"TabContainer/System fonts/VBoxContainer/Custom/FontName".get_theme_font("font")
|
||||
system_font.font_names[0] = new_text
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -84,9 +84,12 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
current_tab = 3
|
||||
|
||||
[node name="Line breaking and justification" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 0
|
||||
|
||||
[node name="LabelBrkInfo" type="Label" parent="TabContainer/Line breaking and justification"]
|
||||
layout_mode = 0
|
||||
@@ -165,6 +168,7 @@ text = "آنچ اندر وهم ناید آن شوم"
|
||||
[node name="Text direction" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 1
|
||||
|
||||
[node name="LabelDirInfo" type="Label" parent="TabContainer/Text direction"]
|
||||
layout_mode = 0
|
||||
@@ -349,6 +353,7 @@ script = ExtResource("3")
|
||||
[node name="Font features" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 2
|
||||
|
||||
[node name="LabelDisplay1" type="Label" parent="TabContainer/Font features"]
|
||||
layout_mode = 0
|
||||
@@ -489,8 +494,8 @@ Que fin 1/3 0
|
||||
[opentype_features=frac=1,zero]Que fin 1/3 0[/opentype_features] [color=#fffa](frac=1,zero - fractions and slashed zero)[/color][/font_size]"
|
||||
|
||||
[node name="Variable fonts" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 3
|
||||
|
||||
[node name="LabelVarInfo" type="Label" parent="TabContainer/Variable fonts"]
|
||||
layout_mode = 0
|
||||
@@ -621,6 +626,7 @@ uri = "https://www.recursive.design/"
|
||||
[node name="System fonts" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 4
|
||||
|
||||
[node name="LabelVarInfo" type="Label" parent="TabContainer/System fonts"]
|
||||
layout_mode = 0
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
extends Node
|
||||
|
||||
func _ready() -> void:
|
||||
if OS.has_feature("web"):
|
||||
for button: Button in [
|
||||
$GridContainer/OpenShellFolder,
|
||||
$GridContainer/MoveWindowToForeground,
|
||||
$GridContainer/RequestAttention,
|
||||
$GridContainer/VibrateDeviceShort,
|
||||
$GridContainer/VibrateDeviceLong,
|
||||
$GridContainer/AddGlobalMenuItems,
|
||||
$GridContainer/RemoveGlobalMenuItem,
|
||||
$GridContainer/KillCurrentProcess,
|
||||
]:
|
||||
button.disabled = true
|
||||
button.text += "\n(not supported on Web)"
|
||||
|
||||
|
||||
func _on_open_shell_web_pressed() -> void:
|
||||
OS.shell_open("https://example.com")
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ func _ready() -> void:
|
||||
add_header("Video")
|
||||
add_line("Adapter name", RenderingServer.get_video_adapter_name())
|
||||
add_line("Adapter vendor", RenderingServer.get_video_adapter_vendor())
|
||||
if ProjectSettings.get_setting_with_override("rendering/renderer/rendering_method") != "gl_compatibility":
|
||||
if RenderingServer.get_current_rendering_method() != "gl_compatibility":
|
||||
# Querying the adapter type isn't supported in Compatibility.
|
||||
add_line("Adapter type", [
|
||||
"Other (Unknown)",
|
||||
|
||||
@@ -4,7 +4,22 @@ var mouse_position := Vector2()
|
||||
|
||||
@onready var observer: CharacterBody3D = $"../Observer"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if OS.has_feature("web"):
|
||||
for button: BaseButton in [
|
||||
$Buttons/Button_FixedSize,
|
||||
$Buttons/Button_Minimized,
|
||||
$Buttons/Button_Maximized,
|
||||
$Buttons/Button_MoveTo,
|
||||
$Buttons/Button_Resize,
|
||||
$Buttons/Button_MouseModeConfined,
|
||||
$Buttons/Button_MouseModeConfinedHidden,
|
||||
$CheckButton,
|
||||
]:
|
||||
button.disabled = true
|
||||
button.text += " (not supported on Web)"
|
||||
|
||||
if not check_wm_api():
|
||||
set_physics_process(false)
|
||||
set_process_input(false)
|
||||
@@ -35,7 +50,8 @@ func _physics_process(_delta: float) -> void:
|
||||
$Labels/Label_Mode.text = modetext
|
||||
$Labels/Label_Position.text = str("Position: ", DisplayServer.window_get_position())
|
||||
$Labels/Label_Size.text = str("Size: ", DisplayServer.window_get_size())
|
||||
$Labels/Label_MousePosition.text = str("Mouse Position: ", mouse_position)
|
||||
# Pad decimals when showing mouse position, as some platforms report floating-point mouse positions.
|
||||
$Labels/Label_MousePosition.text = str("Mouse Position: %.4v" % mouse_position)
|
||||
$Labels/Label_Screen_Count.text = str("Screen_Count: ", DisplayServer.get_screen_count())
|
||||
$Labels/Label_Screen_Current.text = str("Screen: ", DisplayServer.window_get_current_screen())
|
||||
$Labels/Label_Screen0_Resolution.text = str("Screen0 Resolution:\n", DisplayServer.screen_get_size())
|
||||
|
||||
@@ -12,6 +12,7 @@ var state := State.MENU
|
||||
|
||||
@onready var camera: Camera3D = $Camera3D
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if state != State.GRAB:
|
||||
return
|
||||
|
||||
@@ -135,7 +135,7 @@ metadata/_edit_use_custom_anchors = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "MouseModes:"
|
||||
text = "Mouse Modes:"
|
||||
metadata/_edit_layout_mode = 1
|
||||
metadata/_edit_use_custom_anchors = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user