Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
b3b810b
feat: simpler effect shadows
doodlum Jan 26, 2026
d03c949
chore: remove getwatershadow
doodlum Jan 26, 2026
015c016
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 26, 2026
3dd8cbf
fix: fix sampling
doodlum Jan 27, 2026
b9b04ef
feat: optimise shadow samples further
doodlum Jan 28, 2026
429754c
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 28, 2026
233736c
Merge branch 'dev' into simple-effect-shadows
doodlum Jan 28, 2026
fdb4987
chore: remove lighting mult
doodlum Jan 28, 2026
2d71569
fix: make ai happy
doodlum Jan 28, 2026
8ff9162
fix: use gatherred
doodlum Jan 28, 2026
57aa59c
chore: remove watercolor variable
doodlum Jan 28, 2026
8f00c7f
chore: use skylighting specular in water
doodlum Jan 28, 2026
20ffbb1
chore: simplify math
doodlum Jan 28, 2026
9a45f8b
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 28, 2026
d5329f5
Merge branch 'dev' into simple-effect-shadows
doodlum Jan 28, 2026
17465ae
fix: fix skylighting lobe
doodlum Jan 28, 2026
227d23c
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Jan 28, 2026
38042a6
chore: minor tweaks
doodlum Jan 28, 2026
3149c7b
chore: minor cleanup
doodlum Jan 28, 2026
b2de122
fix: make rabbit happy
doodlum Jan 28, 2026
fb6c66a
chore: cleaner code
doodlum Jan 28, 2026
b3d117d
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 28, 2026
374a0c8
fix: fix shader error
doodlum Jan 28, 2026
302872b
chore: optimise sampling
doodlum Jan 28, 2026
01fef2a
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 28, 2026
f8eac98
Update src/Hooks.cpp
doodlum Jan 28, 2026
2160b5b
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 28, 2026
b5cade5
fix: fix compile issue
doodlum Jan 28, 2026
7abdb94
chore: minor optimisations
doodlum Jan 28, 2026
09ffee3
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 28, 2026
3188479
chore: clean up macros
doodlum Jan 28, 2026
6ffed08
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Jan 28, 2026
50a9516
chore: cleanup
doodlum Jan 28, 2026
d45b5fa
fix: fix water compiler errors
doodlum Jan 28, 2026
5ea5715
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 28, 2026
026f525
fix: fix terrain shadows compile error
doodlum Jan 28, 2026
3773a33
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Jan 28, 2026
dfc5a44
fix: fix compile error
doodlum Jan 29, 2026
2709ffc
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 29, 2026
c015b40
fix: terrain shadow fixes
doodlum Jan 29, 2026
93372fc
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Jan 29, 2026
61e6bec
feat: sky static lighting
doodlum Jan 29, 2026
1e92d25
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 29, 2026
61372c4
Merge branch 'dev' into simple-effect-shadows
doodlum Jan 29, 2026
994c772
refactor: cleanup
doodlum Jan 29, 2026
92dbb89
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Jan 29, 2026
e002dc5
chore: cleanup
doodlum Jan 29, 2026
3ddff54
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 29, 2026
3a15227
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Jan 29, 2026
bd5e34a
chore: improvements
doodlum Jan 29, 2026
19e3f03
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 29, 2026
1aefbb5
chore: more optimisations
doodlum Jan 29, 2026
4cf6308
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Jan 29, 2026
5b6bbec
Update package/Shaders/Common/ShadowSampling.hlsli
doodlum Jan 29, 2026
82f5e84
Merge branch 'dev' into simple-effect-shadows
doodlum Jan 29, 2026
148f831
fix: fix compiler error
doodlum Jan 29, 2026
9c89bd6
fix: fix color space
doodlum Jan 29, 2026
ff066fd
fix: fix compiler warning
doodlum Jan 30, 2026
eb115a0
chore: reduce noise
doodlum Jan 30, 2026
a8a461a
chore: optimise sky static shadow
doodlum Jan 30, 2026
7a768f6
Merge branch 'dev' into simple-effect-shadows
alandtse Feb 2, 2026
3c0b2a1
fix(unified-water): fix normal data for correct lod texture
davo0411 Feb 2, 2026
d98a4b4
chore: optimise mip level
doodlum Feb 2, 2026
3e63452
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 2, 2026
ea81731
feat: third cascade
doodlum Feb 2, 2026
f66f8fa
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Feb 2, 2026
edf6714
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 2, 2026
92a1a59
chore: auto set shadow settings
doodlum Feb 2, 2026
99859f8
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Feb 2, 2026
2029401
chore: optimise cascade selection
doodlum Feb 2, 2026
64160e9
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 2, 2026
84c6a85
chore: further optimisation
doodlum Feb 2, 2026
c16adac
Merge branch 'simple-effect-shadows' of https://github.com/doodlum/sk…
doodlum Feb 2, 2026
2c1fdd2
chore: less blur
doodlum Feb 2, 2026
a77cac3
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 2, 2026
57f4d5b
fix: fix compiler error
doodlum Feb 2, 2026
58d874a
chore: revert some changes
doodlum Feb 2, 2026
672734b
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Info]
Version = 1-0-1
Version = 1-0-2
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ groupshared float2 g_shadowHeight[NTHREADS];
float2 threadUV = rawThreadUV - floor(rawThreadUV); // wraparound
float2 threadPxCoord = threadUV * dims;

