summaryrefslogtreecommitdiffstats
path: root/Shaders/PostProcess
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-07-02 05:19:11 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-07-02 05:19:11 +0000
commit49c403aad8a9eab8908db57a0bfb16290c3244c9 (patch)
treed9c5abfd85fdd8d8a66726763e2e415df6a1fc02 /Shaders/PostProcess
parentToneMapping: removed F3ONE and F3ZERO macros (diff)
downloadDiligentFX-49c403aad8a9eab8908db57a0bfb16290c3244c9.tar.gz
DiligentFX-49c403aad8a9eab8908db57a0bfb16290c3244c9.zip
Epipolar light scattering: removed F*ONE and F*ZERO macros
Diffstat (limited to 'Shaders/PostProcess')
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh11
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/CoarseInsctr.fx2
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/InitializeMinMaxShadowMap.fx4
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/LookUpTables.fxh2
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/RayMarch.fx8
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/RefineSampleLocations.fx2
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/RenderSliceEndPoints.fx6
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/SliceUVDirection.fx6
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/Sun.fx2
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx16
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeScatteringOrder.fx10
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeSctrRadiance.fx4
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeAmbientSkyLight.fx4
-rw-r--r--Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeSingleScattering.fx2
14 files changed, 36 insertions, 43 deletions
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh b/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh
index f87f6fa..de9d49c 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh
@@ -9,13 +9,6 @@
#define PI 3.1415928
#define FLT_MAX 3.402823466e+38
-#define F4ZERO float4(0.0, 0.0, 0.0, 0.0)
-#define F4ONE float4(1.0, 1.0, 1.0, 1.0)
-#define F3ZERO float3(0.0, 0.0, 0.0)
-#define F3ONE float3(1.0, 1.0, 1.0)
-#define F2ZERO float2(0.0, 0.0)
-#define F2ONE float2(1.0, 1.0)
-
#ifndef OPTIMIZE_SAMPLE_LOCATIONS
# define OPTIMIZE_SAMPLE_LOCATIONS 1
#endif
@@ -165,7 +158,7 @@ void GetRaySphereIntersection2(in float3 f3RayOrigin,
float2 f2RealRootMask = float2(D.x >= 0.0 ? 1.0 : 0.0, D.y >= 0.0 ? 1.0 : 0.0);
D = sqrt( max(D,0.0) );
f4Intersections = f2RealRootMask.xxyy * float4(-B - D.x, -B + D.x, -B - D.y, -B + D.y) / (2.0*A) +
- (F4ONE - f2RealRootMask.xxyy) * float4(-1.0,-1.0,-1.0,-1.0);
+ (float4(1.0, 1.0, 1.0, 1.0) - f2RealRootMask.xxyy) * float4(-1.0, -1.0, -1.0, -1.0);
}
@@ -193,7 +186,7 @@ float4 GetOutermostScreenPixelCoords(float4 ScreenResolution)
bool IsValidScreenLocation(in float2 f2XY, float4 ScreenResolution)
{
const float2 SAFETY_EPSILON = float2(0.2, 0.2);
- return all( LessEqual( abs(f2XY), F2ONE - (F2ONE - SAFETY_EPSILON) * ScreenResolution.zw ) );
+ return all( LessEqual( abs(f2XY), float2(1.0, 1.0) - (float2(1.0, 1.0) - SAFETY_EPSILON) * ScreenResolution.zw ) );
}
float GetAverageSceneLuminance(in Texture2D<float> tex2DAverageLuminance)
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/CoarseInsctr.fx b/Shaders/PostProcess/EpipolarLightScattering/private/CoarseInsctr.fx
index aa0336c..12a2dac 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/CoarseInsctr.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/CoarseInsctr.fx
@@ -76,7 +76,7 @@ void RenderCoarseUnshadowedInsctrPS(FullScreenTriangleVSOutput VSOut,
out float4 f4Inscattering : SV_Target0)
{
- float3 f3Extinction = F3ONE;
+ float3 f3Extinction = float3(1.0, 1.0, 1.0);
ShaderFunctionInternal(VSOut.f4PixelPos, f4Inscattering.rgb, f3Extinction );
f4Inscattering.a = 1.0;
}
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/InitializeMinMaxShadowMap.fx b/Shaders/PostProcess/EpipolarLightScattering/private/InitializeMinMaxShadowMap.fx
index 7d387ab..fc52ac5 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/InitializeMinMaxShadowMap.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/InitializeMinMaxShadowMap.fx
@@ -37,8 +37,8 @@ void InitializeMinMaxShadowMapPS(in FullScreenTriangleVSOutput VSOut,
// Calculate current sample position on the ray
float2 f2CurrUV = f4SliceUVDirAndOrigin.zw + f4SliceUVDirAndOrigin.xy * floor(VSOut.f4PixelPos.x) * 2.f;
- float4 f4MinDepth = F4ONE;
- float4 f4MaxDepth = F4ZERO;
+ float4 f4MinDepth = float4(1.0, 1.0, 1.0, 1.0);
+ float4 f4MaxDepth = float4(0.0, 0.0, 0.0, 0.0);
// Gather 8 depths which will be used for PCF filtering for this sample and its immediate neighbor
// along the epipolar slice
// Note that if the sample is located outside the shadow map, Gather() will return 0 as
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/LookUpTables.fxh b/Shaders/PostProcess/EpipolarLightScattering/private/LookUpTables.fxh
index aec98ac..ecd06fd 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/LookUpTables.fxh
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/LookUpTables.fxh
@@ -176,7 +176,7 @@ float4 WorldParams2InsctrLUTCoords(float fHeight,
f4UVWQ.w = acos(fCosSunViewAngle) / PI;
f4UVWQ.w = sign(f4UVWQ.w - 0.5) * pow( abs((f4UVWQ.w - 0.5)/0.5), SunViewPower)/2.0 + 0.5;
- f4UVWQ.xzw = ((f4UVWQ * (PRECOMPUTED_SCTR_LUT_DIM - F4ONE) + 0.5) / PRECOMPUTED_SCTR_LUT_DIM).xzw;
+ f4UVWQ.xzw = ((f4UVWQ * (PRECOMPUTED_SCTR_LUT_DIM - float4(1.0, 1.0, 1.0, 1.0)) + float4(0.5, 0.5, 0.5, 0.5)) / PRECOMPUTED_SCTR_LUT_DIM).xzw;
#else
f4UVWQ.y = (fCosViewZenithAngle+1.f) / 2.f;
f4UVWQ.z = (fCosSunZenithAngle +1.f) / 2.f;
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/RayMarch.fx b/Shaders/PostProcess/EpipolarLightScattering/private/RayMarch.fx
index 6b1901d..7aebf3e 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/RayMarch.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/RayMarch.fx
@@ -667,12 +667,12 @@ void RayMarchPS(in FullScreenTriangleVSOutput VSOut,
float fRayEndCamSpaceZ = g_tex2DEpipolarCamSpaceZ.Load( int3(ui2SamplePosSliceInd, 0) );
[branch]
- if( any( Greater( abs( f2SampleLocation ), (1.0 + 1e-3) * F2ONE) ) )
+ if( any( Greater( abs( f2SampleLocation ), (1.0 + 1e-3) * float2(1.0, 1.0)) ) )
{
- f4Inscattering = F4ZERO;
+ f4Inscattering = float4(0.0, 0.0, 0.0, 0.0);
return;
}
- f4Inscattering = F4ONE;
+ f4Inscattering = float4(1.0, 1.0, 1.0, 1.0);
#if ENABLE_LIGHT_SHAFTS
float fCascade = g_MiscParams.fCascadeInd + VSOut.fInstID;
f4Inscattering.rgb =
@@ -770,6 +770,6 @@ void FixAndApplyInscatteredRadiancePS(FullScreenTriangleVSOutput VSOut,
f4Color.rgb = ToneMap(f3BackgroundColor + f3InsctrColor, g_PPAttribs.ToneMapping, fAveLogLum);
#else
const float DELTA = 0.00001;
- f4Color.rgb = log( max(DELTA, dot(f3BackgroundColor + f3InsctrColor, RGB_TO_LUMINANCE)) ) * F3ONE;
+ f4Color.rgb = log( max(DELTA, dot(f3BackgroundColor + f3InsctrColor, RGB_TO_LUMINANCE)) ) * float3(1.0, 1.0, 1.0);
#endif
}
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/RefineSampleLocations.fx b/Shaders/PostProcess/EpipolarLightScattering/private/RefineSampleLocations.fx
index 4e1a28a..627a398 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/RefineSampleLocations.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/RefineSampleLocations.fx
@@ -100,7 +100,7 @@ void RefineSampleLocationsCS(uint3 Gid : SV_GroupID,
// It should also account for the fact that rgb channels contribute differently
// to the percieved brightness. For r channel the threshold should be smallest,
// for b channel - the largest
- float3 f3MinInsctrThreshold = (0.02 * fAverageLum * F3ONE / RGB_TO_LUMINANCE.xyz) / g_PPAttribs.ToneMapping.fMiddleGray;
+ float3 f3MinInsctrThreshold = (0.02 * fAverageLum / RGB_TO_LUMINANCE.xyz) / g_PPAttribs.ToneMapping.fMiddleGray;
f3MaxInsctr = max(f3MaxInsctr, f3MinInsctrThreshold);
// Compare the difference with the threshold. If the neighbour sample is invalid, its inscattering
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/RenderSliceEndPoints.fx b/Shaders/PostProcess/EpipolarLightScattering/private/RenderSliceEndPoints.fx
index 4364008..9416c85 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/RenderSliceEndPoints.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/RenderSliceEndPoints.fx
@@ -51,7 +51,7 @@ float2 GetEpipolarLineEntryPoint(float2 f2ExitPoint)
// 0.5 screen pixel size inwards. Using these adjusted boundaries improves precision and results in
// smaller number of pixels which require inscattering correction
float4 f4Boundaries = GetOutermostScreenPixelCoords(g_PPAttribs.f4ScreenResolution);
- bool4 b4IsCorrectIntersectionFlag = Greater( abs(f2RayDir.xyxy), 1e-5 * F4ONE );
+ bool4 b4IsCorrectIntersectionFlag = Greater( abs(f2RayDir.xyxy), 1e-5 * float4(1.0, 1.0, 1.0, 1.0) );
float4 f4DistToBoundaries = (f4Boundaries - g_PPAttribs.f4LightScreenPos.xyxy) / (f2RayDir.xyxy + BoolToFloat( Not(b4IsCorrectIntersectionFlag) ) );
// Addition of !b4IsCorrectIntersectionFlag is required to prevent divison by zero
// Note that such incorrect lanes will be masked out anyway
@@ -60,7 +60,7 @@ float2 GetEpipolarLineEntryPoint(float2 f2ExitPoint)
// This means that we need to find maximum intersection distance which is less than fDistToBoundary
// We thus need to skip all boundaries, distance to which is greater than the distance to exit boundary
// Using -FLT_MAX as the distance to these boundaries will result in skipping them:
- b4IsCorrectIntersectionFlag = And( b4IsCorrectIntersectionFlag, Less( f4DistToBoundaries, (fDistToExitBoundary - 1e-4) * F4ONE ) );
+ b4IsCorrectIntersectionFlag = And( b4IsCorrectIntersectionFlag, Less( f4DistToBoundaries, (fDistToExitBoundary - 1e-4) * float4(1.0, 1.0, 1.0, 1.0) ) );
float4 f4CorrectDist = BoolToFloat( b4IsCorrectIntersectionFlag ) * f4DistToBoundaries;
// When working with FLT_MAX, we must make sure that the compiler does not use mad instruction,
// which will screw things up due to precision issues. DO NOT use 1.0-Flag
@@ -149,7 +149,7 @@ float4 GenerateSliceEndpointsPS(FullScreenTriangleVSOutput VSOut
// *
// Left Boundary Bottom Boundary Right Boundary Top Boundary
//
- bool4 b4IsInvalidBoundary = LessEqual( (g_PPAttribs.f4LightScreenPos.xyxy - f4OutermostScreenPixelCoords.xyzw) * float4(1,1,-1,-1), F4ZERO );
+ bool4 b4IsInvalidBoundary = LessEqual( (g_PPAttribs.f4LightScreenPos.xyxy - f4OutermostScreenPixelCoords.xyzw) * float4(1.0, 1.0, -1.0, -1.0), float4(0.0, 0.0, 0.0, 0.0) );
if( dot( BoolToFloat(b4IsInvalidBoundary), BoolToFloat(b4BoundaryFlags) ) != 0.0 )
{
return INVALID_EPIPOLAR_LINE;
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/SliceUVDirection.fx b/Shaders/PostProcess/EpipolarLightScattering/private/SliceUVDirection.fx
index 70ba31e..017cd44 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/SliceUVDirection.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/SliceUVDirection.fx
@@ -54,7 +54,7 @@ void RenderSliceUVDirInShadowMapTexturePS(in FullScreenTriangleVSOutput VSOut,
f2SliceDir /= max(abs(f2SliceDir.x), abs(f2SliceDir.y));
float4 f4BoundaryMinMaxXYXY = float4(0.0, 0.0, 1.0, 1.0) + float4(0.5, 0.5, -0.5, -0.5)*g_PPAttribs.f2ShadowMapTexelSize.xyxy;
- if( any( Less( (f2SliceOriginUV.xyxy - f4BoundaryMinMaxXYXY) * float4( 1.0, 1.0, -1.0, -1.0), F4ZERO ) ) )
+ if( any( Less( (f2SliceOriginUV.xyxy - f4BoundaryMinMaxXYXY) * float4( 1.0, 1.0, -1.0, -1.0), float4(0.0, 0.0, 0.0, 0.0) ) ) )
{
// If slice origin in UV coordinates falls beyond [0,1]x[0,1] region, we have
// to continue the ray and intersect it with this rectangle
@@ -71,11 +71,11 @@ void RenderSliceUVDirInShadowMapTexturePS(in FullScreenTriangleVSOutput VSOut,
//
// First, compute signed distances from the slice origin to all four boundaries
- bool4 b4IsValidIsecFlag = Greater(abs(f2SliceDir.xyxy), 1e-6 * F4ONE);
+ bool4 b4IsValidIsecFlag = Greater(abs(f2SliceDir.xyxy), 1e-6 * float4(1.0, 1.0, 1.0, 1.0));
float4 f4DistToBoundaries = (f4BoundaryMinMaxXYXY - f2SliceOriginUV.xyxy) / (f2SliceDir.xyxy + BoolToFloat( Not(b4IsValidIsecFlag) ) );
//We consider only intersections in the direction of the ray
- b4IsValidIsecFlag = And( b4IsValidIsecFlag, Greater(f4DistToBoundaries, F4ZERO) );
+ b4IsValidIsecFlag = And( b4IsValidIsecFlag, Greater(f4DistToBoundaries, float4(0.0, 0.0, 0.0, 0.0)) );
// Compute the second intersection coordinate
float4 f4IsecYXYX = f2SliceOriginUV.yxyx + f4DistToBoundaries * f2SliceDir.yxyx;
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/Sun.fx b/Shaders/PostProcess/EpipolarLightScattering/private/Sun.fx
index af3f524..458c491 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/Sun.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/Sun.fx
@@ -50,6 +50,6 @@ void SunPS(SunVSOutput VSOut,
float2 fCotanHalfFOV = float2( MATRIX_ELEMENT(g_CameraAttribs.mProj, 0, 0), MATRIX_ELEMENT(g_CameraAttribs.mProj, 1, 1) );
float2 f2SunScreenSize = fTanSunAngularRadius * fCotanHalfFOV;
float2 f2dXY = (VSOut.f2NormalizedXY - g_PPAttribs.f4LightScreenPos.xy) / f2SunScreenSize;
- f4Color.rgb = sqrt(saturate(1.0 - dot(f2dXY, f2dXY))) * F3ONE;
+ f4Color.rgb = sqrt(saturate(1.0 - dot(f2dXY, f2dXY))) * float3(1.0, 1.0, 1.0);
f4Color.a = 1.0;
}
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx b/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx
index ce61ae8..826d254 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx
@@ -111,7 +111,7 @@ void UnwarpEpipolarInsctrImage( in float2 f2PosPS,
//float fDistToBottomBoundary = abs(f2RayDir.y) > 1e-5 ? ( -1 - g_PPAttribs.f4LightScreenPos.y) / f2RayDir.y : -FLT_MAX;
//float fDistToRightBoundary = abs(f2RayDir.x) > 1e-5 ? ( 1 - g_PPAttribs.f4LightScreenPos.x) / f2RayDir.x : -FLT_MAX;
//float fDistToTopBoundary = abs(f2RayDir.y) > 1e-5 ? ( 1 - g_PPAttribs.f4LightScreenPos.y) / f2RayDir.y : -FLT_MAX;
- float4 f4DistToBoundaries = ( f4Boundaries - g_PPAttribs.f4LightScreenPos.xyxy ) / (f2RayDir.xyxy + BoolToFloat( Less( abs(f2RayDir.xyxy), 1e-6*F4ONE) ) );
+ float4 f4DistToBoundaries = ( f4Boundaries - g_PPAttribs.f4LightScreenPos.xyxy ) / (f2RayDir.xyxy + BoolToFloat( Less( abs(f2RayDir.xyxy), 1e-6 * float4(1.0, 1.0, 1.0, 1.0)) ) );
// Select distance to the exit boundary:
float fDistToExitBoundary = dot( BoolToFloat( b4SectorFlags ), f4DistToBoundaries );
// Compute exit point on the boundary:
@@ -150,8 +150,8 @@ void UnwarpEpipolarInsctrImage( in float2 f2PosPS,
fSliceWeights[1] = (fEpipolarSlice*float(g_PPAttribs.uiNumEpipolarSlices)) - fPrecedingSliceInd;
fSliceWeights[0] = 1.0 - fSliceWeights[1];
- f3Inscattering = F3ZERO;
- f3Extinction = F3ZERO;
+ f3Inscattering = float3(0.0, 0.0, 0.0);
+ f3Extinction = float3(0.0, 0.0, 0.0);
float fTotalWeight = 0.0;
[unroll]
for(int i=0; i<2; ++i)
@@ -211,7 +211,7 @@ void UnwarpEpipolarInsctrImage( in float2 f2PosPS,
float2 f2DepthWeights = saturate( g_PPAttribs.fRefinementThreshold / max( abs(fCamSpaceZ-f2SrcLocationsCamSpaceZ)/f2MaxZ, g_PPAttribs.fRefinementThreshold ) );
// Note that if the sample is located outside the [-1,1]x[-1,1] area, the sample is invalid and fCurrCamSpaceZ == fInvalidCoordinate
// Depth weight computed for such sample will be zero
- f2DepthWeights = pow(f2DepthWeights, 4.0*F2ONE);
+ f2DepthWeights = pow(f2DepthWeights, float2(4.0, 4.0));
// Multiply bilinear weights with the depth weights:
float2 f2BilateralUWeights = float2(1.0-fUWeight, fUWeight) * f2DepthWeights * fSliceWeights[i];
@@ -250,7 +250,7 @@ void UnwarpEpipolarInsctrImage( in float2 f2PosPS,
#endif
// Update total weight
- fTotalWeight += dot(f2BilateralUWeights, F2ONE);
+ fTotalWeight += dot(f2BilateralUWeights, float2(1.0, 1.0));
}
#if CORRECT_INSCATTERING_AT_DEPTH_BREAKS
@@ -282,13 +282,13 @@ void ApplyInscatteredRadiancePS(FullScreenTriangleVSOutput VSOut,
float3 f3Inscttering, f3Extinction;
UnwarpEpipolarInsctrImage(VSOut.f2NormalizedXY, fCamSpaceZ, f3Inscttering, f3Extinction);
- float3 f3BackgroundColor = F3ZERO;
+ float3 f3BackgroundColor = float3(0.0, 0.0, 0.0);
[branch]
if( !g_PPAttribs.bShowLightingOnly )
{
f3BackgroundColor = g_tex2DColorBuffer.SampleLevel( g_tex2DColorBuffer_sampler, f2UV, 0).rgb;
// fFarPlaneZ is pre-multiplied with 0.999999f
- f3BackgroundColor *= (fCamSpaceZ > g_CameraAttribs.fFarPlaneZ) ? g_LightAttribs.f4Intensity.rgb : F3ONE;
+ f3BackgroundColor *= (fCamSpaceZ > g_CameraAttribs.fFarPlaneZ) ? g_LightAttribs.f4Intensity.rgb : float3(1.0, 1.0, 1.0);
#if EXTINCTION_EVAL_MODE == EXTINCTION_EVAL_MODE_PER_PIXEL
float3 f3ReconstructedPosWS = ProjSpaceXYZToWorldSpace(float3(VSOut.f2NormalizedXY.xy, fCamSpaceZ), g_CameraAttribs.mProj, g_CameraAttribs.mViewProjInv);
@@ -303,7 +303,7 @@ void ApplyInscatteredRadiancePS(FullScreenTriangleVSOutput VSOut,
f4Color.rgb = ToneMap(f3BackgroundColor + f3Inscttering, g_PPAttribs.ToneMapping, fAveLogLum);
#else
const float DELTA = 0.00001;
- f4Color.rgb = log( max(DELTA, dot(f3BackgroundColor + f3Inscttering, RGB_TO_LUMINANCE)) ) * F3ONE;
+ f4Color.rgb = log( max(DELTA, dot(f3BackgroundColor + f3Inscttering, RGB_TO_LUMINANCE)) ) * float3(1.0, 1.0, 1.0);
#endif
f4Color.a = 1.0;
}
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeScatteringOrder.fx b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeScatteringOrder.fx
index 0ee02ec..fce95cd 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeScatteringOrder.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeScatteringOrder.fx
@@ -44,7 +44,7 @@ void ComputeScatteringOrderCS(uint3 ThreadId : SV_DispatchThreadID)
// This is just a sanity check and should never happen
// as the start point is always under the top of the
// atmosphere (look at InsctrLUTCoords2WorldParams())
- g_rwtex3DInsctrOrder[ThreadId] = F3ZERO;
+ g_rwtex3DInsctrOrder[ThreadId] = float3(0.0, 0.0, 0.0);
return;
}
@@ -57,7 +57,7 @@ void ComputeScatteringOrderCS(uint3 ThreadId : SV_DispatchThreadID)
const int iNumSamples = 64;
float fStepLen = fRayLength / float(iNumSamples);
- float4 f4UVWQ = -F4ONE;
+ float4 f4UVWQ = float4(-1.0, -1.0, -1.0, -1.0);
float3 f3PrevSctrRadiance = LookUpPrecomputedScattering(
f3RayStart,
f3ViewDir,
@@ -70,8 +70,8 @@ void ComputeScatteringOrderCS(uint3 ThreadId : SV_DispatchThreadID)
f4UVWQ);
float2 f2PrevParticleDensity = exp( -float2(fHeight, fHeight) * g_MediaParams.f4ParticleScaleHeight.zw );
- float2 f2NetParticleDensityFromCam = F2ZERO;
- float3 f3Inscattering = F3ZERO;
+ float2 f2NetParticleDensityFromCam = float2(0.0, 0.0);
+ float3 f3Inscattering = float3(0.0, 0.0, 0.0);
for (int iSample=1; iSample <= iNumSamples; ++iSample)
{
@@ -91,7 +91,7 @@ void ComputeScatteringOrderCS(uint3 ThreadId : SV_DispatchThreadID)
float3 f3ExtinctionFromCam = exp( -(f3RlghOpticalDepth + f3MieOpticalDepth) );
// Get attenuated scattered light radiance in the current point
- float4 f4UVWQ = -F4ONE;
+ float4 f4UVWQ = float4(-1.0, -1.0, -1.0, -1.0);
float3 f3SctrRadiance = f3ExtinctionFromCam *
LookUpPrecomputedScattering(
f3Pos,
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeSctrRadiance.fx b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeSctrRadiance.fx
index c35d965..604a5ea 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeSctrRadiance.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/ComputeSctrRadiance.fx
@@ -38,14 +38,14 @@ void ComputeSctrRadianceCS(uint3 ThreadId : SV_DispatchThreadID)
// Compute particle density scale factor
float2 f2ParticleDensity = exp( -float2(fHeight, fHeight) * g_MediaParams.f4ParticleScaleHeight.zw );
- float3 f3SctrRadiance = F3ZERO;
+ float3 f3SctrRadiance = float3(0.0, 0.0, 0.0);
// Go through a number of samples randomly distributed over the sphere
for(int iSample = 0; iSample < NUM_RANDOM_SPHERE_SAMPLES; ++iSample)
{
// Get random direction
float3 f3RandomDir = normalize( g_tex2DSphereRandomSampling.Load(int3(iSample,0,0)) );
// Get the previous order in-scattered light when looking in direction f3RandomDir (the light thus goes in direction -f3RandomDir)
- float4 f4UVWQ = -F4ONE;
+ float4 f4UVWQ = float4(-1.0, -1.0, -1.0, -1.0);
float3 f3PrevOrderSctr = LookUpPrecomputedScattering(
f3RayStart,
f3RandomDir,
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeAmbientSkyLight.fx b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeAmbientSkyLight.fx
index 333df15..9826257 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeAmbientSkyLight.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeAmbientSkyLight.fx
@@ -25,7 +25,7 @@ void PrecomputeAmbientSkyLightPS(FullScreenTriangleVSOutput VSOut,
float3 f3EarthCentre = float3(0.0, -g_MediaParams.fEarthRadius, 0.0);
float fCosZenithAngle = clamp(fU * 2.0 - 1.0, -1.0, +1.0);
float3 f3DirOnLight = float3(sqrt(saturate(1.0 - fCosZenithAngle*fCosZenithAngle)), fCosZenithAngle, 0.0);
- f4SkyLight = F4ZERO;
+ f4SkyLight = float4(0.0, 0.0, 0.0, 0.0);
// Go through a number of random directions on the sphere
for(int iSample = 0; iSample < NUM_RANDOM_SPHERE_SAMPLES; ++iSample)
{
@@ -34,7 +34,7 @@ void PrecomputeAmbientSkyLightPS(FullScreenTriangleVSOutput VSOut,
// Reflect directions from the lower hemisphere
f3RandomDir.y = abs(f3RandomDir.y);
// Get multiple scattered light radiance when looking in direction f3RandomDir (the light thus goes in direction -f3RandomDir)
- float4 f4UVWQ = -F4ONE;
+ float4 f4UVWQ = float4(-1.0, -1.0, -1.0, -1.0);
float3 f3Sctr = LookUpPrecomputedScattering(
f3RayStart,
f3RandomDir,
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeSingleScattering.fx b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeSingleScattering.fx
index dcaf79b..7de162b 100644
--- a/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeSingleScattering.fx
+++ b/Shaders/PostProcess/EpipolarLightScattering/private/precompute/PrecomputeSingleScattering.fx
@@ -46,7 +46,7 @@ void PrecomputeSingleScatteringCS(uint3 ThreadId : SV_DispatchThreadID)
// This is just a sanity check and should never happen
// as the start point is always under the top of the
// atmosphere (look at InsctrLUTCoords2WorldParams())
- g_rwtex3DSingleScattering[ThreadId] = F3ZERO;
+ g_rwtex3DSingleScattering[ThreadId] = float3(0.0, 0.0, 0.0);
return;
}