Setup and start for ASGM3
This commit is contained in:
parent
216ecc23f1
commit
5c46b54ee8
15
ASN3_SimpleStateMach/ASN3_SimpleStateMach.uproject
Normal file
15
ASN3_SimpleStateMach/ASN3_SimpleStateMach.uproject
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"FileVersion": 3,
|
||||
"EngineAssociation": "5.1",
|
||||
"Category": "",
|
||||
"Description": "",
|
||||
"Plugins": [
|
||||
{
|
||||
"Name": "ModelingToolsEditorMode",
|
||||
"Enabled": true,
|
||||
"TargetAllowList": [
|
||||
"Editor"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
0
ASN3_SimpleStateMach/Config/DefaultEditor.ini
Normal file
0
ASN3_SimpleStateMach/Config/DefaultEditor.ini
Normal file
69
ASN3_SimpleStateMach/Config/DefaultEngine.ini
Normal file
69
ASN3_SimpleStateMach/Config/DefaultEngine.ini
Normal file
@ -0,0 +1,69 @@
|
||||
|
||||
|
||||
[/Script/EngineSettings.GameMapsSettings]
|
||||
GameDefaultMap=/Engine/Maps/Templates/OpenWorld
|
||||
|
||||
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
||||
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
|
||||
-D3D12TargetedShaderFormats=PCD3D_SM5
|
||||
+D3D12TargetedShaderFormats=PCD3D_SM6
|
||||
-D3D11TargetedShaderFormats=PCD3D_SM5
|
||||
+D3D11TargetedShaderFormats=PCD3D_SM5
|
||||
Compiler=Default
|
||||
AudioSampleRate=48000
|
||||
AudioCallbackBufferFrameSize=1024
|
||||
AudioNumBuffersToEnqueue=1
|
||||
AudioMaxChannels=0
|
||||
AudioNumSourceWorkers=4
|
||||
SpatializationPlugin=
|
||||
SourceDataOverridePlugin=
|
||||
ReverbPlugin=
|
||||
OcclusionPlugin=
|
||||
CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0)
|
||||
CacheSizeKB=65536
|
||||
MaxChunkSizeOverrideKB=0
|
||||
bResampleForDevice=False
|
||||
MaxSampleRate=48000.000000
|
||||
HighSampleRate=32000.000000
|
||||
MedSampleRate=24000.000000
|
||||
LowSampleRate=12000.000000
|
||||
MinSampleRate=8000.000000
|
||||
CompressionQualityModifier=1.000000
|
||||
AutoStreamingThreshold=0.000000
|
||||
SoundCueCookQualityIndex=-1
|
||||
|
||||
|
||||
[/Script/HardwareTargeting.HardwareTargetingSettings]
|
||||
TargetedHardwareClass=Desktop
|
||||
AppliedTargetedHardwareClass=Desktop
|
||||
DefaultGraphicsPerformance=Maximum
|
||||
AppliedDefaultGraphicsPerformance=Maximum
|
||||
|
||||
[/Script/Engine.RendererSettings]
|
||||
r.GenerateMeshDistanceFields=True
|
||||
r.DynamicGlobalIlluminationMethod=1
|
||||
r.ReflectionMethod=1
|
||||
r.Shadow.Virtual.Enable=1
|
||||
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
|
||||
|
||||
[/Script/WorldPartitionEditor.WorldPartitionEditorSettings]
|
||||
CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet'
|
||||
|
||||
[/Script/Engine.Engine]
|
||||
+ActiveGameNameRedirects=(OldGameName="TP_BlankBP",NewGameName="/Script/ASN3_SimpleStateMach")
|
||||
+ActiveGameNameRedirects=(OldGameName="/Script/TP_BlankBP",NewGameName="/Script/ASN3_SimpleStateMach")
|
||||
|
||||
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
|
||||
bEnablePlugin=True
|
||||
bAllowNetworkConnection=True
|
||||
SecurityToken=7490124E43C38CB067CEB0853A37EBA1
|
||||
bIncludeInShipping=False
|
||||
bAllowExternalStartInShipping=False
|
||||
bCompileAFSProject=False
|
||||
bUseCompression=False
|
||||
bLogFiles=False
|
||||
bReportStats=False
|
||||
ConnectionType=USBOnly
|
||||
bUseManualIPAddress=False
|
||||
ManualIPAddress=
|
||||
|
4
ASN3_SimpleStateMach/Config/DefaultGame.ini
Normal file
4
ASN3_SimpleStateMach/Config/DefaultGame.ini
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
[/Script/EngineSettings.GeneralProjectSettings]
|
||||
ProjectID=8DEA9DCF49EB217487667CA8FE7150D1
|
85
ASN3_SimpleStateMach/Config/DefaultInput.ini
Normal file
85
ASN3_SimpleStateMach/Config/DefaultInput.ini
Normal file
@ -0,0 +1,85 @@
|
||||
[/Script/Engine.InputSettings]
|
||||
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
bAltEnterTogglesFullscreen=True
|
||||
bF11TogglesFullscreen=True
|
||||
bUseMouseForTouch=False
|
||||
bEnableMouseSmoothing=True
|
||||
bEnableFOVScaling=True
|
||||
bCaptureMouseOnLaunch=True
|
||||
bEnableLegacyInputScales=True
|
||||
bEnableMotionControls=True
|
||||
bFilterInputByPlatformUser=False
|
||||
bShouldFlushPressedKeysOnViewportFocusLost=True
|
||||
bAlwaysShowTouchInterface=False
|
||||
bShowConsoleOnFourFingerTap=True
|
||||
bEnableGestureRecognizer=False
|
||||
bUseAutocorrect=False
|
||||
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
|
||||
DefaultViewportMouseLockMode=LockOnCapture
|
||||
FOVScale=0.011110
|
||||
DoubleClickTime=0.200000
|
||||
DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput
|
||||
DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent
|
||||
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
|
||||
-ConsoleKeys=Tilde
|
||||
+ConsoleKeys=Tilde
|
||||
+ConsoleKeys=Caret
|
||||
|
BIN
ASN3_SimpleStateMach/Content/RCQuick/Maps/SSM.umap
(Stored with Git LFS)
Normal file
BIN
ASN3_SimpleStateMach/Content/RCQuick/Maps/SSM.umap
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
ASN3_SimpleStateMach/Intermediate/CachedAssetRegistry.bin
Normal file
BIN
ASN3_SimpleStateMach/Intermediate/CachedAssetRegistry.bin
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@
|
||||
[Internationalization]
|
||||
ShouldUseLocalizedNumericInput=True
|
||||
|
BIN
ASN3_SimpleStateMach/Intermediate/ReimportCache/3688439234.bin
Normal file
BIN
ASN3_SimpleStateMach/Intermediate/ReimportCache/3688439234.bin
Normal file
Binary file not shown.
@ -0,0 +1,489 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
float SampleDeviceZFromSceneTexturesTempCopy(float2 UV)
|
||||
{
|
||||
return SceneDepthTexture.SampleLevel(SceneDepthTextureSampler, UV, 0).r;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GBUFFER_LAYOUT
|
||||
#define GBUFFER_LAYOUT 0
|
||||
#endif
|
||||
|
||||
#if GBUFFER_LAYOUT == 0
|
||||
|
||||
void EncodeGBufferToMRT(inout FPixelShaderOut Out, FGBufferData GBuffer, float QuantizationBias)
|
||||
{
|
||||
float4 MrtFloat1 = 0.0f;
|
||||
float4 MrtFloat2 = 0.0f;
|
||||
uint4 MrtUint2 = 0;
|
||||
float4 MrtFloat3 = 0.0f;
|
||||
float4 MrtFloat4 = 0.0f;
|
||||
float4 MrtFloat5 = 0.0f;
|
||||
|
||||
float3 WorldNormal_Compressed = EncodeNormalHelper(GBuffer.WorldNormal, 0.0f);
|
||||
|
||||
MrtFloat1.x = WorldNormal_Compressed.x;
|
||||
MrtFloat1.y = WorldNormal_Compressed.y;
|
||||
MrtFloat1.z = WorldNormal_Compressed.z;
|
||||
MrtFloat1.w = GBuffer.PerObjectGBufferData.x;
|
||||
MrtFloat2.x = GBuffer.Metallic.x;
|
||||
MrtFloat2.y = GBuffer.Specular.x;
|
||||
MrtFloat2.z = GBuffer.Roughness.x;
|
||||
MrtUint2.w |= ((((GBuffer.ShadingModelID.x) >> 0) & 0x0f) << 0);
|
||||
MrtUint2.w |= ((((GBuffer.SelectiveOutputMask.x) >> 0) & 0x0f) << 4);
|
||||
MrtFloat3.x = GBuffer.BaseColor.x;
|
||||
MrtFloat3.y = GBuffer.BaseColor.y;
|
||||
MrtFloat3.z = GBuffer.BaseColor.z;
|
||||
MrtFloat3.w = GBuffer.GenericAO.x;
|
||||
MrtFloat5.x = GBuffer.PrecomputedShadowFactors.x;
|
||||
MrtFloat5.y = GBuffer.PrecomputedShadowFactors.y;
|
||||
MrtFloat5.z = GBuffer.PrecomputedShadowFactors.z;
|
||||
MrtFloat5.w = GBuffer.PrecomputedShadowFactors.w;
|
||||
MrtFloat4.x = GBuffer.CustomData.x;
|
||||
MrtFloat4.y = GBuffer.CustomData.y;
|
||||
MrtFloat4.z = GBuffer.CustomData.z;
|
||||
MrtFloat4.w = GBuffer.CustomData.w;
|
||||
|
||||
Out.MRT[1] = MrtFloat1;
|
||||
Out.MRT[2] = float4(MrtFloat2.x, MrtFloat2.y, MrtFloat2.z, (float(MrtUint2.w) + .5f) / 255.0f);
|
||||
Out.MRT[3] = MrtFloat3;
|
||||
Out.MRT[4] = MrtFloat4;
|
||||
Out.MRT[5] = MrtFloat5;
|
||||
Out.MRT[6] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Out.MRT[7] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
FGBufferData DecodeGBufferDataDirect(float4 InMRT1,
|
||||
float4 InMRT2,
|
||||
float4 InMRT3,
|
||||
float4 InMRT4,
|
||||
float4 InMRT5,
|
||||
|
||||
float CustomNativeDepth,
|
||||
float4 AnisotropicData,
|
||||
uint CustomStencil,
|
||||
float SceneDepth,
|
||||
bool bGetNormalizedNormal,
|
||||
bool bChecker)
|
||||
{
|
||||
FGBufferData Ret = (FGBufferData)0;
|
||||
float3 WorldNormal_Compressed = 0.0f;
|
||||
WorldNormal_Compressed.x = InMRT1.x;
|
||||
WorldNormal_Compressed.y = InMRT1.y;
|
||||
WorldNormal_Compressed.z = InMRT1.z;
|
||||
Ret.PerObjectGBufferData.x = InMRT1.w;
|
||||
Ret.Metallic.x = InMRT2.x;
|
||||
Ret.Specular.x = InMRT2.y;
|
||||
Ret.Roughness.x = InMRT2.z;
|
||||
Ret.ShadingModelID.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 0) & 0x0f) << 0);
|
||||
Ret.SelectiveOutputMask.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 4) & 0x0f) << 0);
|
||||
Ret.BaseColor.x = InMRT3.x;
|
||||
Ret.BaseColor.y = InMRT3.y;
|
||||
Ret.BaseColor.z = InMRT3.z;
|
||||
Ret.GenericAO.x = InMRT3.w;
|
||||
Ret.PrecomputedShadowFactors.x = InMRT5.x;
|
||||
Ret.PrecomputedShadowFactors.y = InMRT5.y;
|
||||
Ret.PrecomputedShadowFactors.z = InMRT5.z;
|
||||
Ret.PrecomputedShadowFactors.w = InMRT5.w;
|
||||
Ret.CustomData.x = InMRT4.x;
|
||||
Ret.CustomData.y = InMRT4.y;
|
||||
Ret.CustomData.z = InMRT4.z;
|
||||
Ret.CustomData.w = InMRT4.w;
|
||||
|
||||
Ret.WorldNormal = DecodeNormalHelper(WorldNormal_Compressed);
|
||||
Ret.WorldTangent = AnisotropicData.xyz;
|
||||
Ret.Anisotropy = AnisotropicData.w;
|
||||
|
||||
GBufferPostDecode(Ret,bChecker,bGetNormalizedNormal);
|
||||
|
||||
Ret.CustomDepth = ConvertFromDeviceZ(CustomNativeDepth);
|
||||
Ret.CustomStencil = CustomStencil;
|
||||
Ret.Depth = SceneDepth;
|
||||
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUV(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = Texture2DSampleLevel(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct_CustomDepthTextureSampler, UV, 0).r;
|
||||
int2 IntUV = (int2)trunc(UV * View.BufferSizeAndInvSize.xy * View.BufferToSceneTextureScale.xy);
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(IntUV, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(UV);
|
||||
float4 AnisotropicData = Texture2DSampleLevel(SceneTexturesStruct.GBufferFTexture, SceneTexturesStruct_GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = Texture2DSampleLevel(SceneTexturesStruct.GBufferATexture, SceneTexturesStruct_GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferBTexture, SceneTexturesStruct_GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = Texture2DSampleLevel(SceneTexturesStruct.GBufferCTexture, SceneTexturesStruct_GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = Texture2DSampleLevel(SceneTexturesStruct.GBufferDTexture, SceneTexturesStruct_GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = SceneTexturesStruct.CustomDepthTexture.Load(int3(PixelPos, 0)).r;
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(PixelPos, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(PixelPos);
|
||||
float4 AnisotropicData = SceneTexturesStruct.GBufferFTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = SceneTexturesStruct.GBufferATexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT2 = SceneTexturesStruct.GBufferBTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT3 = SceneTexturesStruct.GBufferCTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT4 = SceneTexturesStruct.GBufferDTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT5 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelPos));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTextures(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SampleDeviceZFromSceneTexturesTempCopy(UV);
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.SampleLevel(GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.SampleLevel(GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.SampleLevel(GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.SampleLevel(GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = GBufferDTexture.SampleLevel(GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTexturesLoad(uint2 PixelCoord, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SceneDepthTexture.Load(int3(PixelCoord, 0)).r;
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT4 = GBufferDTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT5 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelCoord));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if GBUFFER_LAYOUT == 1
|
||||
|
||||
void EncodeGBufferToMRT(inout FPixelShaderOut Out, FGBufferData GBuffer, float QuantizationBias)
|
||||
{
|
||||
float4 MrtFloat1 = 0.0f;
|
||||
float4 MrtFloat2 = 0.0f;
|
||||
uint4 MrtUint2 = 0;
|
||||
float4 MrtFloat3 = 0.0f;
|
||||
float2 MrtFloat4 = 0.0f;
|
||||
float4 MrtFloat5 = 0.0f;
|
||||
float4 MrtFloat6 = 0.0f;
|
||||
|
||||
float3 WorldNormal_Compressed = EncodeNormalHelper(GBuffer.WorldNormal, 0.0f);
|
||||
|
||||
MrtFloat1.x = WorldNormal_Compressed.x;
|
||||
MrtFloat1.y = WorldNormal_Compressed.y;
|
||||
MrtFloat1.z = WorldNormal_Compressed.z;
|
||||
MrtFloat1.w = GBuffer.PerObjectGBufferData.x;
|
||||
MrtFloat2.x = GBuffer.Metallic.x;
|
||||
MrtFloat2.y = GBuffer.Specular.x;
|
||||
MrtFloat2.z = GBuffer.Roughness.x;
|
||||
MrtUint2.w |= ((((GBuffer.ShadingModelID.x) >> 0) & 0x0f) << 0);
|
||||
MrtUint2.w |= ((((GBuffer.SelectiveOutputMask.x) >> 0) & 0x0f) << 4);
|
||||
MrtFloat3.x = GBuffer.BaseColor.x;
|
||||
MrtFloat3.y = GBuffer.BaseColor.y;
|
||||
MrtFloat3.z = GBuffer.BaseColor.z;
|
||||
MrtFloat3.w = GBuffer.GenericAO.x;
|
||||
MrtFloat4.x = GBuffer.Velocity.x;
|
||||
MrtFloat4.y = GBuffer.Velocity.y;
|
||||
MrtFloat6.x = GBuffer.PrecomputedShadowFactors.x;
|
||||
MrtFloat6.y = GBuffer.PrecomputedShadowFactors.y;
|
||||
MrtFloat6.z = GBuffer.PrecomputedShadowFactors.z;
|
||||
MrtFloat6.w = GBuffer.PrecomputedShadowFactors.w;
|
||||
MrtFloat5.x = GBuffer.CustomData.x;
|
||||
MrtFloat5.y = GBuffer.CustomData.y;
|
||||
MrtFloat5.z = GBuffer.CustomData.z;
|
||||
MrtFloat5.w = GBuffer.CustomData.w;
|
||||
|
||||
Out.MRT[1] = MrtFloat1;
|
||||
Out.MRT[2] = float4(MrtFloat2.x, MrtFloat2.y, MrtFloat2.z, (float(MrtUint2.w) + .5f) / 255.0f);
|
||||
Out.MRT[3] = MrtFloat3;
|
||||
Out.MRT[4] = float4(MrtFloat4.x, MrtFloat4.y, 0.0f, 0.0f);
|
||||
Out.MRT[5] = MrtFloat5;
|
||||
Out.MRT[6] = MrtFloat6;
|
||||
Out.MRT[7] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
FGBufferData DecodeGBufferDataDirect(float4 InMRT1,
|
||||
float4 InMRT2,
|
||||
float4 InMRT3,
|
||||
float2 InMRT4,
|
||||
float4 InMRT5,
|
||||
float4 InMRT6,
|
||||
|
||||
float CustomNativeDepth,
|
||||
float4 AnisotropicData,
|
||||
uint CustomStencil,
|
||||
float SceneDepth,
|
||||
bool bGetNormalizedNormal,
|
||||
bool bChecker)
|
||||
{
|
||||
FGBufferData Ret = (FGBufferData)0;
|
||||
float3 WorldNormal_Compressed = 0.0f;
|
||||
WorldNormal_Compressed.x = InMRT1.x;
|
||||
WorldNormal_Compressed.y = InMRT1.y;
|
||||
WorldNormal_Compressed.z = InMRT1.z;
|
||||
Ret.PerObjectGBufferData.x = InMRT1.w;
|
||||
Ret.Metallic.x = InMRT2.x;
|
||||
Ret.Specular.x = InMRT2.y;
|
||||
Ret.Roughness.x = InMRT2.z;
|
||||
Ret.ShadingModelID.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 0) & 0x0f) << 0);
|
||||
Ret.SelectiveOutputMask.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 4) & 0x0f) << 0);
|
||||
Ret.BaseColor.x = InMRT3.x;
|
||||
Ret.BaseColor.y = InMRT3.y;
|
||||
Ret.BaseColor.z = InMRT3.z;
|
||||
Ret.GenericAO.x = InMRT3.w;
|
||||
Ret.Velocity.x = InMRT4.x;
|
||||
Ret.Velocity.y = InMRT4.y;
|
||||
Ret.PrecomputedShadowFactors.x = InMRT6.x;
|
||||
Ret.PrecomputedShadowFactors.y = InMRT6.y;
|
||||
Ret.PrecomputedShadowFactors.z = InMRT6.z;
|
||||
Ret.PrecomputedShadowFactors.w = InMRT6.w;
|
||||
Ret.CustomData.x = InMRT5.x;
|
||||
Ret.CustomData.y = InMRT5.y;
|
||||
Ret.CustomData.z = InMRT5.z;
|
||||
Ret.CustomData.w = InMRT5.w;
|
||||
|
||||
Ret.WorldNormal = DecodeNormalHelper(WorldNormal_Compressed);
|
||||
Ret.WorldTangent = AnisotropicData.xyz;
|
||||
Ret.Anisotropy = AnisotropicData.w;
|
||||
|
||||
GBufferPostDecode(Ret,bChecker,bGetNormalizedNormal);
|
||||
|
||||
Ret.CustomDepth = ConvertFromDeviceZ(CustomNativeDepth);
|
||||
Ret.CustomStencil = CustomStencil;
|
||||
Ret.Depth = SceneDepth;
|
||||
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUV(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = Texture2DSampleLevel(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct_CustomDepthTextureSampler, UV, 0).r;
|
||||
int2 IntUV = (int2)trunc(UV * View.BufferSizeAndInvSize.xy * View.BufferToSceneTextureScale.xy);
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(IntUV, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(UV);
|
||||
float4 AnisotropicData = Texture2DSampleLevel(SceneTexturesStruct.GBufferFTexture, SceneTexturesStruct_GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = Texture2DSampleLevel(SceneTexturesStruct.GBufferATexture, SceneTexturesStruct_GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferBTexture, SceneTexturesStruct_GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = Texture2DSampleLevel(SceneTexturesStruct.GBufferCTexture, SceneTexturesStruct_GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float2 InMRT4 = Texture2DSampleLevel(SceneTexturesStruct.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0).xy;
|
||||
float4 InMRT5 = Texture2DSampleLevel(SceneTexturesStruct.GBufferDTexture, SceneTexturesStruct_GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = SceneTexturesStruct.CustomDepthTexture.Load(int3(PixelPos, 0)).r;
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(PixelPos, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(PixelPos);
|
||||
float4 AnisotropicData = SceneTexturesStruct.GBufferFTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = SceneTexturesStruct.GBufferATexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT2 = SceneTexturesStruct.GBufferBTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT3 = SceneTexturesStruct.GBufferCTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float2 InMRT4 = SceneTexturesStruct.GBufferVelocityTexture.Load(int3(PixelPos, 0)).xy;
|
||||
float4 InMRT5 = SceneTexturesStruct.GBufferDTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT6 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelPos));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTextures(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SampleDeviceZFromSceneTexturesTempCopy(UV);
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.SampleLevel(GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.SampleLevel(GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.SampleLevel(GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.SampleLevel(GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float2 InMRT4 = GBufferVelocityTexture.SampleLevel(GBufferVelocityTextureSampler, UV, 0).xy;
|
||||
float4 InMRT5 = GBufferDTexture.SampleLevel(GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTexturesLoad(uint2 PixelCoord, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SceneDepthTexture.Load(int3(PixelCoord, 0)).r;
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float2 InMRT4 = GBufferVelocityTexture.Load(int3(PixelCoord, 0)).xy;
|
||||
float4 InMRT5 = GBufferDTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelCoord));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,511 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
float SampleDeviceZFromSceneTexturesTempCopy(float2 UV)
|
||||
{
|
||||
return SceneDepthTexture.SampleLevel(SceneDepthTextureSampler, UV, 0).r;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GBUFFER_LAYOUT
|
||||
#define GBUFFER_LAYOUT 0
|
||||
#endif
|
||||
|
||||
#if GBUFFER_LAYOUT == 0
|
||||
|
||||
void EncodeGBufferToMRT(inout FPixelShaderOut Out, FGBufferData GBuffer, float QuantizationBias)
|
||||
{
|
||||
float4 MrtFloat1 = 0.0f;
|
||||
float4 MrtFloat2 = 0.0f;
|
||||
uint4 MrtUint2 = 0;
|
||||
float4 MrtFloat3 = 0.0f;
|
||||
float4 MrtFloat4 = 0.0f;
|
||||
float4 MrtFloat5 = 0.0f;
|
||||
float4 MrtFloat6 = 0.0f;
|
||||
|
||||
float3 WorldNormal_Compressed = EncodeNormalHelper(GBuffer.WorldNormal, 0.0f);
|
||||
|
||||
MrtFloat1.x = WorldNormal_Compressed.x;
|
||||
MrtFloat1.y = WorldNormal_Compressed.y;
|
||||
MrtFloat1.z = WorldNormal_Compressed.z;
|
||||
MrtFloat1.w = GBuffer.PerObjectGBufferData.x;
|
||||
MrtFloat2.x = GBuffer.Metallic.x;
|
||||
MrtFloat2.y = GBuffer.Specular.x;
|
||||
MrtFloat2.z = GBuffer.Roughness.x;
|
||||
MrtUint2.w |= ((((GBuffer.ShadingModelID.x) >> 0) & 0x0f) << 0);
|
||||
MrtUint2.w |= ((((GBuffer.SelectiveOutputMask.x) >> 0) & 0x0f) << 4);
|
||||
MrtFloat3.x = GBuffer.BaseColor.x;
|
||||
MrtFloat3.y = GBuffer.BaseColor.y;
|
||||
MrtFloat3.z = GBuffer.BaseColor.z;
|
||||
MrtFloat3.w = GBuffer.GenericAO.x;
|
||||
MrtFloat4.x = GBuffer.Velocity.x;
|
||||
MrtFloat4.y = GBuffer.Velocity.y;
|
||||
MrtFloat4.z = GBuffer.Velocity.z;
|
||||
MrtFloat4.w = GBuffer.Velocity.w;
|
||||
MrtFloat6.x = GBuffer.PrecomputedShadowFactors.x;
|
||||
MrtFloat6.y = GBuffer.PrecomputedShadowFactors.y;
|
||||
MrtFloat6.z = GBuffer.PrecomputedShadowFactors.z;
|
||||
MrtFloat6.w = GBuffer.PrecomputedShadowFactors.w;
|
||||
MrtFloat5.x = GBuffer.CustomData.x;
|
||||
MrtFloat5.y = GBuffer.CustomData.y;
|
||||
MrtFloat5.z = GBuffer.CustomData.z;
|
||||
MrtFloat5.w = GBuffer.CustomData.w;
|
||||
|
||||
Out.MRT[1] = MrtFloat1;
|
||||
Out.MRT[2] = float4(MrtFloat2.x, MrtFloat2.y, MrtFloat2.z, (float(MrtUint2.w) + .5f) / 255.0f);
|
||||
Out.MRT[3] = MrtFloat3;
|
||||
Out.MRT[4] = MrtFloat4;
|
||||
Out.MRT[5] = MrtFloat5;
|
||||
Out.MRT[6] = MrtFloat6;
|
||||
Out.MRT[7] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
FGBufferData DecodeGBufferDataDirect(float4 InMRT1,
|
||||
float4 InMRT2,
|
||||
float4 InMRT3,
|
||||
float4 InMRT4,
|
||||
float4 InMRT5,
|
||||
float4 InMRT6,
|
||||
|
||||
float CustomNativeDepth,
|
||||
float4 AnisotropicData,
|
||||
uint CustomStencil,
|
||||
float SceneDepth,
|
||||
bool bGetNormalizedNormal,
|
||||
bool bChecker)
|
||||
{
|
||||
FGBufferData Ret = (FGBufferData)0;
|
||||
float3 WorldNormal_Compressed = 0.0f;
|
||||
WorldNormal_Compressed.x = InMRT1.x;
|
||||
WorldNormal_Compressed.y = InMRT1.y;
|
||||
WorldNormal_Compressed.z = InMRT1.z;
|
||||
Ret.PerObjectGBufferData.x = InMRT1.w;
|
||||
Ret.Metallic.x = InMRT2.x;
|
||||
Ret.Specular.x = InMRT2.y;
|
||||
Ret.Roughness.x = InMRT2.z;
|
||||
Ret.ShadingModelID.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 0) & 0x0f) << 0);
|
||||
Ret.SelectiveOutputMask.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 4) & 0x0f) << 0);
|
||||
Ret.BaseColor.x = InMRT3.x;
|
||||
Ret.BaseColor.y = InMRT3.y;
|
||||
Ret.BaseColor.z = InMRT3.z;
|
||||
Ret.GenericAO.x = InMRT3.w;
|
||||
Ret.Velocity.x = InMRT4.x;
|
||||
Ret.Velocity.y = InMRT4.y;
|
||||
Ret.Velocity.z = InMRT4.z;
|
||||
Ret.Velocity.w = InMRT4.w;
|
||||
Ret.PrecomputedShadowFactors.x = InMRT6.x;
|
||||
Ret.PrecomputedShadowFactors.y = InMRT6.y;
|
||||
Ret.PrecomputedShadowFactors.z = InMRT6.z;
|
||||
Ret.PrecomputedShadowFactors.w = InMRT6.w;
|
||||
Ret.CustomData.x = InMRT5.x;
|
||||
Ret.CustomData.y = InMRT5.y;
|
||||
Ret.CustomData.z = InMRT5.z;
|
||||
Ret.CustomData.w = InMRT5.w;
|
||||
|
||||
Ret.WorldNormal = DecodeNormalHelper(WorldNormal_Compressed);
|
||||
Ret.WorldTangent = AnisotropicData.xyz;
|
||||
Ret.Anisotropy = AnisotropicData.w;
|
||||
|
||||
GBufferPostDecode(Ret,bChecker,bGetNormalizedNormal);
|
||||
|
||||
Ret.CustomDepth = ConvertFromDeviceZ(CustomNativeDepth);
|
||||
Ret.CustomStencil = CustomStencil;
|
||||
Ret.Depth = SceneDepth;
|
||||
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUV(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = Texture2DSampleLevel(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct_CustomDepthTextureSampler, UV, 0).r;
|
||||
int2 IntUV = (int2)trunc(UV * View.BufferSizeAndInvSize.xy * View.BufferToSceneTextureScale.xy);
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(IntUV, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(UV);
|
||||
float4 AnisotropicData = Texture2DSampleLevel(SceneTexturesStruct.GBufferFTexture, SceneTexturesStruct_GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = Texture2DSampleLevel(SceneTexturesStruct.GBufferATexture, SceneTexturesStruct_GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferBTexture, SceneTexturesStruct_GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = Texture2DSampleLevel(SceneTexturesStruct.GBufferCTexture, SceneTexturesStruct_GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = Texture2DSampleLevel(SceneTexturesStruct.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = Texture2DSampleLevel(SceneTexturesStruct.GBufferDTexture, SceneTexturesStruct_GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = SceneTexturesStruct.CustomDepthTexture.Load(int3(PixelPos, 0)).r;
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(PixelPos, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(PixelPos);
|
||||
float4 AnisotropicData = SceneTexturesStruct.GBufferFTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = SceneTexturesStruct.GBufferATexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT2 = SceneTexturesStruct.GBufferBTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT3 = SceneTexturesStruct.GBufferCTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT4 = SceneTexturesStruct.GBufferVelocityTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT5 = SceneTexturesStruct.GBufferDTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT6 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelPos));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTextures(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SampleDeviceZFromSceneTexturesTempCopy(UV);
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.SampleLevel(GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.SampleLevel(GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.SampleLevel(GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.SampleLevel(GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.SampleLevel(GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.SampleLevel(GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTexturesLoad(uint2 PixelCoord, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SceneDepthTexture.Load(int3(PixelCoord, 0)).r;
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelCoord));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if GBUFFER_LAYOUT == 1
|
||||
|
||||
void EncodeGBufferToMRT(inout FPixelShaderOut Out, FGBufferData GBuffer, float QuantizationBias)
|
||||
{
|
||||
float4 MrtFloat1 = 0.0f;
|
||||
float4 MrtFloat2 = 0.0f;
|
||||
uint4 MrtUint2 = 0;
|
||||
float4 MrtFloat3 = 0.0f;
|
||||
float4 MrtFloat4 = 0.0f;
|
||||
float4 MrtFloat5 = 0.0f;
|
||||
float4 MrtFloat6 = 0.0f;
|
||||
|
||||
float3 WorldNormal_Compressed = EncodeNormalHelper(GBuffer.WorldNormal, 0.0f);
|
||||
|
||||
MrtFloat1.x = WorldNormal_Compressed.x;
|
||||
MrtFloat1.y = WorldNormal_Compressed.y;
|
||||
MrtFloat1.z = WorldNormal_Compressed.z;
|
||||
MrtFloat1.w = GBuffer.PerObjectGBufferData.x;
|
||||
MrtFloat2.x = GBuffer.Metallic.x;
|
||||
MrtFloat2.y = GBuffer.Specular.x;
|
||||
MrtFloat2.z = GBuffer.Roughness.x;
|
||||
MrtUint2.w |= ((((GBuffer.ShadingModelID.x) >> 0) & 0x0f) << 0);
|
||||
MrtUint2.w |= ((((GBuffer.SelectiveOutputMask.x) >> 0) & 0x0f) << 4);
|
||||
MrtFloat3.x = GBuffer.BaseColor.x;
|
||||
MrtFloat3.y = GBuffer.BaseColor.y;
|
||||
MrtFloat3.z = GBuffer.BaseColor.z;
|
||||
MrtFloat3.w = GBuffer.GenericAO.x;
|
||||
MrtFloat4.x = GBuffer.Velocity.x;
|
||||
MrtFloat4.y = GBuffer.Velocity.y;
|
||||
MrtFloat4.z = GBuffer.Velocity.z;
|
||||
MrtFloat4.w = GBuffer.Velocity.w;
|
||||
MrtFloat6.x = GBuffer.PrecomputedShadowFactors.x;
|
||||
MrtFloat6.y = GBuffer.PrecomputedShadowFactors.y;
|
||||
MrtFloat6.z = GBuffer.PrecomputedShadowFactors.z;
|
||||
MrtFloat6.w = GBuffer.PrecomputedShadowFactors.w;
|
||||
MrtFloat5.x = GBuffer.CustomData.x;
|
||||
MrtFloat5.y = GBuffer.CustomData.y;
|
||||
MrtFloat5.z = GBuffer.CustomData.z;
|
||||
MrtFloat5.w = GBuffer.CustomData.w;
|
||||
|
||||
Out.MRT[1] = MrtFloat1;
|
||||
Out.MRT[2] = float4(MrtFloat2.x, MrtFloat2.y, MrtFloat2.z, (float(MrtUint2.w) + .5f) / 255.0f);
|
||||
Out.MRT[3] = MrtFloat3;
|
||||
Out.MRT[4] = MrtFloat4;
|
||||
Out.MRT[5] = MrtFloat5;
|
||||
Out.MRT[6] = MrtFloat6;
|
||||
Out.MRT[7] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
FGBufferData DecodeGBufferDataDirect(float4 InMRT1,
|
||||
float4 InMRT2,
|
||||
float4 InMRT3,
|
||||
float4 InMRT4,
|
||||
float4 InMRT5,
|
||||
float4 InMRT6,
|
||||
|
||||
float CustomNativeDepth,
|
||||
float4 AnisotropicData,
|
||||
uint CustomStencil,
|
||||
float SceneDepth,
|
||||
bool bGetNormalizedNormal,
|
||||
bool bChecker)
|
||||
{
|
||||
FGBufferData Ret = (FGBufferData)0;
|
||||
float3 WorldNormal_Compressed = 0.0f;
|
||||
WorldNormal_Compressed.x = InMRT1.x;
|
||||
WorldNormal_Compressed.y = InMRT1.y;
|
||||
WorldNormal_Compressed.z = InMRT1.z;
|
||||
Ret.PerObjectGBufferData.x = InMRT1.w;
|
||||
Ret.Metallic.x = InMRT2.x;
|
||||
Ret.Specular.x = InMRT2.y;
|
||||
Ret.Roughness.x = InMRT2.z;
|
||||
Ret.ShadingModelID.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 0) & 0x0f) << 0);
|
||||
Ret.SelectiveOutputMask.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 4) & 0x0f) << 0);
|
||||
Ret.BaseColor.x = InMRT3.x;
|
||||
Ret.BaseColor.y = InMRT3.y;
|
||||
Ret.BaseColor.z = InMRT3.z;
|
||||
Ret.GenericAO.x = InMRT3.w;
|
||||
Ret.Velocity.x = InMRT4.x;
|
||||
Ret.Velocity.y = InMRT4.y;
|
||||
Ret.Velocity.z = InMRT4.z;
|
||||
Ret.Velocity.w = InMRT4.w;
|
||||
Ret.PrecomputedShadowFactors.x = InMRT6.x;
|
||||
Ret.PrecomputedShadowFactors.y = InMRT6.y;
|
||||
Ret.PrecomputedShadowFactors.z = InMRT6.z;
|
||||
Ret.PrecomputedShadowFactors.w = InMRT6.w;
|
||||
Ret.CustomData.x = InMRT5.x;
|
||||
Ret.CustomData.y = InMRT5.y;
|
||||
Ret.CustomData.z = InMRT5.z;
|
||||
Ret.CustomData.w = InMRT5.w;
|
||||
|
||||
Ret.WorldNormal = DecodeNormalHelper(WorldNormal_Compressed);
|
||||
Ret.WorldTangent = AnisotropicData.xyz;
|
||||
Ret.Anisotropy = AnisotropicData.w;
|
||||
|
||||
GBufferPostDecode(Ret,bChecker,bGetNormalizedNormal);
|
||||
|
||||
Ret.CustomDepth = ConvertFromDeviceZ(CustomNativeDepth);
|
||||
Ret.CustomStencil = CustomStencil;
|
||||
Ret.Depth = SceneDepth;
|
||||
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUV(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = Texture2DSampleLevel(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct_CustomDepthTextureSampler, UV, 0).r;
|
||||
int2 IntUV = (int2)trunc(UV * View.BufferSizeAndInvSize.xy * View.BufferToSceneTextureScale.xy);
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(IntUV, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(UV);
|
||||
float4 AnisotropicData = Texture2DSampleLevel(SceneTexturesStruct.GBufferFTexture, SceneTexturesStruct_GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = Texture2DSampleLevel(SceneTexturesStruct.GBufferATexture, SceneTexturesStruct_GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferBTexture, SceneTexturesStruct_GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = Texture2DSampleLevel(SceneTexturesStruct.GBufferCTexture, SceneTexturesStruct_GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = Texture2DSampleLevel(SceneTexturesStruct.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = Texture2DSampleLevel(SceneTexturesStruct.GBufferDTexture, SceneTexturesStruct_GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = SceneTexturesStruct.CustomDepthTexture.Load(int3(PixelPos, 0)).r;
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(PixelPos, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(PixelPos);
|
||||
float4 AnisotropicData = SceneTexturesStruct.GBufferFTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = SceneTexturesStruct.GBufferATexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT2 = SceneTexturesStruct.GBufferBTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT3 = SceneTexturesStruct.GBufferCTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT4 = SceneTexturesStruct.GBufferVelocityTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT5 = SceneTexturesStruct.GBufferDTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT6 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelPos));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTextures(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SampleDeviceZFromSceneTexturesTempCopy(UV);
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.SampleLevel(GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.SampleLevel(GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.SampleLevel(GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.SampleLevel(GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.SampleLevel(GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.SampleLevel(GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTexturesLoad(uint2 PixelCoord, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SceneDepthTexture.Load(int3(PixelCoord, 0)).r;
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelCoord));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,511 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
float SampleDeviceZFromSceneTexturesTempCopy(float2 UV)
|
||||
{
|
||||
return SceneDepthTexture.SampleLevel(SceneDepthTextureSampler, UV, 0).r;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GBUFFER_LAYOUT
|
||||
#define GBUFFER_LAYOUT 0
|
||||
#endif
|
||||
|
||||
#if GBUFFER_LAYOUT == 0
|
||||
|
||||
void EncodeGBufferToMRT(inout FPixelShaderOut Out, FGBufferData GBuffer, float QuantizationBias)
|
||||
{
|
||||
float4 MrtFloat1 = 0.0f;
|
||||
float4 MrtFloat2 = 0.0f;
|
||||
uint4 MrtUint2 = 0;
|
||||
float4 MrtFloat3 = 0.0f;
|
||||
float4 MrtFloat4 = 0.0f;
|
||||
float4 MrtFloat5 = 0.0f;
|
||||
float4 MrtFloat6 = 0.0f;
|
||||
|
||||
float3 WorldNormal_Compressed = EncodeNormalHelper(GBuffer.WorldNormal, 0.0f);
|
||||
|
||||
MrtFloat1.x = WorldNormal_Compressed.x;
|
||||
MrtFloat1.y = WorldNormal_Compressed.y;
|
||||
MrtFloat1.z = WorldNormal_Compressed.z;
|
||||
MrtFloat1.w = GBuffer.PerObjectGBufferData.x;
|
||||
MrtFloat2.x = GBuffer.Metallic.x;
|
||||
MrtFloat2.y = GBuffer.Specular.x;
|
||||
MrtFloat2.z = GBuffer.Roughness.x;
|
||||
MrtUint2.w |= ((((GBuffer.ShadingModelID.x) >> 0) & 0x0f) << 0);
|
||||
MrtUint2.w |= ((((GBuffer.SelectiveOutputMask.x) >> 0) & 0x0f) << 4);
|
||||
MrtFloat3.x = GBuffer.BaseColor.x;
|
||||
MrtFloat3.y = GBuffer.BaseColor.y;
|
||||
MrtFloat3.z = GBuffer.BaseColor.z;
|
||||
MrtFloat3.w = GBuffer.GenericAO.x;
|
||||
MrtFloat4.x = GBuffer.Velocity.x;
|
||||
MrtFloat4.y = GBuffer.Velocity.y;
|
||||
MrtFloat4.z = GBuffer.Velocity.z;
|
||||
MrtFloat4.w = GBuffer.Velocity.w;
|
||||
MrtFloat6.x = GBuffer.PrecomputedShadowFactors.x;
|
||||
MrtFloat6.y = GBuffer.PrecomputedShadowFactors.y;
|
||||
MrtFloat6.z = GBuffer.PrecomputedShadowFactors.z;
|
||||
MrtFloat6.w = GBuffer.PrecomputedShadowFactors.w;
|
||||
MrtFloat5.x = GBuffer.CustomData.x;
|
||||
MrtFloat5.y = GBuffer.CustomData.y;
|
||||
MrtFloat5.z = GBuffer.CustomData.z;
|
||||
MrtFloat5.w = GBuffer.CustomData.w;
|
||||
|
||||
Out.MRT[1] = MrtFloat1;
|
||||
Out.MRT[2] = float4(MrtFloat2.x, MrtFloat2.y, MrtFloat2.z, (float(MrtUint2.w) + .5f) / 255.0f);
|
||||
Out.MRT[3] = MrtFloat3;
|
||||
Out.MRT[4] = MrtFloat4;
|
||||
Out.MRT[5] = MrtFloat5;
|
||||
Out.MRT[6] = MrtFloat6;
|
||||
Out.MRT[7] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
FGBufferData DecodeGBufferDataDirect(float4 InMRT1,
|
||||
float4 InMRT2,
|
||||
float4 InMRT3,
|
||||
float4 InMRT4,
|
||||
float4 InMRT5,
|
||||
float4 InMRT6,
|
||||
|
||||
float CustomNativeDepth,
|
||||
float4 AnisotropicData,
|
||||
uint CustomStencil,
|
||||
float SceneDepth,
|
||||
bool bGetNormalizedNormal,
|
||||
bool bChecker)
|
||||
{
|
||||
FGBufferData Ret = (FGBufferData)0;
|
||||
float3 WorldNormal_Compressed = 0.0f;
|
||||
WorldNormal_Compressed.x = InMRT1.x;
|
||||
WorldNormal_Compressed.y = InMRT1.y;
|
||||
WorldNormal_Compressed.z = InMRT1.z;
|
||||
Ret.PerObjectGBufferData.x = InMRT1.w;
|
||||
Ret.Metallic.x = InMRT2.x;
|
||||
Ret.Specular.x = InMRT2.y;
|
||||
Ret.Roughness.x = InMRT2.z;
|
||||
Ret.ShadingModelID.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 0) & 0x0f) << 0);
|
||||
Ret.SelectiveOutputMask.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 4) & 0x0f) << 0);
|
||||
Ret.BaseColor.x = InMRT3.x;
|
||||
Ret.BaseColor.y = InMRT3.y;
|
||||
Ret.BaseColor.z = InMRT3.z;
|
||||
Ret.GenericAO.x = InMRT3.w;
|
||||
Ret.Velocity.x = InMRT4.x;
|
||||
Ret.Velocity.y = InMRT4.y;
|
||||
Ret.Velocity.z = InMRT4.z;
|
||||
Ret.Velocity.w = InMRT4.w;
|
||||
Ret.PrecomputedShadowFactors.x = InMRT6.x;
|
||||
Ret.PrecomputedShadowFactors.y = InMRT6.y;
|
||||
Ret.PrecomputedShadowFactors.z = InMRT6.z;
|
||||
Ret.PrecomputedShadowFactors.w = InMRT6.w;
|
||||
Ret.CustomData.x = InMRT5.x;
|
||||
Ret.CustomData.y = InMRT5.y;
|
||||
Ret.CustomData.z = InMRT5.z;
|
||||
Ret.CustomData.w = InMRT5.w;
|
||||
|
||||
Ret.WorldNormal = DecodeNormalHelper(WorldNormal_Compressed);
|
||||
Ret.WorldTangent = AnisotropicData.xyz;
|
||||
Ret.Anisotropy = AnisotropicData.w;
|
||||
|
||||
GBufferPostDecode(Ret,bChecker,bGetNormalizedNormal);
|
||||
|
||||
Ret.CustomDepth = ConvertFromDeviceZ(CustomNativeDepth);
|
||||
Ret.CustomStencil = CustomStencil;
|
||||
Ret.Depth = SceneDepth;
|
||||
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUV(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = Texture2DSampleLevel(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct_CustomDepthTextureSampler, UV, 0).r;
|
||||
int2 IntUV = (int2)trunc(UV * View.BufferSizeAndInvSize.xy * View.BufferToSceneTextureScale.xy);
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(IntUV, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(UV);
|
||||
float4 AnisotropicData = Texture2DSampleLevel(SceneTexturesStruct.GBufferFTexture, SceneTexturesStruct_GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = Texture2DSampleLevel(SceneTexturesStruct.GBufferATexture, SceneTexturesStruct_GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferBTexture, SceneTexturesStruct_GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = Texture2DSampleLevel(SceneTexturesStruct.GBufferCTexture, SceneTexturesStruct_GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = Texture2DSampleLevel(SceneTexturesStruct.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = Texture2DSampleLevel(SceneTexturesStruct.GBufferDTexture, SceneTexturesStruct_GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = SceneTexturesStruct.CustomDepthTexture.Load(int3(PixelPos, 0)).r;
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(PixelPos, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(PixelPos);
|
||||
float4 AnisotropicData = SceneTexturesStruct.GBufferFTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = SceneTexturesStruct.GBufferATexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT2 = SceneTexturesStruct.GBufferBTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT3 = SceneTexturesStruct.GBufferCTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT4 = SceneTexturesStruct.GBufferVelocityTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT5 = SceneTexturesStruct.GBufferDTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT6 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelPos));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTextures(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SampleDeviceZFromSceneTexturesTempCopy(UV);
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.SampleLevel(GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.SampleLevel(GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.SampleLevel(GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.SampleLevel(GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.SampleLevel(GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.SampleLevel(GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTexturesLoad(uint2 PixelCoord, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SceneDepthTexture.Load(int3(PixelCoord, 0)).r;
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelCoord));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if GBUFFER_LAYOUT == 1
|
||||
|
||||
void EncodeGBufferToMRT(inout FPixelShaderOut Out, FGBufferData GBuffer, float QuantizationBias)
|
||||
{
|
||||
float4 MrtFloat1 = 0.0f;
|
||||
float4 MrtFloat2 = 0.0f;
|
||||
uint4 MrtUint2 = 0;
|
||||
float4 MrtFloat3 = 0.0f;
|
||||
float4 MrtFloat4 = 0.0f;
|
||||
float4 MrtFloat5 = 0.0f;
|
||||
float4 MrtFloat6 = 0.0f;
|
||||
|
||||
float3 WorldNormal_Compressed = EncodeNormalHelper(GBuffer.WorldNormal, 0.0f);
|
||||
|
||||
MrtFloat1.x = WorldNormal_Compressed.x;
|
||||
MrtFloat1.y = WorldNormal_Compressed.y;
|
||||
MrtFloat1.z = WorldNormal_Compressed.z;
|
||||
MrtFloat1.w = GBuffer.PerObjectGBufferData.x;
|
||||
MrtFloat2.x = GBuffer.Metallic.x;
|
||||
MrtFloat2.y = GBuffer.Specular.x;
|
||||
MrtFloat2.z = GBuffer.Roughness.x;
|
||||
MrtUint2.w |= ((((GBuffer.ShadingModelID.x) >> 0) & 0x0f) << 0);
|
||||
MrtUint2.w |= ((((GBuffer.SelectiveOutputMask.x) >> 0) & 0x0f) << 4);
|
||||
MrtFloat3.x = GBuffer.BaseColor.x;
|
||||
MrtFloat3.y = GBuffer.BaseColor.y;
|
||||
MrtFloat3.z = GBuffer.BaseColor.z;
|
||||
MrtFloat3.w = GBuffer.GenericAO.x;
|
||||
MrtFloat4.x = GBuffer.Velocity.x;
|
||||
MrtFloat4.y = GBuffer.Velocity.y;
|
||||
MrtFloat4.z = GBuffer.Velocity.z;
|
||||
MrtFloat4.w = GBuffer.Velocity.w;
|
||||
MrtFloat6.x = GBuffer.PrecomputedShadowFactors.x;
|
||||
MrtFloat6.y = GBuffer.PrecomputedShadowFactors.y;
|
||||
MrtFloat6.z = GBuffer.PrecomputedShadowFactors.z;
|
||||
MrtFloat6.w = GBuffer.PrecomputedShadowFactors.w;
|
||||
MrtFloat5.x = GBuffer.CustomData.x;
|
||||
MrtFloat5.y = GBuffer.CustomData.y;
|
||||
MrtFloat5.z = GBuffer.CustomData.z;
|
||||
MrtFloat5.w = GBuffer.CustomData.w;
|
||||
|
||||
Out.MRT[1] = MrtFloat1;
|
||||
Out.MRT[2] = float4(MrtFloat2.x, MrtFloat2.y, MrtFloat2.z, (float(MrtUint2.w) + .5f) / 255.0f);
|
||||
Out.MRT[3] = MrtFloat3;
|
||||
Out.MRT[4] = MrtFloat4;
|
||||
Out.MRT[5] = MrtFloat5;
|
||||
Out.MRT[6] = MrtFloat6;
|
||||
Out.MRT[7] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
FGBufferData DecodeGBufferDataDirect(float4 InMRT1,
|
||||
float4 InMRT2,
|
||||
float4 InMRT3,
|
||||
float4 InMRT4,
|
||||
float4 InMRT5,
|
||||
float4 InMRT6,
|
||||
|
||||
float CustomNativeDepth,
|
||||
float4 AnisotropicData,
|
||||
uint CustomStencil,
|
||||
float SceneDepth,
|
||||
bool bGetNormalizedNormal,
|
||||
bool bChecker)
|
||||
{
|
||||
FGBufferData Ret = (FGBufferData)0;
|
||||
float3 WorldNormal_Compressed = 0.0f;
|
||||
WorldNormal_Compressed.x = InMRT1.x;
|
||||
WorldNormal_Compressed.y = InMRT1.y;
|
||||
WorldNormal_Compressed.z = InMRT1.z;
|
||||
Ret.PerObjectGBufferData.x = InMRT1.w;
|
||||
Ret.Metallic.x = InMRT2.x;
|
||||
Ret.Specular.x = InMRT2.y;
|
||||
Ret.Roughness.x = InMRT2.z;
|
||||
Ret.ShadingModelID.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 0) & 0x0f) << 0);
|
||||
Ret.SelectiveOutputMask.x = (((uint((float(InMRT2.w) * 255.0f) + .5f) >> 4) & 0x0f) << 0);
|
||||
Ret.BaseColor.x = InMRT3.x;
|
||||
Ret.BaseColor.y = InMRT3.y;
|
||||
Ret.BaseColor.z = InMRT3.z;
|
||||
Ret.GenericAO.x = InMRT3.w;
|
||||
Ret.Velocity.x = InMRT4.x;
|
||||
Ret.Velocity.y = InMRT4.y;
|
||||
Ret.Velocity.z = InMRT4.z;
|
||||
Ret.Velocity.w = InMRT4.w;
|
||||
Ret.PrecomputedShadowFactors.x = InMRT6.x;
|
||||
Ret.PrecomputedShadowFactors.y = InMRT6.y;
|
||||
Ret.PrecomputedShadowFactors.z = InMRT6.z;
|
||||
Ret.PrecomputedShadowFactors.w = InMRT6.w;
|
||||
Ret.CustomData.x = InMRT5.x;
|
||||
Ret.CustomData.y = InMRT5.y;
|
||||
Ret.CustomData.z = InMRT5.z;
|
||||
Ret.CustomData.w = InMRT5.w;
|
||||
|
||||
Ret.WorldNormal = DecodeNormalHelper(WorldNormal_Compressed);
|
||||
Ret.WorldTangent = AnisotropicData.xyz;
|
||||
Ret.Anisotropy = AnisotropicData.w;
|
||||
|
||||
GBufferPostDecode(Ret,bChecker,bGetNormalizedNormal);
|
||||
|
||||
Ret.CustomDepth = ConvertFromDeviceZ(CustomNativeDepth);
|
||||
Ret.CustomStencil = CustomStencil;
|
||||
Ret.Depth = SceneDepth;
|
||||
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUV(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = Texture2DSampleLevel(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct_CustomDepthTextureSampler, UV, 0).r;
|
||||
int2 IntUV = (int2)trunc(UV * View.BufferSizeAndInvSize.xy * View.BufferToSceneTextureScale.xy);
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(IntUV, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(UV);
|
||||
float4 AnisotropicData = Texture2DSampleLevel(SceneTexturesStruct.GBufferFTexture, SceneTexturesStruct_GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = Texture2DSampleLevel(SceneTexturesStruct.GBufferATexture, SceneTexturesStruct_GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferBTexture, SceneTexturesStruct_GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = Texture2DSampleLevel(SceneTexturesStruct.GBufferCTexture, SceneTexturesStruct_GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = Texture2DSampleLevel(SceneTexturesStruct.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = Texture2DSampleLevel(SceneTexturesStruct.GBufferDTexture, SceneTexturesStruct_GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
float CustomNativeDepth = SceneTexturesStruct.CustomDepthTexture.Load(int3(PixelPos, 0)).r;
|
||||
uint CustomStencil = SceneTexturesStruct.CustomStencilTexture.Load(int3(PixelPos, 0)) STENCIL_COMPONENT_SWIZZLE;
|
||||
float SceneDepth = CalcSceneDepth(PixelPos);
|
||||
float4 AnisotropicData = SceneTexturesStruct.GBufferFTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = SceneTexturesStruct.GBufferATexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT2 = SceneTexturesStruct.GBufferBTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT3 = SceneTexturesStruct.GBufferCTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT4 = SceneTexturesStruct.GBufferVelocityTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT5 = SceneTexturesStruct.GBufferDTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
float4 InMRT6 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelPos));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTextures(float2 UV, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SampleDeviceZFromSceneTexturesTempCopy(UV);
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.SampleLevel(GBufferFTextureSampler, UV, 0).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.SampleLevel(GBufferATextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.SampleLevel(GBufferBTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.SampleLevel(GBufferCTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.SampleLevel(GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.SampleLevel(GBufferDTextureSampler, UV, 0).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromSceneColorUV(UV));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
// @param PixelPos relative to left top of the rendertarget (not viewport)
|
||||
FGBufferData DecodeGBufferDataSceneTexturesLoad(uint2 PixelCoord, bool bGetNormalizedNormal = true)
|
||||
{
|
||||
uint CustomStencil = 0;
|
||||
float CustomNativeDepth = 0;
|
||||
float DeviceZ = SceneDepthTexture.Load(int3(PixelCoord, 0)).r;
|
||||
float SceneDepth = ConvertFromDeviceZ(DeviceZ);
|
||||
float4 AnisotropicData = GBufferFTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
float4 InMRT1 = GBufferATexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT2 = GBufferBTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT3 = GBufferCTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT4 = GBufferVelocityTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT5 = GBufferDTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
float4 InMRT6 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||
|
||||
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||
InMRT2,
|
||||
InMRT3,
|
||||
InMRT4,
|
||||
InMRT5,
|
||||
InMRT6,
|
||||
|
||||
CustomNativeDepth,
|
||||
AnisotropicData,
|
||||
CustomStencil,
|
||||
SceneDepth,
|
||||
bGetNormalizedNormal,
|
||||
CheckerFromPixelPos(PixelCoord));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
BIN
ASN3_SimpleStateMach/Saved/AutoScreenshot.png
(Stored with Git LFS)
Normal file
BIN
ASN3_SimpleStateMach/Saved/AutoScreenshot.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
ASN3_SimpleStateMach/Saved/Autosaves/PackageRestoreData.json
Normal file
BIN
ASN3_SimpleStateMach/Saved/Autosaves/PackageRestoreData.json
Normal file
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
[CrashReportClient]
|
||||
bHideLogFilesOption=false
|
||||
bIsAllowedToCloseWithoutSending=true
|
||||
CrashConfigPurgeDays=2
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,3 @@
|
||||
[/Script/UnrealEd.UnrealEdOptions]
|
||||
UsingXGE=False
|
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
|
70
ASN3_SimpleStateMach/Saved/Config/WindowsEditor/Engine.ini
Normal file
70
ASN3_SimpleStateMach/Saved/Config/WindowsEditor/Engine.ini
Normal file
@ -0,0 +1,70 @@
|
||||
[Core.System]
|
||||
Paths=../../../Engine/Content
|
||||
Paths=%GAMEDIR%Content
|
||||
Paths=../../../Engine/Plugins/Bridge/Content
|
||||
Paths=../../../Engine/Plugins/Animation/ControlRig/Content
|
||||
Paths=../../../Engine/Plugins/Animation/IKRig/Content
|
||||
Paths=../../../Engine/Plugins/Animation/ControlRigSpline/Content
|
||||
Paths=../../../Engine/Plugins/Editor/BlueprintHeaderView/Content
|
||||
Paths=../../../Engine/Plugins/Editor/GeometryMode/Content
|
||||
Paths=../../../Engine/Plugins/Editor/GLTFImporter/Content
|
||||
Paths=../../../Engine/Plugins/Editor/ModelingToolsEditorMode/Content
|
||||
Paths=../../../Engine/Plugins/Editor/SpeedTreeImporter/Content
|
||||
Paths=../../../Engine/Plugins/Enterprise/DatasmithContent/Content
|
||||
Paths=../../../Engine/Plugins/FX/Niagara/Content
|
||||
Paths=../../../Engine/Plugins/Enterprise/GLTFExporter/Content
|
||||
Paths=../../../Engine/Plugins/Interchange/Runtime/Content
|
||||
Paths=../../../Engine/Plugins/MovieScene/SequencerScripting/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/AudioSynesthesia/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/AudioWidgets/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/GeometryProcessing/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/MeshModelingToolset/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/Metasound/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/ResonanceAudio/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/Synthesis/Content
|
||||
Paths=../../../Engine/Plugins/Runtime/WaveTable/Content
|
||||
Paths=../../../Engine/Plugins/Media/MediaCompositing/Content
|
||||
Paths=../../../Engine/Plugins/Media/MediaPlate/Content
|
||||
Paths=../../../Engine/Plugins/Developer/AnimationSharing/Content
|
||||
Paths=../../../Engine/Plugins/2D/Paper2D/Content
|
||||
Paths=../../../Engine/Plugins/VirtualProduction/Takes/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/ChaosCaching/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/ChaosClothEditor/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/ChaosNiagara/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/ChaosSolverPlugin/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/Dataflow/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/FullBodyIK/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/GeometryCollectionPlugin/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/GeometryFlow/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/MeshLODToolset/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/MeshModelingToolsetExp/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/PythonScriptPlugin/Content
|
||||
Paths=../../../Engine/Plugins/Experimental/UVEditor/Content
|
||||
Paths=../../../Engine/Plugins/Editor/ObjectMixer/LightMixer/Content
|
||||
Paths=../../../Engine/Plugins/Editor/ObjectMixer/ObjectMixer/Content
|
||||
|
||||
[/Script/UdpMessaging.UdpMessagingSettings]
|
||||
EnabledByDefault=False
|
||||
EnableTransport=True
|
||||
bAutoRepair=True
|
||||
MaxSendRate=1.000000
|
||||
AutoRepairAttemptLimit=10
|
||||
WorkQueueSize=1024
|
||||
bStopServiceWhenAppDeactivates=True
|
||||
UnicastEndpoint=0.0.0.0:0
|
||||
MulticastEndpoint=230.0.0.1:6666
|
||||
MessageFormat=CborPlatformEndianness
|
||||
MulticastTimeToLive=1
|
||||
EnableTunnel=False
|
||||
TunnelUnicastEndpoint=
|
||||
TunnelMulticastEndpoint=
|
||||
|
||||
[/Script/AndroidPlatformEditor.AndroidSDKSettings]
|
||||
SDKPath=(Path="")
|
||||
NDKPath=(Path="")
|
||||
JavaPath=(Path="")
|
||||
|
||||
[/Script/UnrealEd.UnrealEdEngine]
|
||||
TemplateMapInfos=(ThumbnailTexture=None,Thumbnail="/Engine/Maps/Templates/Thumbnails/OpenWorld.OpenWorld",Map="/Engine/Maps/Templates/OpenWorld",DisplayName="Open World",Category="OpenWorld")
|
||||
TemplateMapInfos=(ThumbnailTexture=None,Thumbnail="/Engine/Maps/Templates/Thumbnails/Basic.Basic",Map="/Engine/Maps/Templates/Template_Default",DisplayName="Basic",Category="")
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
1
ASN3_SimpleStateMach/Saved/Config/WindowsEditor/Game.ini
Normal file
1
ASN3_SimpleStateMach/Saved/Config/WindowsEditor/Game.ini
Normal file
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,29 @@
|
||||
[/Script/Engine.GameUserSettings]
|
||||
bUseVSync=False
|
||||
bUseDynamicResolution=False
|
||||
ResolutionSizeX=2560
|
||||
ResolutionSizeY=1440
|
||||
LastUserConfirmedResolutionSizeX=2560
|
||||
LastUserConfirmedResolutionSizeY=1440
|
||||
WindowPosX=-1
|
||||
WindowPosY=-1
|
||||
FullscreenMode=1
|
||||
LastConfirmedFullscreenMode=1
|
||||
PreferredFullscreenMode=1
|
||||
Version=5
|
||||
AudioQualityLevel=0
|
||||
LastConfirmedAudioQualityLevel=0
|
||||
FrameRateLimit=0.000000
|
||||
DesiredScreenWidth=1280
|
||||
bUseDesiredScreenHeight=False
|
||||
DesiredScreenHeight=720
|
||||
LastUserConfirmedDesiredScreenWidth=1280
|
||||
LastUserConfirmedDesiredScreenHeight=720
|
||||
LastRecommendedScreenWidth=-1.000000
|
||||
LastRecommendedScreenHeight=-1.000000
|
||||
LastCPUBenchmarkResult=-1.000000
|
||||
LastGPUBenchmarkResult=-1.000000
|
||||
LastGPUBenchmarkMultiplier=1.000000
|
||||
bUseHDRDisplayOutput=False
|
||||
HDRDisplayOutputNits=1000
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
BIN
ASN3_SimpleStateMach/Saved/Config/WorldState/1908587271.json
Normal file
BIN
ASN3_SimpleStateMach/Saved/Config/WorldState/1908587271.json
Normal file
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 1,
|
||||
"changelists": [
|
||||
{
|
||||
"guid": "00000000000000000000000000000000",
|
||||
"description": "Default Uncontrolled Changelist",
|
||||
"files": [
|
||||
"F:/Projects/College/GDN3113-SCD3/ASN3_SimpleStateMach/Content/RCQuick/Maps/SSM.umap"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user