puvvadar пре 4 година
родитељ
комит
48f6a3e2d8

+ 18 - 0
Config/AtomImageBuilder/Test_Linear_to_Auto.preset

@@ -0,0 +1,18 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "MultiplatformPresetSettings",
+    "ClassData": {
+        "DefaultPreset": {
+            "UUID": "{9E5BBFB4-BDDA-4759-AB74-D047EE25A35D}",
+            "Name": "Test_Linear_to_Auto",
+            "SourceColor": "Linear",
+            "DestColor": "Auto",
+            "FileMasks": [
+                "_linear-to-auto"
+            ],
+            "PixelFormat": "R8G8B8X8",
+            "DiscardAlpha": true
+        }
+    }
+}

+ 18 - 0
Config/AtomImageBuilder/Test_Linear_to_Linear.preset

@@ -0,0 +1,18 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "MultiplatformPresetSettings",
+    "ClassData": {
+        "DefaultPreset": {
+            "UUID": "{31199710-5B61-4A30-99F0-18DF724EC308}",
+            "Name": "Test_Linear_to_Linear",
+            "SourceColor": "Linear",
+            "DestColor": "Linear",
+            "FileMasks": [
+                "_linear-to-linear"
+            ],
+            "PixelFormat": "R8G8B8X8",
+            "DiscardAlpha": true
+        }
+    }
+}

+ 18 - 0
Config/AtomImageBuilder/Test_Linear_to_sRGB.preset

@@ -0,0 +1,18 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "MultiplatformPresetSettings",
+    "ClassData": {
+        "DefaultPreset": {
+            "UUID": "{F0E6BE7F-376E-4F1B-9244-70E01C1CABD6}",
+            "Name": "Test_Linear_to_sRGB",
+            "SourceColor": "Linear",
+            "DestColor": "sRGB",
+            "FileMasks": [
+                "_linear-to-srgb"
+            ],
+            "PixelFormat": "R8G8B8X8",
+            "DiscardAlpha": true
+        }
+    }
+}

+ 18 - 0
Config/AtomImageBuilder/Test_sRGB_to_Auto.preset

@@ -0,0 +1,18 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "MultiplatformPresetSettings",
+    "ClassData": {
+        "DefaultPreset": {
+            "UUID": "{EE397A40-4430-437F-B0EF-9EC8B6E35176}",
+            "Name": "Test_sRGB_to_Auto",
+            "SourceColor": "sRGB",
+            "DestColor": "Auto",
+            "FileMasks": [
+                "_srgb-to-auto"
+            ],
+            "PixelFormat": "R8G8B8X8",
+            "DiscardAlpha": true
+        }
+    }
+}

+ 18 - 0
Config/AtomImageBuilder/Test_sRGB_to_Linear.preset

@@ -0,0 +1,18 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "MultiplatformPresetSettings",
+    "ClassData": {
+        "DefaultPreset": {
+            "UUID": "{2865D7A5-B75D-4D9C-9591-47BD2FF93377}",
+            "Name": "Test_sRGB_to_Linear",
+            "SourceColor": "sRGB",
+            "DestColor": "Linear",
+            "FileMasks": [
+                "_srgb-to-linear"
+            ],
+            "PixelFormat": "R8G8B8X8",
+            "DiscardAlpha": true
+        }
+    }
+}

+ 18 - 0
Config/AtomImageBuilder/Test_sRGB_to_sRGB.preset

@@ -0,0 +1,18 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "MultiplatformPresetSettings",
+    "ClassData": {
+        "DefaultPreset": {
+            "UUID": "{9FBA54D5-EF6F-4728-AF92-B0176B8308C5}",
+            "Name": "Test_sRGB_to_sRGB",
+            "SourceColor": "sRGB",
+            "DestColor": "sRGB",
+            "FileMasks": [
+                "_srgb-to-srgb"
+            ],
+            "PixelFormat": "R8G8B8X8",
+            "DiscardAlpha": true
+        }
+    }
+}

+ 11 - 0
Config/shader_global_build_options.json

@@ -0,0 +1,11 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "GlobalBuildOptions",
+    "ClassData": {
+        "ShaderCompilerArguments" : {
+            "DefaultMatrixOrder" : "Row",
+            "AzslcAdditionalFreeArguments" : "--strip-unused-srgs"
+        }
+    }
+}

+ 3 - 0
ShaderLib/README.md

@@ -0,0 +1,3 @@
+Please read  
+*dev/Gems/Atom/Feature/Common/Assets/ShaderResourceGroups/README.md*  
+for details on how to customize scenesrg.srgi and viewsrg.srgi.  

+ 28 - 0
ShaderLib/raytracingscenesrg.srgi