float2 pastHeights = 0.0f.xx;
float2 pastHeights = 0.0;
if (isValid) {
pastHeights = RWTexShadowHeights[uint2(threadPxCoord)];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace TerrainShadows

float GetTerrainZ(float norm_z)
{
return lerp(SharedData::terraOccSettings.ZRange.x, SharedData::terraOccSettings.ZRange.y, norm_z) - 1024;
return lerp(SharedData::terraOccSettings.ZRange.x, SharedData::terraOccSettings.ZRange.y, norm_z) - 256;
}

float2 GetTerrainZ(float2 norm_z)
Expand Down
7 changes: 4 additions & 3 deletions package/Shaders/Common/Permutation.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ namespace Permutation
static const uint InWorld = (1 << 0);
static const uint InReflection = (1 << 1);
static const uint IsBeastRace = (1 << 2);
static const uint EffectShadows = (1 << 3);
static const uint IsTree = (1 << 4);
static const uint GrassSphereNormal = (1 << 5);
static const uint IsTree = (1 << 3);
static const uint GrassSphereNormal = (1 << 4);
}

namespace ExtraFeatureFlags
Expand All @@ -81,6 +80,8 @@ namespace Permutation
uint PixelShaderDescriptor;
uint ExtraShaderDescriptor;
uint ExtraFeatureDescriptor;

float EffectRadius;
};

}
Expand Down
252 changes: 171 additions & 81 deletions package/Shaders/Common/ShadowSampling.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@
#include "Common/Math.hlsli"
#include "Common/Random.hlsli"
#include "Common/SharedData.hlsli"
#include "Common/Color.hlsli"

#if defined(TERRAIN_SHADOWS)
# include "TerrainShadows/TerrainShadows.hlsli"
#endif

#if defined(CLOUD_SHADOWS)
# include "CloudShadows/CloudShadows.hlsli"
#endif

#if defined(IBL)
# include "IBL/IBL.hlsli"
#endif

