diff --git a/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/InferCubemapCS.hlsl b/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/InferCubemapCS.hlsl index b31b4db17..d326f9503 100644 --- a/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/InferCubemapCS.hlsl +++ b/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/InferCubemapCS.hlsl @@ -90,7 +90,7 @@ float3 GetSamplingVector(uint3 ThreadID, in RWTexture2DArray OutputTextu } #if defined(REFLECTIONS) - color.rgb = lerp(color.rgb, Color::GammaToLinear(ReflectionsTexture.SampleLevel(LinearSampler, uv, 0)), saturate(mipLevel / 8.0)); + color.rgb = lerp(color.rgb, Color::GammaToLinear(ReflectionsTexture.SampleLevel(LinearSampler, uv, 0).rgb), saturate(mipLevel / 8.0)); #else color.rgb = lerp(color.rgb, color.rgb * Color::GammaToLinear(DefaultCubemap.SampleLevel(LinearSampler, uv, 0).x) * 2, saturate(mipLevel / 8.0)); #endif diff --git a/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/UpdateCubemapCS.hlsl b/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/UpdateCubemapCS.hlsl index 7a18c1904..c9b3817b9 100644 --- a/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/UpdateCubemapCS.hlsl +++ b/features/Dynamic Cubemaps/Shaders/DynamicCubemaps/UpdateCubemapCS.hlsl @@ -106,7 +106,7 @@ float smoothbumpstep(float edge0, float edge1, float x) position += positionCS.xyz; - color += ColorTexture.SampleLevel(LinearSampler, uv, 0); + color += ColorTexture.SampleLevel(LinearSampler, uv, 0).rgb; weight++; } diff --git a/features/Extended Materials/Shaders/ExtendedMaterials/ExtendedMaterials.hlsli b/features/Extended Materials/Shaders/ExtendedMaterials/ExtendedMaterials.hlsli index 34e4dfcff..4416d37d0 100644 --- a/features/Extended Materials/Shaders/ExtendedMaterials/ExtendedMaterials.hlsli +++ b/features/Extended Materials/Shaders/ExtendedMaterials/ExtendedMaterials.hlsli @@ -116,7 +116,7 @@ namespace ExtendedMaterials wsum += weights[i]; } float invwsum = rcp(wsum); - [unroll] for (int i = 0; i < 6; i++) + [unroll] for (i = 0; i < 6; i++) { weights[i] *= invwsum; } @@ -156,7 +156,7 @@ namespace ExtendedMaterials total += pixelOffset[i]; } float invtotal = rcp(total); - [unroll] for (int i = 0; i < 6; i++) + [unroll] for (i = 0; i < 6; i++) { pixelOffset[i] *= invtotal; } @@ -354,13 +354,13 @@ namespace ExtendedMaterials float scale = max(params[0].HeightScale * input.LandBlendWeights1.x, max(params[1].HeightScale * input.LandBlendWeights1.y, max(params[2].HeightScale * input.LandBlendWeights1.z, max(params[3].HeightScale * input.LandBlendWeights1.w, max(params[4].HeightScale * input.LandBlendWeights2.x, params[5].HeightScale * input.LandBlendWeights2.y))))); rayDir *= scale; - sh = GetTerrainHeight(input, coords + rayDir * multipliers.x, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2, heights); + sh = GetTerrainHeight(input, coords + rayDir * multipliers.x, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2.xy, heights); if (quality > 0.25) - sh.y = GetTerrainHeight(input, coords + rayDir * multipliers.y, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2, heights); + sh.y = GetTerrainHeight(input, coords + rayDir * multipliers.y, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2.xy, heights); if (quality > 0.5) - sh.z = GetTerrainHeight(input, coords + rayDir * multipliers.z, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2, heights); + sh.z = GetTerrainHeight(input, coords + rayDir * multipliers.z, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2.xy, heights); if (quality > 0.75) - sh.w = GetTerrainHeight(input, coords + rayDir * multipliers.w, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2, heights); + sh.w = GetTerrainHeight(input, coords + rayDir * multipliers.w, mipLevel, params, quality, input.LandBlendWeights1, input.LandBlendWeights2.xy, heights); return 1.0 - saturate(dot(max(0, sh - sh0), 1.0) * shadowIntensity) * lerp(quality, 1.0, extendedMaterialSettings.ExtendShadows); # else sh = GetTerrainHeight(input, coords + rayDir * multipliers.x, mipLevel, params, quality, heights); diff --git a/features/Grass Collision/Shaders/GrassCollision/GrassCollision.hlsli b/features/Grass Collision/Shaders/GrassCollision/GrassCollision.hlsli index ef4d33f5d..b2b2ba3b7 100644 --- a/features/Grass Collision/Shaders/GrassCollision/GrassCollision.hlsli +++ b/features/Grass Collision/Shaders/GrassCollision/GrassCollision.hlsli @@ -19,9 +19,9 @@ namespace GrassCollision float3 displacement = 0.0; for (uint i = 0; i < numCollisions; i++) { - float dist = distance(collisionData[i].centre[eyeIndex], worldPosition); + float dist = distance(collisionData[i].centre[eyeIndex].xyz, worldPosition); float power = 1.0 - saturate(dist / collisionData[i].centre[0].w); - float3 direction = worldPosition - collisionData[i].centre[eyeIndex]; + float3 direction = worldPosition - collisionData[i].centre[eyeIndex].xyz; float3 shift = power * direction; displacement += shift; displacement.z -= length(shift.xy); diff --git a/features/Screen Space GI/Shaders/ScreenSpaceGI/blur.cs.hlsl b/features/Screen Space GI/Shaders/ScreenSpaceGI/blur.cs.hlsl index bf5c6ba8a..6de5aa5f8 100644 --- a/features/Screen Space GI/Shaders/ScreenSpaceGI/blur.cs.hlsl +++ b/features/Screen Space GI/Shaders/ScreenSpaceGI/blur.cs.hlsl @@ -141,7 +141,7 @@ float2x3 getKernelBasis(float3 D, float3 N, float roughness = 1.0, float anisoFa uvSample = (floor(uvSample * OUT_FRAME_DIM) + 0.5) * RCP_OUT_FRAME_DIM; // Snap to the pixel centre float depthSample = srcDepth.SampleLevel(samplerLinearClamp, uvSample * frameScale, 0); - float3 posSample = ScreenToViewPosition(screenPosSample, depthSample, eyeIndex); + float3 posSample = ScreenToViewPosition(screenPosSample.xy, depthSample, eyeIndex); float4 normalRoughnessSample = srcNormalRoughness.SampleLevel(samplerLinearClamp, uvSample * frameScale, 0); float3 normalSample = GBuffer::DecodeNormal(normalRoughnessSample.xy); diff --git a/features/Screen Space GI/Shaders/ScreenSpaceGI/radianceDisocc.cs.hlsl b/features/Screen Space GI/Shaders/ScreenSpaceGI/radianceDisocc.cs.hlsl index d35d1c47e..f4d753b06 100644 --- a/features/Screen Space GI/Shaders/ScreenSpaceGI/radianceDisocc.cs.hlsl +++ b/features/Screen Space GI/Shaders/ScreenSpaceGI/radianceDisocc.cs.hlsl @@ -36,7 +36,7 @@ void readHistory( const float prev_depth = prev_geo.x; // const float3 prev_normal = GBuffer::DecodeNormal(prev_geo.yz); // prev normal is already world float3 prev_pos = ScreenToViewPosition(screen_pos, prev_depth, eyeIndex); - prev_pos = ViewToWorldPosition(prev_pos, PrevInvViewMat[eyeIndex]) + CameraPreviousPosAdjust[eyeIndex]; + prev_pos = ViewToWorldPosition(prev_pos, PrevInvViewMat[eyeIndex]) + CameraPreviousPosAdjust[eyeIndex].xyz; float3 delta_pos = curr_pos - prev_pos; // float normal_prod = dot(curr_normal, prev_normal); @@ -94,7 +94,7 @@ void readHistory( // float3 curr_normal = GBuffer::DecodeNormal(srcCurrNormal[pixCoord]); // curr_normal = ViewToWorldVector(curr_normal, CameraViewInverse[eyeIndex]); float3 curr_pos = ScreenToViewPosition(screen_pos, curr_depth, eyeIndex); - curr_pos = ViewToWorldPosition(curr_pos, CameraViewInverse[eyeIndex]) + CameraPosAdjust[eyeIndex]; + curr_pos = ViewToWorldPosition(curr_pos, CameraViewInverse[eyeIndex]) + CameraPosAdjust[eyeIndex].xyz; float2 prev_px_coord = prev_uv * OUT_FRAME_DIM; int2 prev_px_lu = floor(prev_px_coord - 0.5); diff --git a/features/Skylighting/Shaders/Skylighting/Skylighting.hlsli b/features/Skylighting/Shaders/Skylighting/Skylighting.hlsli index 1648f9d43..e5f6af9a2 100644 --- a/features/Skylighting/Shaders/Skylighting/Skylighting.hlsli +++ b/features/Skylighting/Shaders/Skylighting/Skylighting.hlsli @@ -75,7 +75,7 @@ namespace Skylighting int3 offset = int3(i, j, k); int3 cellID = cell000 + offset; - if (any(cellID < 0) || any(cellID >= ARRAY_DIM)) + if (any(cellID < 0) || any((uint3)cellID >= ARRAY_DIM)) continue; float3 cellCentreMS = cellID + 0.5 - ARRAY_DIM / 2; diff --git a/features/Terrain Shadows/Shaders/TerrainShadows/ShadowUpdate.cs.hlsl b/features/Terrain Shadows/Shaders/TerrainShadows/ShadowUpdate.cs.hlsl index f148dfe02..be5485669 100644 --- a/features/Terrain Shadows/Shaders/TerrainShadows/ShadowUpdate.cs.hlsl +++ b/features/Terrain Shadows/Shaders/TerrainShadows/ShadowUpdate.cs.hlsl @@ -17,8 +17,8 @@ float GetInterpolatedHeight(float2 pxCoord, bool isVertical) uint2 dims; TexHeight.GetDimensions(dims.x, dims.y); - int2 lerpPxCoordA = int2(pxCoord - .5 * float2(isVertical, !isVertical)); - int2 lerpPxCoordB = int2(pxCoord + .5 * float2(isVertical, !isVertical)); + int2 lerpPxCoordA = min(0, int2(pxCoord - .5 * float2(isVertical, !isVertical))); + int2 lerpPxCoordB = min(0, int2(pxCoord + .5 * float2(isVertical, !isVertical))); float heightA = TexHeight[lerpPxCoordA]; float heightB = TexHeight[lerpPxCoordB]; @@ -31,7 +31,7 @@ float GetInterpolatedHeight(float2 pxCoord, bool isVertical) bool inBoundA = all(lerpPxCoordA > 0); bool inBoundB = all(lerpPxCoordB < dims); if (inBoundA && inBoundB) - return lerp(heightA, heightB, frac(pxCoord - .5)); + return lerp(heightA, heightB, frac(pxCoord.x - .5)); else if (!inBoundA) return heightB; else diff --git a/features/Water Lighting/Shaders/WaterLighting/WaterCaustics.hlsli b/features/Water Lighting/Shaders/WaterLighting/WaterCaustics.hlsli index 5511b7d1d..b8e379391 100644 --- a/features/Water Lighting/Shaders/WaterLighting/WaterCaustics.hlsli +++ b/features/Water Lighting/Shaders/WaterLighting/WaterCaustics.hlsli @@ -43,7 +43,7 @@ namespace WaterLighting float causticsFade = 1.0 - saturate(causticsDistToWater / 1024.0); causticsFade *= causticsFade; - float2 causticsUV = (worldPosition.xyz + CameraPosAdjust[0].xyz) * 0.005; + float2 causticsUV = (worldPosition.xy + CameraPosAdjust[0].xy) * 0.005; float2 causticsUV1 = PanCausticsUV(causticsUV, 0.5 * 0.2, 1.0); float2 causticsUV2 = PanCausticsUV(causticsUV, 1.0 * 0.2, -0.5); diff --git a/features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli b/features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli index 6ace82c91..5358ad026 100644 --- a/features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli +++ b/features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli @@ -146,7 +146,7 @@ namespace WetnessEffects float3 specularIrradiance = 1.0; # else float level = roughness * 7.0; - float3 specularIrradiance = Color::GammaToLinear(specularTexture.SampleLevel(SampColorSampler, R, level)); + float3 specularIrradiance = Color::GammaToLinear(specularTexture.SampleLevel(SampColorSampler, R, level).rgb); # endif #else float3 specularIrradiance = 1.0; diff --git a/package/Shaders/Common/PBR.hlsli b/package/Shaders/Common/PBR.hlsli index 5b840d50d..0e60f5757 100644 --- a/package/Shaders/Common/PBR.hlsli +++ b/package/Shaders/Common/PBR.hlsli @@ -339,14 +339,14 @@ namespace PBR // R Mp = HairGaussian(B[0], ThetaH - Alpha[0]); Np = 0.25 * cosHalfPhi; - Fp = GetFresnelFactorSchlick(specularColor, sqrt(saturate(0.5 + 0.5 * VdotL))); + Fp = GetFresnelFactorSchlick(specularColor, sqrt(saturate(0.5 + 0.5 * VdotL))).x; S += (Mp * Np) * (Fp * lerp(1, backlit, saturate(-VdotL))); // TT Mp = HairGaussian(B[1], ThetaH - Alpha[1]); a = (1.55f / hairIOR) * rcp(n_prime); h = cosHalfPhi * (1 + a * (0.6 - 0.8 * cosPhi)); - f = GetFresnelFactorSchlick(specularColor, cosThetaD * sqrt(saturate(1 - h * h))); + f = GetFresnelFactorSchlick(specularColor, cosThetaD * sqrt(saturate(1 - h * h))).x; Fp = (1 - f) * (1 - f); Tp = pow(surfaceProperties.BaseColor, 0.5 * sqrt(1 - (h * a) * (h * a)) / cosThetaD); Np = exp(-3.65 * cosPhi - 3.98); @@ -354,7 +354,7 @@ namespace PBR // TRT Mp = HairGaussian(B[2], ThetaH - Alpha[2]); - f = GetFresnelFactorSchlick(specularColor, cosThetaD * 0.5f); + f = GetFresnelFactorSchlick(specularColor, cosThetaD * 0.5f).x; Fp = (1 - f) * (1 - f) * f; Tp = pow(surfaceProperties.BaseColor, 0.8 / cosThetaD); Np = exp(17 * cosPhi - 16.78); diff --git a/package/Shaders/DistantTree.hlsl b/package/Shaders/DistantTree.hlsl index c2f6b282b..40b3f40dc 100644 --- a/package/Shaders/DistantTree.hlsl +++ b/package/Shaders/DistantTree.hlsl @@ -215,26 +215,26 @@ PS_OUTPUT main(PS_INPUT input) float dirShadow = 1; # if defined(SCREEN_SPACE_SHADOWS) - dirShadow = ScreenSpaceShadows::GetScreenSpaceShadow(input.Position, screenUV, screenNoise, viewPosition, eyeIndex); + dirShadow = ScreenSpaceShadows::GetScreenSpaceShadow(input.Position.xyz, screenUV, screenNoise, viewPosition, eyeIndex); # endif # if defined(TERRAIN_SHADOWS) if (dirShadow > 0.0) { - float terrainShadow = TerrainShadows::GetTerrainShadow(input.WorldPosition.xyz + CameraPosAdjust[eyeIndex], length(input.WorldPosition.xyz), SampDiffuse); + float terrainShadow = TerrainShadows::GetTerrainShadow(input.WorldPosition.xyz + CameraPosAdjust[eyeIndex].xyz, length(input.WorldPosition.xyz), SampDiffuse); dirShadow = min(dirShadow, terrainShadow); } # endif # if defined(CLOUD_SHADOWS) if (dirShadow > 0.0) { - dirShadow *= CloudShadows::GetCloudShadowMult(input.WorldPosition, SampDiffuse); + dirShadow *= CloudShadows::GetCloudShadowMult(input.WorldPosition.xyz, SampDiffuse); } # endif float3 diffuseColor = DirLightColorShared.xyz * dirShadow; - float3 ddx = ddx_coarse(input.WorldPosition); - float3 ddy = ddy_coarse(input.WorldPosition); + float3 ddx = ddx_coarse(input.WorldPosition.xyz); + float3 ddy = ddy_coarse(input.WorldPosition.xyz); float3 normal = normalize(cross(ddx, ddy)); # if !defined(SSGI) @@ -253,8 +253,8 @@ PS_OUTPUT main(PS_INPUT input) psout.Albedo = float4(baseColor.xyz, 1); psout.Masks = float4(0, 0, 1, 0); # else - float3 ddx = ddx_coarse(input.WorldPosition); - float3 ddy = ddy_coarse(input.WorldPosition); + float3 ddx = ddx_coarse(input.WorldPosition.xyz); + float3 ddy = ddy_coarse(input.WorldPosition.xyz); float3 normal = normalize(cross(ddx, ddy)); float3 color = baseColor.xyz * (DiffuseColor.xyz + AmbientColor.xyz); diff --git a/package/Shaders/Effect.hlsl b/package/Shaders/Effect.hlsl index 137b85beb..b88cd0b6d 100644 --- a/package/Shaders/Effect.hlsl +++ b/package/Shaders/Effect.hlsl @@ -93,7 +93,7 @@ struct VS_OUTPUT cbuffer VS_PerFrame : register(b12) { # if !defined(VR) - row_major float4x3 ScreenProj[1] : packoffset(c0); + row_major float4x4 ScreenProj[1] : packoffset(c0); row_major float4x4 ViewProj[1] : packoffset(c8); # if defined(SKINNED) float3 BonesPivot[1] : packoffset(c40); @@ -102,7 +102,7 @@ cbuffer VS_PerFrame : register(b12) # endif // MOTIONVECTORS_NORMALS # endif // SKINNED # else - row_major float4x3 ScreenProj[2] : packoffset(c0); + row_major float4x4 ScreenProj[2] : packoffset(c0); row_major float4x4 ViewProj[2] : packoffset(c16); # if defined(SKINNED) float3 BonesPivot[2] : packoffset(c80); @@ -608,7 +608,7 @@ PS_OUTPUT main(PS_INPUT input) float3 propertyColor = PropertyColor.xyz; # if defined(LIGHTING) - propertyColor = GetLightingColor(input.MSPosition, input.WorldPosition, input.Position, eyeIndex); + propertyColor = GetLightingColor(input.MSPosition.xyz, input.WorldPosition.xyz, input.Position.xyzw, eyeIndex); # if defined(LIGHT_LIMIT_FIX) uint lightCount = 0; diff --git a/package/Shaders/ISHDR.hlsl b/package/Shaders/ISHDR.hlsl index 160603ac1..61b4b1c90 100644 --- a/package/Shaders/ISHDR.hlsl +++ b/package/Shaders/ISHDR.hlsl @@ -119,7 +119,7 @@ PS_OUTPUT main(PS_INPUT input) float blendedLuminance = Color::RGBToLuminance(blendedColor); - float3 linearColor = Cinematic.w * lerp(lerp(blendedLuminance, float4(blendedColor, 1), Cinematic.x), blendedLuminance * Tint, Tint.w); + float3 linearColor = Cinematic.w * lerp(lerp(blendedLuminance, float4(blendedColor, 1), Cinematic.x), blendedLuminance * Tint, Tint.w).xyz; // Contrast modified to fix crushed shadows linearColor = pow(abs(linearColor) / avgValue.x, Cinematic.z) * avgValue.x * sign(linearColor); diff --git a/package/Shaders/ISSAOCameraZ.hlsl b/package/Shaders/ISSAOCameraZ.hlsl index f0fddcd92..9742ac891 100644 --- a/package/Shaders/ISSAOCameraZ.hlsl +++ b/package/Shaders/ISSAOCameraZ.hlsl @@ -24,7 +24,7 @@ PS_OUTPUT main(PS_INPUT input) PS_OUTPUT psout; float2 screenPosition = FrameBuffer::GetDynamicResolutionAdjustedScreenPosition(input.TexCoord); - float4 depth = DepthTex.Sample(DepthSampler, screenPosition).x; + float depth = DepthTex.Sample(DepthSampler, screenPosition).x; psout.ClippedDepth = clamp(g_ClipInfos.x / (g_ClipInfos.y * depth + g_ClipInfos.z), 0, g_ClipInfos.w); diff --git a/package/Shaders/ISWaterDisplacement.hlsl b/package/Shaders/ISWaterDisplacement.hlsl index 9b4f090e7..9853d10b3 100644 --- a/package/Shaders/ISWaterDisplacement.hlsl +++ b/package/Shaders/ISWaterDisplacement.hlsl @@ -154,7 +154,7 @@ PS_OUTPUT main(PS_INPUT input) # elif defined(HEIGHTMAP_RAIN) psout.Color = GetHeight(input, RainVars); # elif defined(HEIGHTMAP_WADING) - psout.Color = GetHeight(input, WadingVars); + psout.Color = GetHeight(input, WadingVars.xyz); # endif return psout; diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index 60e0a5159..a4f9f25f2 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -163,7 +163,7 @@ cbuffer VS_PerFrame : register(b12) float3 PreviousBonesPivot[1] : packoffset(c41); # endif // SKINNED # else - row_major float4x4 ScreenProj[2] : packoffset(c0); + row_major float3x3 ScreenProj[2] : packoffset(c0); row_major float4x4 ViewProj[2] : packoffset(c16); # if defined(SKINNED) float3 BonesPivot[2] : packoffset(c80); @@ -1228,7 +1228,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace } if (extendedMaterialSettings.EnableShadows && (parallaxShadowQuality > 0.0f || extendedMaterialSettings.ExtendShadows)) { # if defined(TRUE_PBR) - sh0 = ExtendedMaterials::GetTerrainHeight(input, uv, mipLevels, displacementParams, parallaxShadowQuality, input.LandBlendWeights1, input.LandBlendWeights2, weights); + sh0 = ExtendedMaterials::GetTerrainHeight(input, uv, mipLevels, displacementParams, parallaxShadowQuality, input.LandBlendWeights1, input.LandBlendWeights2.xy, weights); # else sh0 = ExtendedMaterials::GetTerrainHeight(input, uv, mipLevels, displacementParams, parallaxShadowQuality, weights); # endif @@ -2231,7 +2231,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace CharacterLightParams.y * saturate(dot(float2(0.164398998, -0.986393988), modelNormal.yz)); float charLightColor = min(CharacterLightParams.w, max(0, CharacterLightParams.z * TexCharacterLightProjNoiseSampler.Sample(SampCharacterLightProjNoiseSampler, baseShadowUV).x)); # if defined(TRUE_PBR) - charLightColor = Color::GammaToLinear(charLightColor) / Color::LightPreMult; + charLightColor = Color::GammaToLinear(charLightColor).x / Color::LightPreMult; # endif diffuseColor += (charLightMul * charLightColor).xxx; } @@ -2506,7 +2506,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace { pbrWeight = 1 - lodLandBlendFactor; - float3 litLodLandColor = vertexColor * lodLandColor * lodLandFadeFactor * lodLandDiffuseColor; + float3 litLodLandColor = vertexColor * lodLandColor.xyz * lodLandFadeFactor * lodLandDiffuseColor; color.xyz = lerp(color.xyz, litLodLandColor, lodLandBlendFactor); # if defined(DEFERRED) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index b64f54456..e3f9e527d 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -438,7 +438,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace # else float4 specColor = TexNormalSampler.Sample(SampNormalSampler, input.TexCoord.xy); # endif - float dirShadowColor = !InInterior ? TexShadowMaskSampler.Load(int3(input.HPosition.xy, 0)) : 1.0; + float dirShadowColor = !InInterior ? TexShadowMaskSampler.Load(int3(input.HPosition.xy, 0)).r : 1.0; uint eyeIndex = Stereo::GetEyeIndexPS(input.HPosition, VPOSOffset); psout.MotionVectors = GetSSMotionVector(input.WorldPosition, input.PreviousWorldPosition, eyeIndex); @@ -513,7 +513,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace if (dirShadowColor > 0.0) { if (dirLightAngle > 0.0) { # if defined(SCREEN_SPACE_SHADOWS) - dirDetailShadow = ScreenSpaceShadows::GetScreenSpaceShadow(input.HPosition, screenUV, screenNoise, viewPosition, eyeIndex); + dirDetailShadow = ScreenSpaceShadows::GetScreenSpaceShadow(input.HPosition.xyz, screenUV, screenNoise, viewPosition, eyeIndex); # endif // SCREEN_SPACE_SHADOWS } @@ -667,7 +667,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace psout.Diffuse = float4(diffuseColor, 1); } # else - psout.Diffuse.xyz = float4(diffuseColor, 1); + psout.Diffuse.xyz = diffuseColor; # endif float3 normalVS = normalize(FrameBuffer::WorldToView(normal, false, eyeIndex)); diff --git a/package/Shaders/Utility.hlsl b/package/Shaders/Utility.hlsl index b7bb610c9..ae9be6655 100644 --- a/package/Shaders/Utility.hlsl +++ b/package/Shaders/Utility.hlsl @@ -385,7 +385,7 @@ float GetPoissonDiskFilteredShadowVisibility(float noise, float2x2 rotationMatri sampleOffset *= 1.5; # if defined(RENDER_SHADOWMASKDPB) - float2 sampleUV = sampleOffset + baseUV; + float2 sampleUV = sampleOffset + baseUV.xy; baseUV.z += noise; @@ -516,7 +516,7 @@ PS_OUTPUT main(PS_INPUT input) TexStencilSampler.GetDimensions(0, stencilDimensions.x, stencilDimensions.y, stencilDimensions.z); stencilValue = TexStencilSampler.Load(float3(stencilDimensions.xy * depthUv, 0)).x; # endif - depthUv = Stereo::ConvertFromStereoUV(depthUv * DynamicResolutionParams2, eyeIndex); + depthUv = Stereo::ConvertFromStereoUV(depthUv * DynamicResolutionParams2.xy, eyeIndex); float4 positionCS = float4(2 * float2(depthUv.x, -depthUv.y + 1) - 1, depth, 1); float4 positionMS = mul(CameraViewProjInverse[eyeIndex], positionCS); positionMS.xyz = positionMS.xyz / positionMS.w; @@ -670,7 +670,7 @@ PS_OUTPUT main(PS_INPUT input) shadowColor.xyzw = fadeFactor * shadowVisibility; # elif defined(RENDER_SHADOWMASKDPB) - float3 positionLS = mul(transpose(ShadowMapProj[eyeIndex][0]), float4(positionMS.xyz, 1)); + float3 positionLS = mul(transpose(ShadowMapProj[eyeIndex][0]), float4(positionMS.xyz, 1)).xyz; bool lowerHalf = positionLS.z * 0.5 + 0.5 < 0; float3 normalizedPositionLS = normalize(positionLS); diff --git a/package/Shaders/Water.hlsl b/package/Shaders/Water.hlsl index 9808e1ef8..cad900622 100644 --- a/package/Shaders/Water.hlsl +++ b/package/Shaders/Water.hlsl @@ -556,7 +556,7 @@ float3 GetWaterSpecularColor(PS_INPUT input, float3 normal, float3 viewDirection sh2 specularLobe = Skylighting::fauxSpecularLobeSH(normal, -viewDirection, 0.0); float skylightingSpecular = shFuncProductIntegral(skylighting, specularLobe); - skylightingSpecular = lerp(1.0, skylightingSpecular, Skylighting::getFadeOutFactor(input.WPosition)); + skylightingSpecular = lerp(1.0, skylightingSpecular, Skylighting::getFadeOutFactor(input.WPosition.xyz)); skylightingSpecular = Skylighting::mixSpecular(skylightingSettings, skylightingSpecular); float3 specularIrradiance = 1; @@ -605,7 +605,7 @@ float3 GetWaterSpecularColor(PS_INPUT input, float3 normal, float3 viewDirection float4 ssrReflectionColorRaw = RawSSRReflectionTex.Sample(RawSSRReflectionSampler, ssrReflectionUvDR); // calculate fog on reflection - float depth = DepthTex.Load(int3(ssrReflectionUvDR * BufferDim.xy, 0)); + float depth = DepthTex.Load(int3(ssrReflectionUvDR * BufferDim.xy, 0)).r; float fogDensity = depth == 0 ? 0.f : pow(saturate((-depth * FogParam.z + FogParam.z) / FogParam.w), FogNearColor.w); float3 fogColor = lerp(FogNearColor.xyz, FogFarColor.xyz, fogDensity); @@ -728,7 +728,7 @@ float3 GetWaterDiffuseColor(PS_INPUT input, float3 normal, float3 viewDirection, sh2 skylightingSH = Skylighting::sample(skylightingSettings, SkylightingProbeArray, positionMSSkylight, float3(0, 0, 1)); float skylighting = shUnproject(skylightingSH, float3(0, 0, 1)); - skylighting = lerp(1.0, skylighting, Skylighting::getFadeOutFactor(input.WPosition)); + skylighting = lerp(1.0, skylighting, Skylighting::getFadeOutFactor(input.WPosition.xyz)); float3 refractionDiffuseColorSkylight = Skylighting::mixDiffuse(skylightingSettings, skylighting); refractionDiffuseColorSkylight = Color::LinearToGamma(Color::GammaToLinear(refractionDiffuseColor) * refractionDiffuseColorSkylight);