From d550040e7782180e8141eea401b584de67aff6e5 Mon Sep 17 00:00:00 2001 From: DunnyOfPenwick Date: Mon, 26 Feb 2024 14:15:09 -0500 Subject: [PATCH 1/2] More Retro Modes Adds half-resolution widescreen graphics modes and a high-resolution 4:3 mode. Also corrects for texture stretching when using the widescreen modes. --- Assets/Prefabs/Player/PlayerAdvanced.prefab | 22 ++++++++++ .../Resources/RetroPresentation.renderTexture | 4 +- .../RetroTarget1280x720.renderTexture | 37 ++++++++++++++++ .../RetroTarget1280x720.renderTexture.meta | 8 ++++ .../RetroTarget1280x720_HUD.renderTexture | 37 ++++++++++++++++ ...RetroTarget1280x720_HUD.renderTexture.meta | 8 ++++ .../RetroTarget1280x800.renderTexture | 37 ++++++++++++++++ .../RetroTarget1280x800.renderTexture.meta | 8 ++++ .../RetroTarget1280x800_HUD.renderTexture | 37 ++++++++++++++++ ...RetroTarget1280x800_HUD.renderTexture.meta | 8 ++++ .../RetroTarget1440x1080.renderTexture | 37 ++++++++++++++++ .../RetroTarget1440x1080.renderTexture.meta | 8 ++++ .../RetroTarget1440x1080_HUD.renderTexture | 37 ++++++++++++++++ ...etroTarget1440x1080_HUD.renderTexture.meta | 8 ++++ .../RetroTarget960x540.renderTexture | 37 ++++++++++++++++ .../RetroTarget960x540.renderTexture.meta | 8 ++++ .../RetroTarget960x540_HUD.renderTexture | 37 ++++++++++++++++ .../RetroTarget960x540_HUD.renderTexture.meta | 8 ++++ .../RetroTarget960x600.renderTexture | 37 ++++++++++++++++ .../RetroTarget960x600.renderTexture.meta | 8 ++++ .../RetroTarget960x600_HUD.renderTexture | 37 ++++++++++++++++ .../RetroTarget960x600_HUD.renderTexture.meta | 8 ++++ .../RetroModeConfigPage.cs | 5 +++ Assets/Scripts/SettingsManager.cs | 2 +- Assets/Scripts/Utility/RetroRenderer.cs | 42 ++++++++++++++++++- Assets/Scripts/Utility/ViewportChanger.cs | 26 ++++++++---- 26 files changed, 538 insertions(+), 13 deletions(-) create mode 100644 Assets/Resources/RetroTarget1280x720.renderTexture create mode 100644 Assets/Resources/RetroTarget1280x720.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget1280x720_HUD.renderTexture create mode 100644 Assets/Resources/RetroTarget1280x720_HUD.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget1280x800.renderTexture create mode 100644 Assets/Resources/RetroTarget1280x800.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget1280x800_HUD.renderTexture create mode 100644 Assets/Resources/RetroTarget1280x800_HUD.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget1440x1080.renderTexture create mode 100644 Assets/Resources/RetroTarget1440x1080.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget1440x1080_HUD.renderTexture create mode 100644 Assets/Resources/RetroTarget1440x1080_HUD.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget960x540.renderTexture create mode 100644 Assets/Resources/RetroTarget960x540.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget960x540_HUD.renderTexture create mode 100644 Assets/Resources/RetroTarget960x540_HUD.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget960x600.renderTexture create mode 100644 Assets/Resources/RetroTarget960x600.renderTexture.meta create mode 100644 Assets/Resources/RetroTarget960x600_HUD.renderTexture create mode 100644 Assets/Resources/RetroTarget960x600_HUD.renderTexture.meta diff --git a/Assets/Prefabs/Player/PlayerAdvanced.prefab b/Assets/Prefabs/Player/PlayerAdvanced.prefab index 8a825e60ea..42126b9c8f 100644 --- a/Assets/Prefabs/Player/PlayerAdvanced.prefab +++ b/Assets/Prefabs/Player/PlayerAdvanced.prefab @@ -620,6 +620,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 36bb43919da808741adb733009f14b91, type: 3} m_Name: m_EditorClassIdentifier: + playerJumpSkillMultiplier: 0.5 + athleticismMultiplier: 0.1 + improvedAthleticismMultiplier: 0.1 + jumpSpellMultiplier: 0.6 jumpSpeed: 4.5 gravity: 20 crouchingJumpDelta: 0.8 @@ -838,6 +842,24 @@ MonoBehaviour: RetroTexture640x400: {fileID: 8400000, guid: 5e6db3b61ca69e848afa2ff94164313b, type: 2} RetroTexture640x400_HUD: {fileID: 8400000, guid: 1af2073506665c64180188b569dfba46, type: 2} + RetroTexture960x540: {fileID: 8400000, guid: 54a8ebda44c8b7b4ab190e3f090a084a, type: 2} + RetroTexture960x540_HUD: {fileID: 8400000, guid: 69d4de192dadcb848a902f4e47114382, + type: 2} + RetroTexture960x600: {fileID: 8400000, guid: a09840ac31b862f4badb806d35d6bb55, type: 2} + RetroTexture960x600_HUD: {fileID: 8400000, guid: f91b2ccadae06684f945db499289f2b2, + type: 2} + RetroTexture1280x720: {fileID: 8400000, guid: 6704fb8be64abe54faf0a4a2a72c0331, + type: 2} + RetroTexture1280x720_HUD: {fileID: 8400000, guid: 65da2274993c2f9478c6fc1a741cdf43, + type: 2} + RetroTexture1280x800: {fileID: 8400000, guid: 4fd1fe394b4a6124da53441565c432fc, + type: 2} + RetroTexture1280x800_HUD: {fileID: 8400000, guid: 6adba8db9b87718458a1a5168fe64d1b, + type: 2} + RetroTexture1440x1080: {fileID: 8400000, guid: c48b9240abb6bdb458adf00f99ebfb50, + type: 2} + RetroTexture1440x1080_HUD: {fileID: 8400000, guid: 20beaa7e90fbc764ea3be16ce00ae35b, + type: 2} RetroPresentationTarget: {fileID: 8400000, guid: 570bcf8f70408ce44be2d1357054b448, type: 2} --- !u!114 &334547544 diff --git a/Assets/Resources/RetroPresentation.renderTexture b/Assets/Resources/RetroPresentation.renderTexture index 85fc2399ca..9b50f8c7f3 100644 --- a/Assets/Resources/RetroPresentation.renderTexture +++ b/Assets/Resources/RetroPresentation.renderTexture @@ -13,8 +13,8 @@ RenderTexture: m_ForcedFallbackFormat: 4 m_DownscaleFallback: 0 serializedVersion: 3 - m_Width: 640 - m_Height: 400 + m_Width: 3840 + m_Height: 2160 m_AntiAliasing: 1 m_MipCount: -1 m_DepthFormat: 2 diff --git a/Assets/Resources/RetroTarget1280x720.renderTexture b/Assets/Resources/RetroTarget1280x720.renderTexture new file mode 100644 index 0000000000..f072e6873d --- /dev/null +++ b/Assets/Resources/RetroTarget1280x720.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget1280x720 + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1536 + m_Height: 720 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget1280x720.renderTexture.meta b/Assets/Resources/RetroTarget1280x720.renderTexture.meta new file mode 100644 index 0000000000..f98964fd50 --- /dev/null +++ b/Assets/Resources/RetroTarget1280x720.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6704fb8be64abe54faf0a4a2a72c0331 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget1280x720_HUD.renderTexture b/Assets/Resources/RetroTarget1280x720_HUD.renderTexture new file mode 100644 index 0000000000..2b911a452f --- /dev/null +++ b/Assets/Resources/RetroTarget1280x720_HUD.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget1280x720_HUD + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1536 + m_Height: 554 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget1280x720_HUD.renderTexture.meta b/Assets/Resources/RetroTarget1280x720_HUD.renderTexture.meta new file mode 100644 index 0000000000..ab401f6f0b --- /dev/null +++ b/Assets/Resources/RetroTarget1280x720_HUD.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65da2274993c2f9478c6fc1a741cdf43 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget1280x800.renderTexture b/Assets/Resources/RetroTarget1280x800.renderTexture new file mode 100644 index 0000000000..fc5fbbfe29 --- /dev/null +++ b/Assets/Resources/RetroTarget1280x800.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget1280x800 + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1536 + m_Height: 800 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget1280x800.renderTexture.meta b/Assets/Resources/RetroTarget1280x800.renderTexture.meta new file mode 100644 index 0000000000..b7092b7635 --- /dev/null +++ b/Assets/Resources/RetroTarget1280x800.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4fd1fe394b4a6124da53441565c432fc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget1280x800_HUD.renderTexture b/Assets/Resources/RetroTarget1280x800_HUD.renderTexture new file mode 100644 index 0000000000..717c8f1698 --- /dev/null +++ b/Assets/Resources/RetroTarget1280x800_HUD.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget1280x800_HUD + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1536 + m_Height: 616 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget1280x800_HUD.renderTexture.meta b/Assets/Resources/RetroTarget1280x800_HUD.renderTexture.meta new file mode 100644 index 0000000000..f918b3aad8 --- /dev/null +++ b/Assets/Resources/RetroTarget1280x800_HUD.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29f4b1216199df64483c55ba2e970399 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget1440x1080.renderTexture b/Assets/Resources/RetroTarget1440x1080.renderTexture new file mode 100644 index 0000000000..a5ad2f855f --- /dev/null +++ b/Assets/Resources/RetroTarget1440x1080.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget1440x1080 + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1728 + m_Height: 1080 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 1 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget1440x1080.renderTexture.meta b/Assets/Resources/RetroTarget1440x1080.renderTexture.meta new file mode 100644 index 0000000000..54c03df891 --- /dev/null +++ b/Assets/Resources/RetroTarget1440x1080.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c48b9240abb6bdb458adf00f99ebfb50 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget1440x1080_HUD.renderTexture b/Assets/Resources/RetroTarget1440x1080_HUD.renderTexture new file mode 100644 index 0000000000..d0fbdfc033 --- /dev/null +++ b/Assets/Resources/RetroTarget1440x1080_HUD.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget1440x1080_HUD + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1728 + m_Height: 832 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 1 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget1440x1080_HUD.renderTexture.meta b/Assets/Resources/RetroTarget1440x1080_HUD.renderTexture.meta new file mode 100644 index 0000000000..7c651205f8 --- /dev/null +++ b/Assets/Resources/RetroTarget1440x1080_HUD.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 20beaa7e90fbc764ea3be16ce00ae35b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget960x540.renderTexture b/Assets/Resources/RetroTarget960x540.renderTexture new file mode 100644 index 0000000000..45e7421f3f --- /dev/null +++ b/Assets/Resources/RetroTarget960x540.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget960x540 + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1152 + m_Height: 540 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget960x540.renderTexture.meta b/Assets/Resources/RetroTarget960x540.renderTexture.meta new file mode 100644 index 0000000000..8ed5dfe0c1 --- /dev/null +++ b/Assets/Resources/RetroTarget960x540.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 54a8ebda44c8b7b4ab190e3f090a084a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget960x540_HUD.renderTexture b/Assets/Resources/RetroTarget960x540_HUD.renderTexture new file mode 100644 index 0000000000..6192b9ad86 --- /dev/null +++ b/Assets/Resources/RetroTarget960x540_HUD.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget960x540_HUD + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1152 + m_Height: 416 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget960x540_HUD.renderTexture.meta b/Assets/Resources/RetroTarget960x540_HUD.renderTexture.meta new file mode 100644 index 0000000000..91f07a4215 --- /dev/null +++ b/Assets/Resources/RetroTarget960x540_HUD.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69d4de192dadcb848a902f4e47114382 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget960x600.renderTexture b/Assets/Resources/RetroTarget960x600.renderTexture new file mode 100644 index 0000000000..6381be5bd9 --- /dev/null +++ b/Assets/Resources/RetroTarget960x600.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget960x600 + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1152 + m_Height: 600 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget960x600.renderTexture.meta b/Assets/Resources/RetroTarget960x600.renderTexture.meta new file mode 100644 index 0000000000..0e2a5c2221 --- /dev/null +++ b/Assets/Resources/RetroTarget960x600.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a09840ac31b862f4badb806d35d6bb55 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/RetroTarget960x600_HUD.renderTexture b/Assets/Resources/RetroTarget960x600_HUD.renderTexture new file mode 100644 index 0000000000..1aa02954b2 --- /dev/null +++ b/Assets/Resources/RetroTarget960x600_HUD.renderTexture @@ -0,0 +1,37 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RetroTarget960x600_HUD + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 1152 + m_Height: 462 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 0 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 diff --git a/Assets/Resources/RetroTarget960x600_HUD.renderTexture.meta b/Assets/Resources/RetroTarget960x600_HUD.renderTexture.meta new file mode 100644 index 0000000000..a7ff1277ce --- /dev/null +++ b/Assets/Resources/RetroTarget960x600_HUD.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f91b2ccadae06684f945db499289f2b2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Game/UserInterfaceWindows/RetroModeConfigPage.cs b/Assets/Scripts/Game/UserInterfaceWindows/RetroModeConfigPage.cs index 49226fc03f..ef3620229c 100644 --- a/Assets/Scripts/Game/UserInterfaceWindows/RetroModeConfigPage.cs +++ b/Assets/Scripts/Game/UserInterfaceWindows/RetroModeConfigPage.cs @@ -41,6 +41,11 @@ public override void Setup(Panel parent) TextManager.Instance.GetLocalizedText("retroModeOff"), TextManager.Instance.GetLocalizedText("retroMode320x200"), TextManager.Instance.GetLocalizedText("retroMode640x400"), + "960x540 [16:9]", //Localization isn't really necessary here. + "960x600 [16:10]", + "1280x720 [16:9]", + "1280x800 [16:10]", + "1440x1080 [4:3]" }; modeSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("mode"), modes.Length, ref pos); modeSlider.OnScroll += ModeSlider_OnScroll; diff --git a/Assets/Scripts/SettingsManager.cs b/Assets/Scripts/SettingsManager.cs index e7b0727f6c..45d58a9b39 100644 --- a/Assets/Scripts/SettingsManager.cs +++ b/Assets/Scripts/SettingsManager.cs @@ -355,7 +355,7 @@ public void LoadSettings() ResolutionWidth = GetInt(sectionVideo, "ResolutionWidth"); ResolutionHeight = GetInt(sectionVideo, "ResolutionHeight"); - RetroRenderingMode = GetInt(sectionVideo, "RetroRenderingMode", 0, 2); + RetroRenderingMode = GetInt(sectionVideo, "RetroRenderingMode", 0, 7); PostProcessingInRetroMode = GetInt(sectionVideo, "PostProcessingInRetroMode"); UseMipMapsInRetroMode = GetBool(sectionVideo, "UseMipMapsInRetroMode"); RetroModeAspectCorrection = GetInt(sectionVideo, "RetroModeAspectCorrection", 0, 2); diff --git a/Assets/Scripts/Utility/RetroRenderer.cs b/Assets/Scripts/Utility/RetroRenderer.cs index fc5329ec92..723a8cae07 100644 --- a/Assets/Scripts/Utility/RetroRenderer.cs +++ b/Assets/Scripts/Utility/RetroRenderer.cs @@ -23,7 +23,17 @@ public class RetroRenderer : MonoBehaviour public RenderTexture RetroTexture320x200_HUD; public RenderTexture RetroTexture640x400; public RenderTexture RetroTexture640x400_HUD; - public RenderTexture RetroPresentationTarget; + public RenderTexture RetroTexture960x540; //16:9, to be scaled from 1152x540 + public RenderTexture RetroTexture960x540_HUD; + public RenderTexture RetroTexture960x600; //16:10, to be scaled from 1152x600 + public RenderTexture RetroTexture960x600_HUD; + public RenderTexture RetroTexture1280x720; //16:9, to be scaled from 1536x720 + public RenderTexture RetroTexture1280x720_HUD; + public RenderTexture RetroTexture1280x800; //16:10, to be scaled from 1536x800 + public RenderTexture RetroTexture1280x800_HUD; + public RenderTexture RetroTexture1440x1080; //4:3, to be scaled from 1728x1080 + public RenderTexture RetroTexture1440x1080_HUD; + public RenderTexture RetroPresentationTarget; //4k, 3840x2160 private const string ExcludeSkyKeyword = "EXCLUDE_SKY"; @@ -428,10 +438,25 @@ public void UpdateRenderTarget() // 0 = retro rendering off // 1 = retro 320x200 rendering on with docked large HUD // 2 = retro 640x400 rendering on with docked large HUD + // 3 = retro 960x540 rendering on with docked large HUD + // 4 = retro 960x600 rendering on with docked large HUD + // 5 = retro 1280x720 rendering on with docked large HUD + // 6 = retro 1280x800 rendering on with docked large HUD + // 7 = retro 1440x1080 rendering on with docked large HUD if (retroMode == 1 && RetroTexture320x200) retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture320x200_HUD; else if (retroMode == 2 && RetroTexture640x400) retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture640x400_HUD; + else if (retroMode == 3 && RetroTexture960x540) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture960x540_HUD; + else if (retroMode == 4 && RetroTexture960x600) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture960x600_HUD; + else if (retroMode == 5 && RetroTexture1280x720) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture1280x720_HUD; + else if (retroMode == 6 && RetroTexture1280x800) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture1280x800_HUD; + else if (retroMode == 7 && RetroTexture1440x1080) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture1440x1080_HUD; } else { @@ -439,10 +464,25 @@ public void UpdateRenderTarget() // 0 = retro rendering off // 1 = retro 320x200 rendering on // 2 = retro 640x400 rendering on + // 3 = retro 960x540 rendering on + // 4 = retro 960x600 rendering on + // 5 = retro 1280x720 rendering on + // 6 = retro 1280x800 rendering on + // 7 = retro 1440x1080 rendering on if (retroMode == 1 && RetroTexture320x200) retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture320x200; else if (retroMode == 2 && RetroTexture640x400) retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture640x400; + else if (retroMode == 3 && RetroTexture960x540) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture960x540; + else if (retroMode == 4 && RetroTexture960x600) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture960x600; + else if (retroMode == 5 && RetroTexture1280x720) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture1280x720; + else if (retroMode == 6 && RetroTexture1280x800) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture1280x800; + else if (retroMode == 7 && RetroTexture1440x1080) + retroTexture = GameManager.Instance.MainCamera.targetTexture = RetroTexture1440x1080; } } diff --git a/Assets/Scripts/Utility/ViewportChanger.cs b/Assets/Scripts/Utility/ViewportChanger.cs index 788a3775be..89231ef005 100644 --- a/Assets/Scripts/Utility/ViewportChanger.cs +++ b/Assets/Scripts/Utility/ViewportChanger.cs @@ -95,21 +95,29 @@ void SetViewport(Rect rect) void SetRetroAspectViewport() { - float heightRatio = 0; + float heightRatio; int viewWidth = 0; RetroModeAspects aspect = (RetroModeAspects)DaggerfallUnity.Settings.RetroModeAspectCorrection; if (aspect == RetroModeAspects.FourThree) { - // Classic rendered at 320x200 (Mode13h/16:10) but was typically displayed on 4:3 monitors (e.g. 320x240) - // In this environment display output signal was stretched 20% higher in vertical dimension - // This setting scales output viewport to simulate resulting aspect ratio in this environment - // Works from ideal 16:10 > 4:3 upscale (1600x1200 or 5x width, 6x height, 20% higher) and ratios into actual screen area + if (DaggerfallUnity.Settings.RetroRenderingMode <= 2) + { + // Classic rendered at 320x200 (Mode13h/16:10) but was typically displayed on 4:3 monitors (e.g. 320x240) + // In this environment display output signal was stretched 20% higher in vertical dimension + // This setting scales output viewport to simulate resulting aspect ratio in this environment + // Works from ideal 16:10 > 4:3 upscale (1600x1200 or 5x width, 6x height, 20% higher) and ratios into actual screen area - // Start with screen height at 6x classic to get a ratio - heightRatio = Screen.height / 6f / 200f; + // Start with screen height at 6x classic to get a ratio + heightRatio = Screen.height / 6f / 200f; - // Then determine 5x classic width at this ratio - viewWidth = (int)(320f * 5f * heightRatio); + // Then determine 5x classic width at this ratio + viewWidth = (int)(320f * 5f * heightRatio); + } + else + { + //4:3 aspect, but using non-stretched display resolutions (square pixels). + viewWidth = (int)(Screen.height * 4f / 3f); + } } else if (aspect == RetroModeAspects.SixteenTen) { From da46aa87f285561313abf24b3a702872cc2f1856 Mon Sep 17 00:00:00 2001 From: DunnyOfPenwick Date: Wed, 28 Feb 2024 11:10:52 -0500 Subject: [PATCH 2/2] Skip Blit if no post-processing Skips the Blit() operation if no post-processing is needed, to improve performance. --- Assets/Scripts/Utility/RetroRenderer.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Utility/RetroRenderer.cs b/Assets/Scripts/Utility/RetroRenderer.cs index 723a8cae07..0da42f1503 100644 --- a/Assets/Scripts/Utility/RetroRenderer.cs +++ b/Assets/Scripts/Utility/RetroRenderer.cs @@ -538,11 +538,17 @@ private void OnPostRender() if (retroMode == 0 || !retroTexture || !RetroPresentationTarget || !postprocessMaterial) return; - // Blit to presentation rendertexture with postprocess material - if (enablePostprocessing) + // Blit to presentation rendertexture with postprocess material (if needed). + if (enablePostprocessing && DaggerfallUnity.Settings.PostProcessingInRetroMode > 0) + { Graphics.Blit(retroTexture, RetroPresentationTarget, postprocessMaterial); + retroPresenter.RetroPresentationSource = RetroPresentationTarget; + } else - Graphics.Blit(retroTexture, RetroPresentationTarget); + { + //Since there is no post-processing needed, we will skip the Graphics.Blit() for better performance. + retroPresenter.RetroPresentationSource = retroTexture; + } } } } \ No newline at end of file