namespace ShadowSampling
{

Texture2DArray<float4> SharedShadowMap : register(t18);
Texture2D<float4> SharedShadowMap : register(t18);

struct ShadowData
{
Expand All @@ -29,57 +41,130 @@ namespace ShadowSampling

StructuredBuffer<ShadowData> SharedShadowData : register(t19);

float GetWorldShadow(float3 positionWS, float3 offset, uint eyeIndex)
{
if (SharedData::InInterior || SharedData::HideSky)
return 1.0;

float worldShadow = 1.0;
#if defined(TERRAIN_SHADOWS)
worldShadow = TerrainShadows::GetTerrainShadow(positionWS + offset, LinearSampler);
#endif

#if defined(CLOUD_SHADOWS)
if (!SharedData::InMapMenu)
worldShadow *= CloudShadows::GetCloudShadowMult(positionWS, LinearSampler);
Comment thread
doodlum marked this conversation as resolved.
#endif

return worldShadow;
}

float GetShadowDepth(float3 positionWS, uint eyeIndex)
{
float4 positionCSShifted = mul(FrameBuffer::CameraViewProj[eyeIndex], float4(positionWS, 1));
return positionCSShifted.z / positionCSShifted.w;
}

float Get3DFilteredShadow(float3 positionWS, float3 viewDirection, float2 screenPosition, uint eyeIndex)
float Get3DFilteredShadow(float3 positionWS, float3 viewDirection, float2 screenPosition, uint eyeIndex, float depth)
{
ShadowData sD = SharedShadowData[0];
static const uint sampleCount8 = 8;
static const float rcpSampleCount8 = 1.0 / float(sampleCount8);
static const uint sampleCount8Minus1 = sampleCount8 - 1;

float fadeFactor = 1.0 - pow(saturate(dot(positionWS, positionWS) / sD.ShadowLightParam.z), 8);
uint sampleCount = ceil(8.0 * (1.0 - saturate(length(positionWS) / sqrt(sD.ShadowLightParam.z))));
static const uint sampleCount16 = 16;
static const float rcpSampleCount16 = 1.0 / float(sampleCount16);
static const uint sampleCount16Minus1 = sampleCount16 - 1;

if (sampleCount == 0)
return 1.0;
float noise = Random::InterleavedGradientNoise(screenPosition, SharedData::FrameCount);
float noiseTransform = noise * 2.0 - 1.0;
float2 rotation;
sincos(Math::TAU * noise, rotation.y, rotation.x);
float2x2 rotationMatrix = float2x2(rotation.x, rotation.y, -rotation.y, rotation.x);

float screenDepth = SharedData::GetScreenDepth(depth);
float objectDepth = length(positionWS);
float maxDistance = max(0, screenDepth - objectDepth);

#if defined(EFFECT)
// Enough for non-billboards + enough for Sovngarde fog
float viewRayLength = min(Permutation::EffectRadius * 0.1, 128);
float3 startPosition = positionWS - viewDirection * viewRayLength;
float3 endPosition = positionWS + viewDirection * min(viewRayLength, maxDistance);
#elif defined(UNDERWATER)
// Enough for Eastmarch water
float viewRayLength = 128.0;
float3 startPosition = positionWS - viewDirection * viewRayLength;
float3 endPosition = positionWS;
#else
// Enough for Eastmarch water
float viewRayLength = 128.0;
float3 startPosition = positionWS;
float3 endPosition = positionWS + viewDirection * min(viewRayLength, maxDistance);
#endif

float worldShadow = 0;
for(uint i = 0; i < sampleCount8; i++){
uint noisyIndex = uint((float(i) + sampleCount8 * noise) % sampleCount8);
float t = (float(sampleCount8Minus1) - float(noisyIndex)) * rcpSampleCount8;
float tSample = t + noiseTransform * rcpSampleCount8;

float3 samplePositionWS = lerp(startPosition, endPosition, tSample);
samplePositionWS.xy += mul(Random::SpiralSampleOffsets8[i], rotationMatrix) * viewRayLength;
samplePositionWS.z += length(Random::SpiralSampleOffsets8[i]);

worldShadow += ShadowSampling::GetWorldShadow(samplePositionWS, FrameBuffer::CameraPosAdjust[eyeIndex].xyz, eyeIndex);
}

if (worldShadow == 0.0)
return 0.0;

float rcpSampleCount = rcp((float)sampleCount);
worldShadow *= rcpSampleCount8;

uint3 seed = Random::pcg3d(uint3(screenPosition.xy, screenPosition.x * Math::PI));
float shadowMapDepth = GetShadowDepth(positionWS, eyeIndex);

float2 compareValue;
compareValue.x = mul(transpose(sD.ShadowMapProj[eyeIndex][0]), float4(positionWS, 1)).z - 0.01;
compareValue.y = mul(transpose(sD.ShadowMapProj[eyeIndex][1]), float4(positionWS, 1)).z - 0.01;
ShadowData sD = SharedShadowData[0];

// Early out beyond cascade 2
if (sD.EndSplitDistances.w < shadowMapDepth)
return worldShadow;

// Precompute cascade data
float cascade1Probability = saturate((shadowMapDepth - sD.StartSplitDistances.y) / (sD.EndSplitDistances.x - sD.StartSplitDistances.y));

float compareValues[2];
float sampleRadii[2];
float3 positionsLS[2];
float3 viewOffsetsLS[2];
for (uint cascadeIdx = 0; cascadeIdx < 2; cascadeIdx++) {
compareValues[cascadeIdx] = mul(transpose(sD.ShadowMapProj[eyeIndex][cascadeIdx]), float4(positionWS, 1)).z - sD.AlphaTestRef[1 + cascadeIdx];
sampleRadii[cascadeIdx] = sD.ShadowSampleParam.z * rcp(1 + cascadeIdx) * 2.0;
positionsLS[cascadeIdx] = mul(transpose(sD.ShadowMapProj[eyeIndex][cascadeIdx]), float4(startPosition, 1));
viewOffsetsLS[cascadeIdx] = mul(transpose(sD.ShadowMapProj[eyeIndex][cascadeIdx]), float4(endPosition, 1));
}

float shadow = 0.0;
if (sD.EndSplitDistances.z >= GetShadowDepth(positionWS, eyeIndex)) {
for (uint i = 0; i < sampleCount; i++) {
float3 rnd = Random::R3Modified(i + SharedData::FrameCount * sampleCount, seed / 4294967295.f);

// https://stats.stackexchange.com/questions/8021/how-to-generate-uniformly-distributed-points-in-the-3-d-unit-ball
float phi = rnd.x * Math::TAU;
float cos_theta = rnd.y * 2 - 1;
float sin_theta = sqrt(1 - cos_theta);
float r = rnd.z;
float4 sincos_phi;
sincos(phi, sincos_phi.y, sincos_phi.x);
float3 sampleOffset = viewDirection * (float(i) - float(sampleCount) * 0.5) * 64 * rcpSampleCount;
sampleOffset += float3(r * sin_theta * sincos_phi.x, r * sin_theta * sincos_phi.y, r * cos_theta) * 64;

uint cascadeIndex = sD.EndSplitDistances.x < GetShadowDepth(positionWS.xyz + viewDirection * (sampleOffset.x + sampleOffset.y), eyeIndex); // Stochastic cascade sampling

float3 positionLS = mul(transpose(sD.ShadowMapProj[eyeIndex][cascadeIndex]), float4(positionWS + sampleOffset, 1));

float4 depths = SharedShadowMap.GatherRed(LinearSampler, float3(saturate(positionLS.xy), cascadeIndex), 0);
shadow += dot(depths > compareValue[cascadeIndex], 0.25);
}
} else {
shadow = 1.0;
for (uint k = 0; k < sampleCount16; k++) {
uint noisyIndex = (k + uint(sampleCount16 * noise)) % sampleCount16;
float t = float(sampleCount16Minus1 - noisyIndex) * rcpSampleCount16;

// Probabilistically select cascade (0 or 1 within the pair)
uint cascadeIndex = uint(frac(t + noise) < cascade1Probability);

// Offset along view ray with optimised sample pattern
float tSample = t + noiseTransform * rcpSampleCount16;
float3 sampledPositionLS = lerp(positionsLS[cascadeIndex], viewOffsetsLS[cascadeIndex], tSample);

// Blur shadow with poisson disc
sampledPositionLS.xy += mul(Random::PoissonSampleOffsets16[k], rotationMatrix) * sampleRadii[cascadeIndex];

// Average 4 shadow samples for improved quality
float4 depths = SharedShadowMap.SampleLevel(LinearSampler, saturate(sampledPositionLS.xy), 1u - cascadeIndex);
float4 shadowVisibilities = float4(depths > compareValues[cascadeIndex]);
shadow += shadowVisibilities.x + shadowVisibilities.y + shadowVisibilities.z + shadowVisibilities.w;
}

return lerp(1.0, shadow * rcpSampleCount, fadeFactor);
float fadeFactor = 1.0 - pow(saturate(dot(positionWS, positionWS) / sD.ShadowLightParam.z), 8);
return worldShadow * lerp(1.0, shadow * rcpSampleCount16 * 0.25, fadeFactor);
}

float Get2DFilteredShadowCascade(float noise, float2x2 rotationMatrix, float sampleOffsetScale, float2 baseUV, float cascadeIndex, float compareValue, uint eyeIndex)
Expand All @@ -90,16 +175,14 @@ namespace ShadowSampling

float visibility = 0.0;

#if defined(WATER)
sampleOffsetScale *= 2.0;
#endif
sampleOffsetScale *= 4.0;

for (uint sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) {
float2 sampleOffset = mul(Random::PoissonSampleOffsets16[sampleIndex], rotationMatrix);

float2 sampleUV = layerIndexRcp * sampleOffset * sampleOffsetScale + baseUV;

float4 depths = SharedShadowMap.GatherRed(LinearSampler, float3(saturate(sampleUV), cascadeIndex), 0);
float4 depths = SharedShadowMap.SampleLevel(LinearSampler, saturate(sampleUV), 1 - cascadeIndex);
visibility += dot(depths > compareValue, 0.25);
}

Expand Down Expand Up @@ -142,37 +225,6 @@ namespace ShadowSampling
return 1.0;
}

float GetWorldShadow(float3 positionWS, float3 offset, uint eyeIndex)
{
if (SharedData::InInterior || SharedData::HideSky)
return 1.0;

float worldShadow = 1.0;
#if defined(TERRAIN_SHADOWS)
worldShadow = TerrainShadows::GetTerrainShadow(positionWS + offset, LinearSampler);
#endif

#if defined(CLOUD_SHADOWS)
if (!SharedData::InMapMenu)
worldShadow *= CloudShadows::GetCloudShadowMult(positionWS, LinearSampler);
#endif

return worldShadow;
}

float GetEffectShadow(float3 worldPosition, float3 viewDirection, float2 screenPosition, uint eyeIndex, out bool isWorldShadow)
{
isWorldShadow = false;
float worldShadow = GetWorldShadow(worldPosition, FrameBuffer::CameraPosAdjust[eyeIndex].xyz, eyeIndex);
if (worldShadow != 0.0) {
float shadow = Get3DFilteredShadow(worldPosition, viewDirection, screenPosition, eyeIndex);
isWorldShadow = shadow >= worldShadow;
return min(worldShadow, shadow);
}
isWorldShadow = true;
return worldShadow;
}

float GetLightingShadow(float noise, float3 worldPosition, uint eyeIndex)
{
float2 rotation;
Expand All @@ -181,18 +233,56 @@ namespace ShadowSampling
return Get2DFilteredShadow(noise, rotationMatrix, worldPosition, eyeIndex);
}

float GetWaterShadow(float noise, float3 worldPosition, uint eyeIndex)
#if defined(SKYLIGHTING) && !defined(INTERIOR)
void ExtractLighting(float3 inputColor, out float3 dirColor, out float3 ambientColor, float skylightingDiffuse)
#else
void ExtractLighting(float3 inputColor, out float3 dirColor, out float3 ambientColor)
#endif
{
float worldShadow = GetWorldShadow(worldPosition, FrameBuffer::CameraPosAdjust[eyeIndex].xyz, eyeIndex);
if (worldShadow != 0.0) {
float2 rotation;
sincos(Math::TAU * noise, rotation.y, rotation.x);
float2x2 rotationMatrix = float2x2(rotation.x, rotation.y, -rotation.y, rotation.x);
float shadow = Get2DFilteredShadow(noise, rotationMatrix, worldPosition, eyeIndex);
return worldShadow * shadow;
float3 ambientColorAmb = max(0, mul(SharedData::DirectionalAmbient, float4(0, 0, 1, 1)));

# if defined(IBL)
if (SharedData::iblSettings.EnableDiffuseIBL && (!SharedData::InInterior || SharedData::iblSettings.EnableInterior)) {
ambientColorAmb *= SharedData::iblSettings.DALCAmount;
# if defined(SKYLIGHTING) && !defined(INTERIOR)
float3 iblColor = Color::Saturation(ImageBasedLighting::GetIBLColor(float3(0, 0, -1), skylightingDiffuse), SharedData::iblSettings.IBLSaturation) * SharedData::iblSettings.DiffuseIBLScale;
# else
float3 iblColor = Color::Saturation(ImageBasedLighting::GetIBLColor(float3(0, 0, -1)), SharedData::iblSettings.IBLSaturation) * SharedData::iblSettings.DiffuseIBLScale;
# endif
ambientColorAmb += Color::IrradianceToGamma(iblColor);
}
# endif

float llDirLightMult = (SharedData::linearLightingSettings.enableLinearLighting && !SharedData::linearLightingSettings.isDirLightLinear) ? SharedData::linearLightingSettings.dirLightMult : 1.0f;
float3 dirLightColorDir = Color::DirectionalLight(SharedData::DirLightColor.xyz / max(llDirLightMult, 1e-5), SharedData::linearLightingSettings.isDirLightLinear) * llDirLightMult;

{
float maxScale = 1.0;
if (ambientColorAmb.x > 0.0)
maxScale = min(maxScale, inputColor.x / ambientColorAmb.x);
if (ambientColorAmb.y > 0.0)
maxScale = min(maxScale, inputColor.y / ambientColorAmb.y);
if (ambientColorAmb.z > 0.0)
maxScale = min(maxScale, inputColor.z / ambientColorAmb.z);
ambientColorAmb *= maxScale;
}

return worldShadow;
{
float maxScale = 1.0;
if (dirLightColorDir.x > 0.0)
maxScale = min(maxScale, inputColor.x / dirLightColorDir.x);
if (dirLightColorDir.y > 0.0)
maxScale = min(maxScale, inputColor.y / dirLightColorDir.y);
if (dirLightColorDir.z > 0.0)
maxScale = min(maxScale, inputColor.z / dirLightColorDir.z);
dirLightColorDir *= maxScale;
}

float3 dirLightColorAmb = max(0.0, inputColor - ambientColorAmb);
float3 ambientColorDir = max(0.0, inputColor - dirLightColorDir);

dirColor = lerp(dirLightColorAmb, dirLightColorDir, 0.0);
ambientColor = lerp(ambientColorAmb, ambientColorDir, 0.0);
}
}

Expand Down
8 changes: 0 additions & 8 deletions package/Shaders/DistantTree.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,6 @@ const static float DepthOffsets[16] = {
# include "ScreenSpaceShadows/ScreenSpaceShadows.hlsli"
# endif

# if defined(TERRAIN_SHADOWS)
# include "TerrainShadows/TerrainShadows.hlsli"
# endif

# if defined(CLOUD_SHADOWS)
# include "CloudShadows/CloudShadows.hlsli"
# endif

# if defined(IBL)
# include "IBL/IBL.hlsli"
# endif
Expand Down
Loading
Loading