Skip to content

Commit 24df0cf

Browse files
committed
shadows cascades
1 parent 7168326 commit 24df0cf

File tree

14 files changed

+23
-34
lines changed

14 files changed

+23
-34
lines changed

externals/cage

Submodule cage updated 36 files

sources/scenes/game.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <cage-engine/guiBuilder.h>
1212
#include <cage-engine/scene.h>
1313
#include <cage-engine/sceneScreenSpaceEffects.h>
14-
#include <cage-engine/sceneShadowmapFitting.h>
1514
#include <cage-engine/window.h>
1615
#include <cage-simple/engine.h>
1716
#include <cage-simple/fpsCamera.h>
@@ -170,16 +169,6 @@ void update()
170169
sceneReload();
171170
sceneIndexLoaded = sceneIndexCurrent;
172171
}
173-
174-
// update shadowmaps
175-
for (int i = 0; i < directionalLightsCount; i++)
176-
{
177-
ShadowmapFittingConfig cfg;
178-
cfg.assets = engineAssets();
179-
cfg.light = directionalLights[i];
180-
cfg.camera = engineEntities()->get(1);
181-
shadowmapFitting(cfg);
182-
}
183172
}
184173

185174
void actionPrev(input::GuiValue)

sources/simple/cameraEffects.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ void update()
5353
GuiCheckBoxComponent &cb = e->value<GuiCheckBoxComponent>();
5454
enableEffect(ScreenSpaceEffectsFlags::AmbientOcclusion, cb.state == CheckBoxStateEnum::Checked);
5555
}
56-
{ // world radius
56+
{ // rays length
5757
Entity *e = ents->get(baseName + 1);
5858
GuiInputComponent &in = e->value<GuiInputComponent>();
5959
if (in.valid)
60-
eff.ssao.worldRadius = toFloat(in.value);
60+
eff.ssao.raysLength = toFloat(in.value);
6161
}
6262
{ // strength
6363
Entity *e = ents->get(baseName + 2);
6464
GuiInputComponent &in = e->value<GuiInputComponent>();
6565
if (in.valid)
6666
eff.ssao.strength = toFloat(in.value);
6767
}
68-
{ // bias
68+
{ // threshold
6969
Entity *e = ents->get(baseName + 3);
7070
GuiInputComponent &in = e->value<GuiInputComponent>();
7171
if (in.valid)
72-
eff.ssao.bias = toFloat(in.value);
72+
eff.ssao.threshold = toFloat(in.value);
7373
}
7474
{ // power
7575
Entity *e = ents->get(baseName + 4);
@@ -351,9 +351,9 @@ void initializeGui()
351351
table->value<GuiLayoutTableComponent>();
352352
}
353353
sint32 childIndex = 1;
354-
genInputFloat(table, childIndex, baseName, "World radius:", 0.1, 3, 0.05, ScreenSpaceEffectsComponent().ssao.worldRadius);
354+
genInputFloat(table, childIndex, baseName, "Rays length:", 0.1, 3, 0.05, ScreenSpaceEffectsComponent().ssao.raysLength);
355355
genInputFloat(table, childIndex, baseName, "Strength:", 0, 3, 0.1, ScreenSpaceEffectsComponent().ssao.strength);
356-
genInputFloat(table, childIndex, baseName, "Bias:", -0.5, 0.5, 0.01, ScreenSpaceEffectsComponent().ssao.bias);
356+
genInputFloat(table, childIndex, baseName, "Threshold:", -0.5, 0.5, 0.01, ScreenSpaceEffectsComponent().ssao.threshold);
357357
genInputFloat(table, childIndex, baseName, "Power:", 0.1, 2, 0.02, ScreenSpaceEffectsComponent().ssao.power);
358358
genInputInt(table, childIndex, baseName, "Samples:", 1, 128, 1, ScreenSpaceEffectsComponent().ssao.samplesCount);
359359
genInputInt(table, childIndex, baseName, "Blur passes:", 0, 10, 1, ScreenSpaceEffectsComponent().ssao.blurPasses);
@@ -619,6 +619,7 @@ int main(int argc, char *args[])
619619
c.ambientIntensity = 0.05;
620620
c.near = 0.1;
621621
c.far = 100;
622+
c.shadowmapFrustumDepthFraction = 0.5;
622623
e->value<ScreenSpaceEffectsComponent>();
623624
}
624625
{ // skybox
@@ -634,8 +635,9 @@ int main(int argc, char *args[])
634635
e->value<LightComponent>().lightType = LightTypeEnum::Directional;
635636
e->value<ColorComponent>().intensity = 3;
636637
ShadowmapComponent &s = e->value<ShadowmapComponent>();
637-
s.resolution = 2048;
638-
s.directionalWorldSize = 30;
638+
s.resolution = 1024;
639+
s.cascadesPaddingDistance = 20;
640+
s.cascadesSplitLogFactor = 0.6;
639641
}
640642
{ // floor
641643
Entity *e = ents->createAnonymous();

sources/simple/dynamicResolution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int main(int argc, char *args[])
123123
e->value<ColorComponent>().intensity = 4;
124124
ShadowmapComponent &s = e->value<ShadowmapComponent>();
125125
s.resolution = 4096;
126-
s.directionalWorldSize = 30;
126+
s.cascadesPaddingDistance = 30;
127127
}
128128
{ // floor
129129
Entity *e = ents->createAnonymous();

sources/simple/guiInWorld.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int main(int argc, char *args[])
7878
e->value<ColorComponent>().intensity = 3;
7979
ShadowmapComponent &s = e->value<ShadowmapComponent>();
8080
s.resolution = 2048;
81-
s.directionalWorldSize = 30;
81+
s.cascadesPaddingDistance = 30;
8282
}
8383
{ // floor
8484
Entity *e = ents->createAnonymous();

sources/simple/keybinds.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ int main(int argc, char *args[])
173173
e->value<ColorComponent>().intensity = 0.5;
174174
ShadowmapComponent &s = e->value<ShadowmapComponent>();
175175
s.resolution = 4096;
176-
s.directionalWorldSize = 50;
176+
s.cascadesPaddingDistance = 50;
177177
}
178178
{ // floor
179179
Entity *e = ents->createUnique();

sources/simple/lods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int main(int argc, char *args[])
4949
e->value<LightComponent>().lightType = LightTypeEnum::Directional;
5050
ShadowmapComponent &s = e->value<ShadowmapComponent>();
5151
s.resolution = 1024;
52-
s.directionalWorldSize = 20;
52+
s.cascadesPaddingDistance = 20;
5353
}
5454
{ // camera
5555
Entity *e = ents->create(10);

sources/simple/manyLights.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ int main(int argc, char *args[])
109109
e->value<ColorComponent>().color = Vec3(1, 1, 0.5);
110110
ShadowmapComponent &s = e->value<ShadowmapComponent>();
111111
s.resolution = 4096;
112-
s.directionalWorldSize = 20;
112+
s.cascadesPaddingDistance = 20;
113113
}
114114
{ // green floor
115115
Entity *e = ents->create(5);
@@ -148,7 +148,7 @@ int main(int argc, char *args[])
148148
e->value<ColorComponent>() = { Vec3(i == 0, i == 1, i == 2), 3 };
149149
ShadowmapComponent &s = e->value<ShadowmapComponent>();
150150
s.resolution = 4096;
151-
s.directionalWorldSize = 500;
151+
s.cascadesPaddingDistance = 500;
152152
}
153153
// point lights
154154
for (uint32 i = 0; i < 500; i++)

sources/simple/music.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void init()
3737
e->value<LightComponent>().lightType = LightTypeEnum::Directional;
3838
ShadowmapComponent &s = e->value<ShadowmapComponent>();
3939
s.resolution = 4096;
40-
s.directionalWorldSize = 200;
40+
s.cascadesPaddingDistance = 200;
4141
}
4242

4343
{ // floor

sources/simple/performance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void generate()
7171
if (shadowEnabled)
7272
{
7373
ShadowmapComponent &s = e->value<ShadowmapComponent>();
74-
s.directionalWorldSize = 20;
74+
s.cascadesPaddingDistance = 20;
7575
s.resolution = 4096;
7676
}
7777
}

0 commit comments

Comments
 (0)