Added reflection probe cubemap quality levels

This commit is contained in:
Doug McDiarmid
2021-06-02 18:39:05 -07:00
parent 4a5b7edbfe
commit 9dbe596e40
9 changed files with 595 additions and 6 deletions
@@ -8,7 +8,8 @@
"Name": "IBLSpecular",
"Description": "The input cubemap generates an IBL specular output cubemap.",
"FileMasks": [
"_iblspecularcm"
"_iblspecularcm",
"_iblspecularcm256"
],
"SourceColor": "Linear",
"DestColor": "Linear",
@@ -34,7 +35,8 @@
"UUID": "{908DA68C-97FB-4C4A-97BC-5A55F30F14FA}",
"Name": "IBLSpecular",
"FileMasks": [
"_iblspecularcm"
"_iblspecularcm",
"_iblspecularcm256"
],
"SourceColor": "Linear",
"DestColor": "Linear",
@@ -59,7 +61,8 @@
"UUID": "{908DA68C-97FB-4C4A-97BC-5A55F30F14FA}",
"Name": "IBLSpecular",
"FileMasks": [
"_iblspecularcm"
"_iblspecularcm",
"_iblspecularcm256"
],
"SourceColor": "Linear",
"DestColor": "Linear",
@@ -84,7 +87,8 @@
"UUID": "{908DA68C-97FB-4C4A-97BC-5A55F30F14FA}",
"Name": "IBLSpecular",
"FileMasks": [
"_iblspecularcm"
"_iblspecularcm",
"_iblspecularcm256"
],
"SourceColor": "Linear",
"DestColor": "Linear",
@@ -109,7 +113,8 @@
"UUID": "{908DA68C-97FB-4C4A-97BC-5A55F30F14FA}",
"Name": "IBLSpecular",
"FileMasks": [
"_iblspecularcm"
"_iblspecularcm",
"_iblspecularcm256"
],
"SourceColor": "Linear",
"DestColor": "Linear",
@@ -0,0 +1,135 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "MultiplatformPresetSettings",
"ClassData": {
"DefaultPreset": {
"UUID": "{B66395E1-8D0E-4159-989B-FC2B9F091B75}",
"Name": "IBLSpecularHigh",
"Description": "The input cubemap generates an IBL specular output cubemap.",
"FileMasks": [
"_iblspecularcm512"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 512,
"MaxTextureSize": 512,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"PlatformsPresets": {
"android": {
"UUID": "{B66395E1-8D0E-4159-989B-FC2B9F091B75}",
"Name": "IBLSpecularHigh",
"FileMasks": [
"_iblspecularcm512"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 512,
"MaxTextureSize": 512,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"ios": {
"UUID": "{B66395E1-8D0E-4159-989B-FC2B9F091B75}",
"Name": "IBLSpecularHigh",
"FileMasks": [
"_iblspecularcm512"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 512,
"MaxTextureSize": 512,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"mac": {
"UUID": "{B66395E1-8D0E-4159-989B-FC2B9F091B75}",
"Name": "IBLSpecularHigh",
"FileMasks": [
"_iblspecularcm512"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 512,
"MaxTextureSize": 512,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"provo": {
"UUID": "{B66395E1-8D0E-4159-989B-FC2B9F091B75}",
"Name": "IBLSpecularHigh",
"FileMasks": [
"_iblspecularcm512"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 512,
"MaxTextureSize": 512,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
}
}
}
}
@@ -0,0 +1,135 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "MultiplatformPresetSettings",
"ClassData": {
"DefaultPreset": {
"UUID": "{7273ACAE-6E34-487C-AF71-99423A6E1CB0}",
"Name": "IBLSpecularLow",
"Description": "The input cubemap generates an IBL specular output cubemap.",
"FileMasks": [
"_iblspecularcm128"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 128,
"MaxTextureSize": 128,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"PlatformsPresets": {
"android": {
"UUID": "{7273ACAE-6E34-487C-AF71-99423A6E1CB0}",
"Name": "IBLSpecularLow",
"FileMasks": [
"_iblspecularcm128"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 128,
"MaxTextureSize": 128,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"ios": {
"UUID": "{7273ACAE-6E34-487C-AF71-99423A6E1CB0}",
"Name": "IBLSpecularLow",
"FileMasks": [
"_iblspecularcm128"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 128,
"MaxTextureSize": 128,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"mac": {
"UUID": "{7273ACAE-6E34-487C-AF71-99423A6E1CB0}",
"Name": "IBLSpecularLow",
"FileMasks": [
"_iblspecularcm128"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 128,
"MaxTextureSize": 128,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"provo": {
"UUID": "{7273ACAE-6E34-487C-AF71-99423A6E1CB0}",
"Name": "IBLSpecularLow",
"FileMasks": [
"_iblspecularcm128"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 128,
"MaxTextureSize": 128,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
}
}
}
}
@@ -0,0 +1,135 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "MultiplatformPresetSettings",
"ClassData": {
"DefaultPreset": {
"UUID": "{5CD1AFA6-915B-4716-893C-A5B1F4074C22}",
"Name": "IBLSpecularVeryHigh",
"Description": "The input cubemap generates an IBL specular output cubemap.",
"FileMasks": [
"_iblspecularcm1024"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 1024,
"MaxTextureSize": 1024,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"PlatformsPresets": {
"android": {
"UUID": "{5CD1AFA6-915B-4716-893C-A5B1F4074C22}",
"Name": "IBLSpecularVeryHigh",
"FileMasks": [
"_iblspecularcm1024"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 1024,
"MaxTextureSize": 1024,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"ios": {
"UUID": "{5CD1AFA6-915B-4716-893C-A5B1F4074C22}",
"Name": "IBLSpecularVeryHigh",
"FileMasks": [
"_iblspecularcm1024"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 1024,
"MaxTextureSize": 1024,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"mac": {
"UUID": "{5CD1AFA6-915B-4716-893C-A5B1F4074C22}",
"Name": "IBLSpecularVeryHigh",
"FileMasks": [
"_iblspecularcm1024"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 1024,
"MaxTextureSize": 1024,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"provo": {
"UUID": "{5CD1AFA6-915B-4716-893C-A5B1F4074C22}",
"Name": "IBLSpecularVeryHigh",
"FileMasks": [
"_iblspecularcm1024"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 1024,
"MaxTextureSize": 1024,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
}
}
}
}
@@ -0,0 +1,135 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "MultiplatformPresetSettings",
"ClassData": {
"DefaultPreset": {
"UUID": "{8293C236-D3E8-4352-8B18-C2E82EEE6547}",
"Name": "IBLSpecularVeryLow",
"Description": "The input cubemap generates an IBL specular output cubemap.",
"FileMasks": [
"_iblspecularcm64"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 64,
"MaxTextureSize": 64,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"PlatformsPresets": {
"android": {
"UUID": "{8293C236-D3E8-4352-8B18-C2E82EEE6547}",
"Name": "IBLSpecularVeryLow",
"FileMasks": [
"_iblspecularcm64"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 64,
"MaxTextureSize": 64,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"ios": {
"UUID": "{8293C236-D3E8-4352-8B18-C2E82EEE6547}",
"Name": "IBLSpecularVeryLow",
"FileMasks": [
"_iblspecularcm64"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 64,
"MaxTextureSize": 64,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"mac": {
"UUID": "{8293C236-D3E8-4352-8B18-C2E82EEE6547}",
"Name": "IBLSpecularVeryLow",
"FileMasks": [
"_iblspecularcm64"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 64,
"MaxTextureSize": 64,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
},
"provo": {
"UUID": "{8293C236-D3E8-4352-8B18-C2E82EEE6547}",
"Name": "IBLSpecularVeryLow",
"FileMasks": [
"_iblspecularcm64"
],
"SourceColor": "Linear",
"DestColor": "Linear",
"SuppressEngineReduce": true,
"PixelFormat": "R9G9B9E5",
"DiscardAlpha": true,
"MinTextureSize": 64,
"MaxTextureSize": 64,
"IsPowerOf2": true,
"CubemapSettings": {
"Filter": "GGX",
"MipAngle": 7.0,
"MipSlope": 2.299999952316284,
"EdgeFixup": -431602080.0,
"SubId": 2000
},
"MipMapSetting": {
"MipGenType": "Box"
}
}
}
}
}
@@ -39,6 +39,7 @@ namespace AZ
serializeContext->Class<EditorReflectionProbeComponent, BaseClass>()
->Version(2, ConvertToEditorRenderComponentAdapter<1>)
->Field("useBakedCubemap", &EditorReflectionProbeComponent::m_useBakedCubemap)
->Field("bakedCubeMapQualityLevel", &EditorReflectionProbeComponent::m_bakedCubeMapQualityLevel)
->Field("bakedCubeMapRelativePath", &EditorReflectionProbeComponent::m_bakedCubeMapRelativePath)
->Field("authoredCubeMapAsset", &EditorReflectionProbeComponent::m_authoredCubeMapAsset)
;
@@ -67,6 +68,13 @@ namespace AZ
->DataElement(AZ::Edit::UIHandlers::Default, &EditorReflectionProbeComponent::m_useBakedCubemap, "Use Baked Cubemap", "Selects between a cubemap that captures the environment at location in the scene or a preauthored cubemap")
->Attribute(AZ::Edit::Attributes::ChangeValidate, &EditorReflectionProbeComponent::OnUseBakedCubemapValidate)
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorReflectionProbeComponent::OnUseBakedCubemapChanged)
->DataElement(AZ::Edit::UIHandlers::ComboBox, &EditorReflectionProbeComponent::m_bakedCubeMapQualityLevel, "Baked Cubemap Quality", "Resolution of the baked cubemap")
->Attribute(AZ::Edit::Attributes::Visibility, &EditorReflectionProbeComponent::GetBakedCubemapVisibilitySetting)
->EnumAttribute(BakedCubeMapQualityLevel::VeryLow, "Very Low")
->EnumAttribute(BakedCubeMapQualityLevel::Low, "Low")
->EnumAttribute(BakedCubeMapQualityLevel::Medium, "Medium")
->EnumAttribute(BakedCubeMapQualityLevel::High, "High")
->EnumAttribute(BakedCubeMapQualityLevel::VeryHigh, "Very High")
->DataElement(AZ::Edit::UIHandlers::MultiLineEdit, &EditorReflectionProbeComponent::m_bakedCubeMapRelativePath, "Baked Cubemap Path", "Baked Cubemap Path")
->Attribute(AZ::Edit::Attributes::ReadOnly, true)
->Attribute(AZ::Edit::Attributes::Visibility, &EditorReflectionProbeComponent::GetBakedCubemapVisibilitySetting)
@@ -332,6 +340,12 @@ namespace AZ
// clear it to force the generation of a new filename
cubeMapRelativePath.clear();
}
// if the quality level changed we need to generate a new filename
if (m_controller.m_configuration.m_bakedCubeMapQualityLevel != m_bakedCubeMapQualityLevel)
{
cubeMapRelativePath.clear();
}
}
// build a new cubemap path if necessary
@@ -345,7 +359,10 @@ namespace AZ
AZStd::string uuidString;
uuid.ToString(uuidString);
cubeMapRelativePath = "ReflectionProbes/" + entity->GetName() + "_" + uuidString + "_iblspecularcm.dds";
// determine the filemask suffix from the cubemap quality level setting
AZStd::string fileSuffix = BakedCubeMapFileSuffixes[aznumeric_cast<uint32_t>(m_bakedCubeMapQualityLevel)];
cubeMapRelativePath = "ReflectionProbes/" + entity->GetName() + "_" + uuidString + fileSuffix;
// replace any invalid filename characters
auto invalidCharacters = [](char letter)
@@ -384,6 +401,7 @@ namespace AZ
// save the relative source path in the configuration
AzToolsFramework::ScopedUndoBatch undoBatch("Cubemap path changed.");
m_controller.m_configuration.m_bakedCubeMapRelativePath = cubeMapRelativePath;
m_controller.m_configuration.m_bakedCubeMapQualityLevel = m_bakedCubeMapQualityLevel;
SetDirty();
// update UI cubemap path display
@@ -77,6 +77,7 @@ namespace AZ
// UI settings
// the user can select between a baked cubemap or an authored cubemap asset
bool m_useBakedCubemap = true;
BakedCubeMapQualityLevel m_bakedCubeMapQualityLevel = BakedCubeMapQualityLevel::Medium;
AZStd::string m_bakedCubeMapRelativePath;
Data::Asset<RPI::StreamingImageAsset> m_bakedCubeMapAsset;
Data::Asset<RPI::StreamingImageAsset> m_authoredCubeMapAsset;
@@ -46,6 +46,7 @@ namespace AZ
->Field("InnerLength", &ReflectionProbeComponentConfig::m_innerLength)
->Field("InnerWidth", &ReflectionProbeComponentConfig::m_innerWidth)
->Field("UseBakedCubemap", &ReflectionProbeComponentConfig::m_useBakedCubemap)
->Field("BakedCubemapQualityLevel", &ReflectionProbeComponentConfig::m_bakedCubeMapQualityLevel)
->Field("BakedCubeMapRelativePath", &ReflectionProbeComponentConfig::m_bakedCubeMapRelativePath)
->Field("BakedCubeMapAsset", &ReflectionProbeComponentConfig::m_bakedCubeMapAsset)
->Field("AuthoredCubeMapAsset", &ReflectionProbeComponentConfig::m_authoredCubeMapAsset)
@@ -24,6 +24,29 @@ namespace AZ
{
namespace Render
{
enum class BakedCubeMapQualityLevel : uint32_t
{
VeryLow, // 64
Low, // 128
Medium, // 256
High, // 512
VeryHigh, // 1024
Count
};
static const char* BakedCubeMapFileSuffixes[] =
{
"_iblspecularcm64.dds",
"_iblspecularcm128.dds",
"_iblspecularcm256.dds",
"_iblspecularcm512.dds",
"_iblspecularcm1024.dds"
};
static_assert(AZ_ARRAY_SIZE(BakedCubeMapFileSuffixes) == aznumeric_cast<uint32_t>(BakedCubeMapQualityLevel::Count),
"BakedCubeMapFileSuffixes must have the same number of entries as BakedCubeMapQualityLevel");
class ReflectionProbeComponentConfig final
: public AZ::ComponentConfig
{
@@ -43,6 +66,7 @@ namespace AZ
bool m_showVisualization = true;
bool m_useBakedCubemap = true;
BakedCubeMapQualityLevel m_bakedCubeMapQualityLevel = BakedCubeMapQualityLevel::Medium;
AZStd::string m_bakedCubeMapRelativePath;
Data::Asset<RPI::StreamingImageAsset> m_bakedCubeMapAsset;
Data::Asset<RPI::StreamingImageAsset> m_authoredCubeMapAsset;