Add Global Illumination sampling option to transparent materials (eg. particles)
This commit is contained in:
@@ -97,6 +97,11 @@ float4 PS_Forward(PixelInput input) : SV_Target0
|
||||
light += GetLighting(ViewPos, localLight, gBuffer, shadowMask, true, isSpotLight);
|
||||
}
|
||||
|
||||
// Calculate lighting from Global Illumination
|
||||
#if USE_GI
|
||||
light += GetGlobalIlluminationLighting(gBuffer);
|
||||
#endif
|
||||
|
||||
// Calculate reflections
|
||||
#if USE_REFLECTIONS
|
||||
float3 reflections = SampleReflectionProbe(ViewPos, EnvProbe, EnvironmentProbe, gBuffer.WorldPos, gBuffer.Normal, gBuffer.Roughness).rgb;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
|
||||
@0// Global Illumination: Defines
|
||||
#define USE_GI 1
|
||||
@1// Global Illumination: Includes
|
||||
#include "./Flax/GI/DDGI.hlsl"
|
||||
#include "./Flax/LightingCommon.hlsl"
|
||||
@2// Global Illumination: Constants
|
||||
DDGIData DDGI;
|
||||
@3// Global Illumination: Resources
|
||||
Texture2D<snorm float4> ProbesState : register(t__SRV__);
|
||||
Texture2D<float4> ProbesDistance : register(t__SRV__);
|
||||
Texture2D<float4> ProbesIrradiance : register(t__SRV__);
|
||||
@4// Global Illumination: Utilities
|
||||
float4 GetGlobalIlluminationLighting(GBufferSample gBuffer)
|
||||
{
|
||||
float3 irradiance = SampleDDGIIrradiance(DDGI, ProbesState, ProbesDistance, ProbesIrradiance, gBuffer.WorldPos, gBuffer.Normal);
|
||||
float3 diffuseColor = GetDiffuseColor(gBuffer);
|
||||
float3 diffuse = Diffuse_Lambert(diffuseColor);
|
||||
return float4(diffuse * irradiance, saturate(length(irradiance)));
|
||||
}
|
||||
|
||||
@5// Global Illumination: Shaders
|
||||
Reference in New Issue
Block a user