You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* reduced order of SH (faster but a bit more blurry) * DirectionalOcclusion (disabled by default, can be enabled in PostProcessSettings, affects SkyLight and ReflectionEnvironments but not AmbientCube) * Material BlockGI feature * Spotlight support * Uses AsyncCompute on XboxOne as optimization (order is not optimized yet) [CL 2553823 by Martin Mittring in Main branch]
59 lines
1.9 KiB
Plaintext
59 lines
1.9 KiB
Plaintext
//-----------------------------------------------------------------------------
|
|
// File: LPVInject_GenerateVplLists.usf
|
|
//
|
|
// Summary: Compute shader to generate linked lists of
|
|
// VPLs from an RSM for LPV injection.
|
|
//
|
|
// Runs once per light per LPV
|
|
//
|
|
// Created: 2013-03-01
|
|
//
|
|
// Author: mailto:benwood@microsoft.com
|
|
//
|
|
// Copyright (C) Microsoft. All rights reserved.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*------------------------------------------------------------------------------
|
|
Compile time parameters:
|
|
------------------------------------------------------------------------------*/
|
|
|
|
#include "Common.usf"
|
|
#include "LPVWriteVplCommon.usf"
|
|
|
|
#define DEBUG_SHOW_CAMERAPOS 0
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
Texture2D gRsmFluxTex;
|
|
Texture2D gRsmNormalTex;
|
|
Texture2D gRsmDepthTex;
|
|
|
|
SamplerState LinearSampler;
|
|
SamplerState PointSampler;
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
[numthreads(8,8,1)]
|
|
void CSGenerateVplLists_LightDirectional(uint3 DTid : SV_DispatchThreadID)
|
|
{
|
|
float4 normalBiasTex = gRsmNormalTex.Load( int3(DTid.xy,0) );
|
|
|
|
float3 normal = normalize( normalBiasTex.xyz * 2.0f - 1.0f );
|
|
float3 flux = gRsmFluxTex.Load( int3(DTid.xy,0) );
|
|
float depth = gRsmDepthTex.Load( int3(DTid.xy,0) ).x;
|
|
|
|
float primitiveBiasMultiplier = normalBiasTex.w * 32.0f;
|
|
float biasFactor = min( 1.0f, 1.0f/primitiveBiasMultiplier );
|
|
|
|
flux *= biasFactor;
|
|
|
|
float2 texCoord = float2( DTid.xy ) * LpvWrite.RsmPixelToTexcoordMultiplier;
|
|
|
|
float3 rsmPos = float3( texCoord, depth );
|
|
float3 worldPos = mul( float4(rsmPos,1), LpvWrite.mRsmToWorld ).xyz;
|
|
|
|
worldPos += normal * LpvWrite.VplInjectionBias * primitiveBiasMultiplier;
|
|
|
|
AddToVplList( worldPos, flux*LpvWrite.mLightColour, normal, false );
|
|
}
|