Use skybox in Platformer 3D demo to improve sky quality (#1282)

- Restore support for multiple aspect ratios which was inadvertently
  removed in a previous PR.
- Fix corner fix preview incorrectly using VRAM compression (it's
  low-resolution, and only displayed in the editor anyway).
This commit is contained in:
Hugo Locurcio
2025-11-26 17:26:46 +01:00
committed by GitHub
parent bf544aefd9
commit ecbb2ee713
9 changed files with 52 additions and 51 deletions

View File

@@ -25,6 +25,7 @@ gdscript/warnings/untyped_declaration=1
[display]
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[input]

View File

@@ -3,21 +3,19 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cpcbdn1fytnwo"
path.s3tc="res://.godot/imported/corner_fix.webp-bc947c0527b474b1e52d39a93f6cd55a.s3tc.ctex"
path.etc2="res://.godot/imported/corner_fix.webp-bc947c0527b474b1e52d39a93f6cd55a.etc2.ctex"
path="res://.godot/imported/corner_fix.webp-bc947c0527b474b1e52d39a93f6cd55a.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
"vram_texture": false
}
[deps]
source_file="res://stage/meshes/previews/corner_fix.webp"
dest_files=["res://.godot/imported/corner_fix.webp-bc947c0527b474b1e52d39a93f6cd55a.s3tc.ctex", "res://.godot/imported/corner_fix.webp-bc947c0527b474b1e52d39a93f6cd55a.etc2.ctex"]
dest_files=["res://.godot/imported/corner_fix.webp-bc947c0527b474b1e52d39a93f6cd55a.ctex"]
[params]
compress/mode=2
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

View File

@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c3j2c1ejqfb3m"
path="res://.godot/imported/panorama.webp-c655559bb5045314b4c9859b18ccd417.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://stage/panorama.webp"
dest_files=["res://.godot/imported/panorama.webp-c655559bb5045314b4c9859b18ccd417.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@@ -0,0 +1,11 @@
shader_type sky;
uniform samplerCube source_panorama : filter_linear, source_color, hint_default_black;
uniform float exposure : hint_range(0, 128) = 1.0;
void sky() {
// If importing a cubemap from another engine, you may need to flip one of the `EYEDIR` components below
// by replacing it with `-EYEDIR`.
vec3 eyedir = vec3(EYEDIR.x, EYEDIR.y, EYEDIR.z);
COLOR = texture(source_panorama, eyedir).rgb * exposure;
}

View File

@@ -0,0 +1 @@
uid://bromrf0kc05o8

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

View File

@@ -0,0 +1,27 @@
[remap]
importer="cubemap_texture"
type="CompressedCubemap"
uid="uid://bnqdokul6s4pt"
path="res://.godot/imported/skybox.webp-399a875da30c2a97d4f743c79e482475.ccube"
metadata={
"vram_texture": false
}
[deps]
source_file="res://stage/skybox.webp"
dest_files=["res://.godot/imported/skybox.webp-399a875da30c2a97d4f743c79e482475.ccube"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
slices/arrangement=1

View File

@@ -1,15 +1,18 @@
[gd_scene load_steps=8 format=3 uid="uid://bf8hajxlmh3lw"]
[gd_scene load_steps=9 format=3 uid="uid://bf8hajxlmh3lw"]
[ext_resource type="Script" uid="uid://vw47tquoshc7" 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://c3j2c1ejqfb3m" path="res://stage/panorama.webp" id="2_36a8a"]
[ext_resource type="ArrayMesh" uid="uid://ba7lhk44sk366" path="res://stage/meshes/floor.res" id="2_vkxfl"]
[ext_resource type="Shader" uid="uid://bromrf0kc05o8" path="res://stage/skybox.gdshader" id="3_s88my"]
[ext_resource type="CompressedCubemap" uid="uid://bnqdokul6s4pt" path="res://stage/skybox.webp" id="4_ve7pq"]
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_3qare"]
panorama = ExtResource("2_36a8a")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ve7pq"]
shader = ExtResource("3_s88my")
shader_parameter/source_panorama = ExtResource("4_ve7pq")
shader_parameter/exposure = 1.0
[sub_resource type="Sky" id="Sky_qdkmq"]
sky_material = SubResource("PanoramaSkyMaterial_3qare")
sky_material = SubResource("ShaderMaterial_ve7pq")
[sub_resource type="Environment" id="Environment_vpofs"]
background_mode = 2