Compare commits
No commits in common. "ae157428fc7df6dc3525bed2e2cc8505b1b7d9fd" and "e7376ad970515ab77abb3853c24f5a6425271af8" have entirely different histories.
ae157428fc
...
e7376ad970
1
.gitignore
vendored
1
.gitignore
vendored
@ -74,4 +74,3 @@ Plugins/**/Intermediate/*
|
|||||||
# Cache files for the editor to use
|
# Cache files for the editor to use
|
||||||
DerivedDataCache/*
|
DerivedDataCache/*
|
||||||
|
|
||||||
Intermediate
|
|
||||||
|
|||||||
BIN
Hule/Intermediate/CachedAssetRegistry_0.bin
Normal file
BIN
Hule/Intermediate/CachedAssetRegistry_0.bin
Normal file
Binary file not shown.
@ -0,0 +1,4 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
|
[Internationalization]
|
||||||
|
ShouldUseLocalizedNumericInput=True
|
||||||
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
253
Hule/Intermediate/Config/CoalescedSourceConfigs/Lightmass.ini
Normal file
253
Hule/Intermediate/Config/CoalescedSourceConfigs/Lightmass.ini
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
|
[DevOptions.StaticLighting]
|
||||||
|
bAllowMultiThreadedStaticLighting=True
|
||||||
|
ViewSingleBounceNumber=-1
|
||||||
|
bUseBilinearFilterLightmaps=True
|
||||||
|
bCompressLightmaps=True
|
||||||
|
bUseConservativeTexelRasterization=True
|
||||||
|
bAccountForTexelSize=True
|
||||||
|
bUseMaxWeight=True
|
||||||
|
MaxTriangleLightingSamples=8
|
||||||
|
MaxTriangleIrradiancePhotonCacheSamples=4
|
||||||
|
bAllow64bitProcess=True
|
||||||
|
DefaultStaticMeshLightingRes=32
|
||||||
|
bAllowCropping=False
|
||||||
|
bGarbageCollectAfterExport=True
|
||||||
|
bRebuildDirtyGeometryForLighting=True
|
||||||
|
bUseEmbree=true
|
||||||
|
bVerifyEmbree=false
|
||||||
|
bUseEmbreePacketTracing=false
|
||||||
|
bUseFastVoxelization=false
|
||||||
|
bUseEmbreeInstancing=false
|
||||||
|
bUseFilteredCubemapForSkylight=true
|
||||||
|
MappingSurfaceCacheDownsampleFactor=2
|
||||||
|
|
||||||
|
[DevOptions.StaticLightingSceneConstants]
|
||||||
|
StaticLightingLevelScale=1
|
||||||
|
VisibilityRayOffsetDistance=.1
|
||||||
|
VisibilityNormalOffsetDistance=3
|
||||||
|
VisibilityNormalOffsetSampleRadiusScale=.5
|
||||||
|
VisibilityTangentOffsetSampleRadiusScale=.8
|
||||||
|
SmallestTexelRadius=.1
|
||||||
|
LightGridSize=100
|
||||||
|
AutomaticImportanceVolumeExpandBy=500
|
||||||
|
MinimumImportanceVolumeExtentWithoutWarning=10000.0
|
||||||
|
|
||||||
|
[DevOptions.StaticLightingMaterial]
|
||||||
|
bUseDebugMaterial=False
|
||||||
|
ShowMaterialAttribute=None
|
||||||
|
EmissiveSampleSize=128
|
||||||
|
DiffuseSampleSize=128
|
||||||
|
SpecularSampleSize=128
|
||||||
|
TransmissionSampleSize=256
|
||||||
|
NormalSampleSize=256
|
||||||
|
TerrainSampleScalar=4
|
||||||
|
DebugDiffuse=(R=0.500000,G=0.500000,B=0.500000)
|
||||||
|
EnvironmentColor=(R=0.00000,G=0.00000,B=0.00000)
|
||||||
|
|
||||||
|
[DevOptions.MeshAreaLights]
|
||||||
|
bVisualizeMeshAreaLightPrimitives=False
|
||||||
|
EmissiveIntensityThreshold=.01
|
||||||
|
MeshAreaLightGridSize=100
|
||||||
|
MeshAreaLightSimplifyNormalAngleThreshold=25
|
||||||
|
MeshAreaLightSimplifyCornerDistanceThreshold=.5
|
||||||
|
MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold=.1
|
||||||
|
MeshAreaLightGeneratedDynamicLightSurfaceOffset=30
|
||||||
|
|
||||||
|
[DevOptions.PrecomputedDynamicObjectLighting]
|
||||||
|
bVisualizeVolumeLightSamples=False
|
||||||
|
bVisualizeVolumeLightInterpolation=False
|
||||||
|
NumHemisphereSamplesScale=2
|
||||||
|
SurfaceLightSampleSpacing=300
|
||||||
|
FirstSurfaceSampleLayerHeight=50
|
||||||
|
SurfaceSampleLayerHeightSpacing=250
|
||||||
|
NumSurfaceSampleLayers=2
|
||||||
|
DetailVolumeSampleSpacing=300
|
||||||
|
VolumeLightSampleSpacing=3000
|
||||||
|
MaxVolumeSamples=250000
|
||||||
|
bUseMaxSurfaceSampleNum=True
|
||||||
|
MaxSurfaceLightSamples=500000
|
||||||
|
|
||||||
|
[DevOptions.VolumetricLightmaps]
|
||||||
|
BrickSize=4
|
||||||
|
MaxRefinementLevels=3
|
||||||
|
VoxelizationCellExpansionForSurfaceGeometry=.1
|
||||||
|
VoxelizationCellExpansionForVolumeGeometry=.25
|
||||||
|
VoxelizationCellExpansionForLights=.1
|
||||||
|
TargetNumVolumetricLightmapTasks=800
|
||||||
|
MinBrickError=.01
|
||||||
|
SurfaceLightmapMinTexelsPerVoxelAxis=1.0
|
||||||
|
bCullBricksBelowLandscape=true
|
||||||
|
LightBrightnessSubdivideThreshold=.3
|
||||||
|
|
||||||
|
[DevOptions.PrecomputedVisibility]
|
||||||
|
bVisualizePrecomputedVisibility=False
|
||||||
|
bCompressVisibilityData=True
|
||||||
|
bPlaceCellsOnOpaqueOnly=True
|
||||||
|
NumCellDistributionBuckets=800
|
||||||
|
CellRenderingBucketSize=5
|
||||||
|
NumCellRenderingBuckets=5
|
||||||
|
PlayAreaHeight=220
|
||||||
|
MeshBoundsScale=1.2
|
||||||
|
VisibilitySpreadingIterations=1
|
||||||
|
MinMeshSamples=14
|
||||||
|
MaxMeshSamples=40
|
||||||
|
NumCellSamples=24
|
||||||
|
NumImportanceSamples=40
|
||||||
|
|
||||||
|
[DevOptions.PrecomputedVisibilityModeratelyAggressive]
|
||||||
|
MeshBoundsScale=1
|
||||||
|
VisibilitySpreadingIterations=1
|
||||||
|
|
||||||
|
[DevOptions.PrecomputedVisibilityMostAggressive]
|
||||||
|
MeshBoundsScale=1
|
||||||
|
VisibilitySpreadingIterations=0
|
||||||
|
|
||||||
|
[DevOptions.VolumeDistanceField]
|
||||||
|
VoxelSize=75
|
||||||
|
VolumeMaxDistance=900
|
||||||
|
NumVoxelDistanceSamples=800
|
||||||
|
MaxVoxels=3992160
|
||||||
|
|
||||||
|
[DevOptions.StaticShadows]
|
||||||
|
bUseZeroAreaLightmapSpaceFilteredLights=False
|
||||||
|
NumShadowRays=8
|
||||||
|
NumPenumbraShadowRays=8
|
||||||
|
NumBounceShadowRays=1
|
||||||
|
bFilterShadowFactor=True
|
||||||
|
ShadowFactorGradientTolerance=0.5
|
||||||
|
bAllowSignedDistanceFieldShadows=True
|
||||||
|
MaxTransitionDistanceWorldSpace=50
|
||||||
|
ApproximateHighResTexelsPerMaxTransitionDistance=50
|
||||||
|
MinDistanceFieldUpsampleFactor=3
|
||||||
|
MinUnoccludedFraction=.0005
|
||||||
|
StaticShadowDepthMapTransitionSampleDistanceX=100
|
||||||
|
StaticShadowDepthMapTransitionSampleDistanceY=100
|
||||||
|
StaticShadowDepthMapSuperSampleFactor=2
|
||||||
|
StaticShadowDepthMapMaxSamples=4194304
|
||||||
|
|
||||||
|
[DevOptions.ImportanceTracing]
|
||||||
|
bUseStratifiedSampling=True
|
||||||
|
NumHemisphereSamples=16
|
||||||
|
MaxHemisphereRayAngle=89
|
||||||
|
NumAdaptiveRefinementLevels=2
|
||||||
|
AdaptiveBrightnessThreshold=1
|
||||||
|
AdaptiveFirstBouncePhotonConeAngle=4
|
||||||
|
AdaptiveSkyVarianceThreshold=.5
|
||||||
|
bUseRadiositySolverForSkylightMultibounce=True
|
||||||
|
bCacheFinalGatherHitPointsForRadiosity=False
|
||||||
|
bUseRadiositySolverForLightMultibounce=False
|
||||||
|
|
||||||
|
[DevOptions.PhotonMapping]
|
||||||
|
bUsePhotonMapping=True
|
||||||
|
bUseFinalGathering=True
|
||||||
|
bUsePhotonDirectLightingInFinalGather=False
|
||||||
|
bVisualizeCachedApproximateDirectLighting=False
|
||||||
|
bUseIrradiancePhotons=True
|
||||||
|
bCacheIrradiancePhotonsOnSurfaces=True
|
||||||
|
bVisualizePhotonPaths=False
|
||||||
|
bVisualizePhotonGathers=True
|
||||||
|
bVisualizePhotonImportanceSamples=False
|
||||||
|
bVisualizeIrradiancePhotonCalculation=False
|
||||||
|
bEmitPhotonsOutsideImportanceVolume=False
|
||||||
|
ConeFilterConstant=1
|
||||||
|
NumIrradianceCalculationPhotons=400
|
||||||
|
FinalGatherImportanceSampleFraction=.6
|
||||||
|
FinalGatherImportanceSampleConeAngle=10
|
||||||
|
IndirectPhotonEmitDiskRadius=200
|
||||||
|
IndirectPhotonEmitConeAngle=30
|
||||||
|
MaxImportancePhotonSearchDistance=2000
|
||||||
|
MinImportancePhotonSearchDistance=20
|
||||||
|
NumImportanceSearchPhotons=10
|
||||||
|
OutsideImportanceVolumeDensityScale=.0005
|
||||||
|
DirectPhotonDensity=350
|
||||||
|
DirectIrradiancePhotonDensity=350
|
||||||
|
DirectPhotonSearchDistance=200
|
||||||
|
IndirectPhotonPathDensity=5
|
||||||
|
IndirectPhotonDensity=600
|
||||||
|
IndirectIrradiancePhotonDensity=300
|
||||||
|
IndirectPhotonSearchDistance=200
|
||||||
|
PhotonSearchAngleThreshold=.5
|
||||||
|
IrradiancePhotonSearchConeAngle=10
|
||||||
|
bUsePhotonSegmentsForVolumeLighting=true
|
||||||
|
PhotonSegmentMaxLength=1000
|
||||||
|
GeneratePhotonSegmentChance=.01
|
||||||
|
|
||||||
|
[DevOptions.IrradianceCache]
|
||||||
|
bAllowIrradianceCaching=True
|
||||||
|
bUseIrradianceGradients=False
|
||||||
|
bShowGradientsOnly=False
|
||||||
|
bVisualizeIrradianceSamples=True
|
||||||
|
RecordRadiusScale=.8
|
||||||
|
InterpolationMaxAngle=20
|
||||||
|
PointBehindRecordMaxAngle=10
|
||||||
|
DistanceSmoothFactor=4
|
||||||
|
AngleSmoothFactor=4
|
||||||
|
SkyOcclusionSmoothnessReduction=.5
|
||||||
|
MaxRecordRadius=1024
|
||||||
|
CacheTaskSize=64
|
||||||
|
InterpolateTaskSize=64
|
||||||
|
|
||||||
|
[DevOptions.StaticLightingMediumQuality]
|
||||||
|
NumShadowRaysScale=2
|
||||||
|
NumPenumbraShadowRaysScale=4
|
||||||
|
ApproximateHighResTexelsPerMaxTransitionDistanceScale=3
|
||||||
|
MinDistanceFieldUpsampleFactor=3
|
||||||
|
NumHemisphereSamplesScale=2
|
||||||
|
NumImportanceSearchPhotonsScale=1
|
||||||
|
NumDirectPhotonsScale=2
|
||||||
|
DirectPhotonSearchDistanceScale=.5
|
||||||
|
NumIndirectPhotonPathsScale=1
|
||||||
|
NumIndirectPhotonsScale=2
|
||||||
|
NumIndirectIrradiancePhotonsScale=2
|
||||||
|
RecordRadiusScaleScale=.75
|
||||||
|
InterpolationMaxAngleScale=1
|
||||||
|
IrradianceCacheSmoothFactor=.75
|
||||||
|
NumAdaptiveRefinementLevels=3
|
||||||
|
AdaptiveBrightnessThresholdScale=.5
|
||||||
|
AdaptiveFirstBouncePhotonConeAngleScale=1
|
||||||
|
AdaptiveSkyVarianceThresholdScale=1
|
||||||
|
|
||||||
|
[DevOptions.StaticLightingHighQuality]
|
||||||
|
NumShadowRaysScale=4
|
||||||
|
NumPenumbraShadowRaysScale=8
|
||||||
|
ApproximateHighResTexelsPerMaxTransitionDistanceScale=6
|
||||||
|
MinDistanceFieldUpsampleFactor=5
|
||||||
|
NumHemisphereSamplesScale=4
|
||||||
|
NumImportanceSearchPhotonsScale=2
|
||||||
|
NumDirectPhotonsScale=2
|
||||||
|
DirectPhotonSearchDistanceScale=.5
|
||||||
|
NumIndirectPhotonPathsScale=2
|
||||||
|
NumIndirectPhotonsScale=4
|
||||||
|
NumIndirectIrradiancePhotonsScale=2
|
||||||
|
RecordRadiusScaleScale=.75
|
||||||
|
InterpolationMaxAngleScale=.75
|
||||||
|
IrradianceCacheSmoothFactor=.75
|
||||||
|
NumAdaptiveRefinementLevels=3
|
||||||
|
AdaptiveBrightnessThresholdScale=.25
|
||||||
|
AdaptiveFirstBouncePhotonConeAngleScale=2
|
||||||
|
AdaptiveSkyVarianceThresholdScale=.5
|
||||||
|
|
||||||
|
[DevOptions.StaticLightingProductionQuality]
|
||||||
|
NumShadowRaysScale=8
|
||||||
|
NumPenumbraShadowRaysScale=32
|
||||||
|
ApproximateHighResTexelsPerMaxTransitionDistanceScale=6
|
||||||
|
MinDistanceFieldUpsampleFactor=5
|
||||||
|
NumHemisphereSamplesScale=8
|
||||||
|
NumImportanceSearchPhotonsScale=3
|
||||||
|
NumDirectPhotonsScale=4
|
||||||
|
DirectPhotonSearchDistanceScale=.5
|
||||||
|
NumIndirectPhotonPathsScale=2
|
||||||
|
NumIndirectPhotonsScale=8
|
||||||
|
NumIndirectIrradiancePhotonsScale=2
|
||||||
|
RecordRadiusScaleScale=.5625
|
||||||
|
InterpolationMaxAngleScale=.75
|
||||||
|
IrradianceCacheSmoothFactor=.75
|
||||||
|
NumAdaptiveRefinementLevels=3
|
||||||
|
AdaptiveBrightnessThresholdScale=.25
|
||||||
|
AdaptiveFirstBouncePhotonConeAngleScale=2.5
|
||||||
|
AdaptiveSkyVarianceThresholdScale=.5
|
||||||
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
[SectionsToSave]
|
||||||
|
bCanSaveAllSections=false
|
||||||
|
Section=CurrentIniVersion
|
||||||
|
|
||||||
0
Hule/Intermediate/PipInstall/extra_urls.txt
Normal file
0
Hule/Intermediate/PipInstall/extra_urls.txt
Normal file
0
Hule/Intermediate/PipInstall/merged_requirements.in
Normal file
0
Hule/Intermediate/PipInstall/merged_requirements.in
Normal file
0
Hule/Intermediate/PipInstall/pyreqs_plugins.list
Normal file
0
Hule/Intermediate/PipInstall/pyreqs_plugins.list
Normal file
BIN
Hule/Intermediate/ReimportCache/3688439234.bin
Normal file
BIN
Hule/Intermediate/ReimportCache/3688439234.bin
Normal file
Binary file not shown.
@ -0,0 +1,341 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
MrtFloat1.x = GBuffer.PrecomputedShadowFactors.x;
|
||||||
|
MrtFloat1.y = GBuffer.PrecomputedShadowFactors.y;
|
||||||
|
MrtFloat1.z = GBuffer.PrecomputedShadowFactors.z;
|
||||||
|
MrtFloat1.w = GBuffer.PrecomputedShadowFactors.w;
|
||||||
|
|
||||||
|
Out.MRT[1] = MrtFloat1;
|
||||||
|
Out.MRT[2] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[3] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[4] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[5] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
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,
|
||||||
|
|
||||||
|
float CustomNativeDepth,
|
||||||
|
float4 AnisotropicData,
|
||||||
|
uint CustomStencil,
|
||||||
|
float SceneDepth,
|
||||||
|
bool bGetNormalizedNormal,
|
||||||
|
bool bChecker)
|
||||||
|
{
|
||||||
|
FGBufferData Ret = (FGBufferData)0;
|
||||||
|
Ret.WorldNormal = float3(0,0,1);
|
||||||
|
Ret.Depth = 0.f;
|
||||||
|
Ret.ShadingModelID = 1;
|
||||||
|
Ret.PrecomputedShadowFactors.x = InMRT1.x;
|
||||||
|
Ret.PrecomputedShadowFactors.y = InMRT1.y;
|
||||||
|
Ret.PrecomputedShadowFactors.z = InMRT1.z;
|
||||||
|
Ret.PrecomputedShadowFactors.w = InMRT1.w;
|
||||||
|
|
||||||
|
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.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
MrtFloat1.x = GBuffer.Velocity.x;
|
||||||
|
MrtFloat1.y = GBuffer.Velocity.y;
|
||||||
|
MrtFloat1.z = GBuffer.Velocity.z;
|
||||||
|
MrtFloat1.w = GBuffer.Velocity.w;
|
||||||
|
MrtFloat2.x = GBuffer.PrecomputedShadowFactors.x;
|
||||||
|
MrtFloat2.y = GBuffer.PrecomputedShadowFactors.y;
|
||||||
|
MrtFloat2.z = GBuffer.PrecomputedShadowFactors.z;
|
||||||
|
MrtFloat2.w = GBuffer.PrecomputedShadowFactors.w;
|
||||||
|
|
||||||
|
Out.MRT[1] = MrtFloat1;
|
||||||
|
Out.MRT[2] = MrtFloat2;
|
||||||
|
Out.MRT[3] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[4] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[5] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
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,
|
||||||
|
|
||||||
|
float CustomNativeDepth,
|
||||||
|
float4 AnisotropicData,
|
||||||
|
uint CustomStencil,
|
||||||
|
float SceneDepth,
|
||||||
|
bool bGetNormalizedNormal,
|
||||||
|
bool bChecker)
|
||||||
|
{
|
||||||
|
FGBufferData Ret = (FGBufferData)0;
|
||||||
|
Ret.WorldNormal = float3(0,0,1);
|
||||||
|
Ret.Depth = 0.f;
|
||||||
|
Ret.ShadingModelID = 1;
|
||||||
|
Ret.Velocity.x = InMRT1.x;
|
||||||
|
Ret.Velocity.y = InMRT1.y;
|
||||||
|
Ret.Velocity.z = InMRT1.z;
|
||||||
|
Ret.Velocity.w = InMRT1.w;
|
||||||
|
Ret.PrecomputedShadowFactors.x = InMRT2.x;
|
||||||
|
Ret.PrecomputedShadowFactors.y = InMRT2.y;
|
||||||
|
Ret.PrecomputedShadowFactors.z = InMRT2.z;
|
||||||
|
Ret.PrecomputedShadowFactors.w = InMRT2.w;
|
||||||
|
|
||||||
|
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.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||||
|
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
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.GBufferVelocityTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||||
|
float4 InMRT2 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
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 = GBufferVelocityTexture.SampleLevel(GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||||
|
float4 InMRT2 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
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 = GBufferVelocityTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||||
|
float4 InMRT2 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
CustomNativeDepth,
|
||||||
|
AnisotropicData,
|
||||||
|
CustomStencil,
|
||||||
|
SceneDepth,
|
||||||
|
bGetNormalizedNormal,
|
||||||
|
CheckerFromPixelPos(PixelCoord));
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@ -0,0 +1,341 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
MrtFloat1.x = GBuffer.PrecomputedShadowFactors.x;
|
||||||
|
MrtFloat1.y = GBuffer.PrecomputedShadowFactors.y;
|
||||||
|
MrtFloat1.z = GBuffer.PrecomputedShadowFactors.z;
|
||||||
|
MrtFloat1.w = GBuffer.PrecomputedShadowFactors.w;
|
||||||
|
|
||||||
|
Out.MRT[1] = MrtFloat1;
|
||||||
|
Out.MRT[2] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[3] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[4] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[5] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
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,
|
||||||
|
|
||||||
|
float CustomNativeDepth,
|
||||||
|
float4 AnisotropicData,
|
||||||
|
uint CustomStencil,
|
||||||
|
float SceneDepth,
|
||||||
|
bool bGetNormalizedNormal,
|
||||||
|
bool bChecker)
|
||||||
|
{
|
||||||
|
FGBufferData Ret = (FGBufferData)0;
|
||||||
|
Ret.WorldNormal = float3(0,0,1);
|
||||||
|
Ret.Depth = 0.f;
|
||||||
|
Ret.ShadingModelID = 1;
|
||||||
|
Ret.PrecomputedShadowFactors.x = InMRT1.x;
|
||||||
|
Ret.PrecomputedShadowFactors.y = InMRT1.y;
|
||||||
|
Ret.PrecomputedShadowFactors.z = InMRT1.z;
|
||||||
|
Ret.PrecomputedShadowFactors.w = InMRT1.w;
|
||||||
|
|
||||||
|
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.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
MrtFloat1.x = GBuffer.Velocity.x;
|
||||||
|
MrtFloat1.y = GBuffer.Velocity.y;
|
||||||
|
MrtFloat1.z = GBuffer.Velocity.z;
|
||||||
|
MrtFloat1.w = GBuffer.Velocity.w;
|
||||||
|
MrtFloat2.x = GBuffer.PrecomputedShadowFactors.x;
|
||||||
|
MrtFloat2.y = GBuffer.PrecomputedShadowFactors.y;
|
||||||
|
MrtFloat2.z = GBuffer.PrecomputedShadowFactors.z;
|
||||||
|
MrtFloat2.w = GBuffer.PrecomputedShadowFactors.w;
|
||||||
|
|
||||||
|
Out.MRT[1] = MrtFloat1;
|
||||||
|
Out.MRT[2] = MrtFloat2;
|
||||||
|
Out.MRT[3] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[4] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
Out.MRT[5] = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
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,
|
||||||
|
|
||||||
|
float CustomNativeDepth,
|
||||||
|
float4 AnisotropicData,
|
||||||
|
uint CustomStencil,
|
||||||
|
float SceneDepth,
|
||||||
|
bool bGetNormalizedNormal,
|
||||||
|
bool bChecker)
|
||||||
|
{
|
||||||
|
FGBufferData Ret = (FGBufferData)0;
|
||||||
|
Ret.WorldNormal = float3(0,0,1);
|
||||||
|
Ret.Depth = 0.f;
|
||||||
|
Ret.ShadingModelID = 1;
|
||||||
|
Ret.Velocity.x = InMRT1.x;
|
||||||
|
Ret.Velocity.y = InMRT1.y;
|
||||||
|
Ret.Velocity.z = InMRT1.z;
|
||||||
|
Ret.Velocity.w = InMRT1.w;
|
||||||
|
Ret.PrecomputedShadowFactors.x = InMRT2.x;
|
||||||
|
Ret.PrecomputedShadowFactors.y = InMRT2.y;
|
||||||
|
Ret.PrecomputedShadowFactors.z = InMRT2.z;
|
||||||
|
Ret.PrecomputedShadowFactors.w = InMRT2.w;
|
||||||
|
|
||||||
|
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.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||||
|
float4 InMRT2 = Texture2DSampleLevel(SceneTexturesStruct.GBufferETexture, SceneTexturesStruct_GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
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.GBufferVelocityTexture.Load(int3(PixelPos, 0)).xyzw;
|
||||||
|
float4 InMRT2 = SceneTexturesStruct.GBufferETexture.Load(int3(PixelPos, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
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 = GBufferVelocityTexture.SampleLevel(GBufferVelocityTextureSampler, UV, 0).xyzw;
|
||||||
|
float4 InMRT2 = GBufferETexture.SampleLevel(GBufferETextureSampler, UV, 0).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
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 = GBufferVelocityTexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||||
|
float4 InMRT2 = GBufferETexture.Load(int3(PixelCoord, 0)).xyzw;
|
||||||
|
|
||||||
|
FGBufferData Ret = DecodeGBufferDataDirect(InMRT1,
|
||||||
|
InMRT2,
|
||||||
|
|
||||||
|
CustomNativeDepth,
|
||||||
|
AnisotropicData,
|
||||||
|
CustomStencil,
|
||||||
|
SceneDepth,
|
||||||
|
bGetNormalizedNormal,
|
||||||
|
CheckerFromPixelPos(PixelCoord));
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user