@@ -0,0 +1,28 @@
+/*
+* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
+* its licensors.
+*
+* For complete copyright and license terms please see the LICENSE at the root of this
+* distribution (the "License"). All use of this software is governed by the License,
+* or, if provided, by the license below or the license accompanying this file. Do not
+* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*
+*/
+
+#pragma once
+
+// Please read README.md for an explanation on why scenesrg.srgi and viewsrg.srgi are
+// located in this folder (And how you can optionally customize your own scenesrg.srgi
+// and viewsrg.srgi in your game project).
+
+#include <Atom/Features/SrgSemantics.azsli>
+
+partial ShaderResourceGroup RayTracingSceneSrg : SRG_RayTracingScene
+{
+/* Intentionally Empty. Helps define the SrgSemantic for RayTracingSceneSrg once.*/
+};
+
+#define AZ_COLLECTING_PARTIAL_SRGS
+#include <Atom/Feature/Common/Assets/ShaderResourceGroups/RayTracingSceneSrgAll.azsli>
+#undef AZ_COLLECTING_PARTIAL_SRGS

+ 28 - 0
ShaderLib/scenesrg.srgi

@@ -0,0 +1,28 @@
+/*
+* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
+* its licensors.
+*
+* For complete copyright and license terms please see the LICENSE at the root of this
+* distribution (the "License"). All use of this software is governed by the License,
+* or, if provided, by the license below or the license accompanying this file. Do not
+* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*
+*/
+
+#pragma once
+
+// Please read README.md for an explanation on why scenesrg.srgi and viewsrg.srgi are
+// located in this folder (And how you can optionally customize your own scenesrg.srgi
+// and viewsrg.srgi in your game project).
+
+#include <Atom/Features/SrgSemantics.azsli>
+
+partial ShaderResourceGroup SceneSrg : SRG_PerScene
+{
+/* Intentionally Empty. Helps define the SrgSemantic for SceneSrg once.*/
+};
+
+#define AZ_COLLECTING_PARTIAL_SRGS
+#include <Atom/Feature/Common/Assets/ShaderResourceGroups/SceneSrgAll.azsli>
+#undef AZ_COLLECTING_PARTIAL_SRGS

+ 28 - 0
ShaderLib/viewsrg.srgi

@@ -0,0 +1,28 @@
+/*
+* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
+* its licensors.
+*
+* For complete copyright and license terms please see the LICENSE at the root of this
+* distribution (the "License"). All use of this software is governed by the License,
+* or, if provided, by the license below or the license accompanying this file. Do not
+* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*
+*/
+
+#pragma once
+
+// Please read README.md for an explanation on why scenesrg.srgi and viewsrg.srgi are
+// located in this folder (And how you can optionally customize your own scenesrg.srgi
+// and viewsrg.srgi in your game project).
+
+#include <Atom/Features/SrgSemantics.azsli>
+
+partial ShaderResourceGroup ViewSrg : SRG_PerView
+{
+/* Intentionally Empty. Helps define the SrgSemantic for ViewSrg once.*/
+};
+
+#define AZ_COLLECTING_PARTIAL_SRGS
+#include <Atom/Feature/Common/Assets/ShaderResourceGroups/ViewSrgAll.azsli>
+#undef AZ_COLLECTING_PARTIAL_SRGS

+ 55 - 0
Shaders/CommonVS.azsli

@@ -0,0 +1,55 @@
+
+/*
+* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
+* its licensors.
+*
+* For complete copyright and license terms please see the LICENSE at the root of this
+* distribution (the "License"). All use of this software is governed by the License,
+* or, if provided, by the license below or the license accompanying this file. Do not
+* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*
+*/
+
+#pragma once
+
+#include <viewsrg.srgi>
+#include <Atom/RPI/Assets/ShaderLib/Atom/RPI/ShaderResourceGroups/DefaultObjectSrg.azsli>
+#include <Atom/RPI/Assets/ShaderLib/Atom/RPI/TangentSpace.azsli>
+
+struct VertexInput
+{
+    float3 m_position : POSITION;
+    float3 m_normal : NORMAL;
+    float4 m_tangent : TANGENT;
+    float3 m_bitangent : BITANGENT;
+    float2 m_uv : UV0;
+};
+
+struct VertexOutput
+{
+    float4 m_position : SV_Position;
+    float3 m_normal : NORMAL;
+    float3 m_tangent : TANGENT;
+    float3 m_bitangent : BITANGENT;
+    float2 m_uv : UV0;
+    float3 m_view : VIEW;
+};
+
+VertexOutput CommonVS(VertexInput input)
+{
+    float4x4 objectToWorld = ObjectSrg::GetWorldMatrix();
+    float3x3 objectToWorldIT = ObjectSrg::GetWorldMatrixInverseTranspose();
+
+    VertexOutput output;
+    float3 worldPosition = mul(objectToWorld, float4(input.m_position, 1)).xyz;
+    output.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(worldPosition, 1.0));
+
+    output.m_uv = input.m_uv;
+        
+    output.m_view = worldPosition - ViewSrg::m_worldPosition;
+    
+    ConstructTBN(input.m_normal, input.m_tangent, input.m_bitangent, objectToWorld, objectToWorldIT, output.m_normal, output.m_tangent, output.m_bitangent);
+
+    return output;
+}