mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
a setup to mitigate directional artefacts in light
This commit is contained in:
@@ -46,10 +46,10 @@ object PlayerBuilderSigrid {
|
||||
|
||||
p.actorValue[AVKey.INTELLIGENT] = true
|
||||
|
||||
//p.actorValue[AVKey.LUMR] = 0.84
|
||||
//p.actorValue[AVKey.LUMG] = 0.93
|
||||
//p.actorValue[AVKey.LUMB] = 1.37
|
||||
//p.actorValue[AVKey.LUMA] = 1.93
|
||||
p.actorValue[AVKey.LUMR] = 0.84
|
||||
p.actorValue[AVKey.LUMG] = 0.93
|
||||
p.actorValue[AVKey.LUMB] = 1.37
|
||||
p.actorValue[AVKey.LUMA] = 1.93
|
||||
|
||||
p.actorValue[AVKey.BASEDEFENCE] = 141
|
||||
|
||||
@@ -75,20 +75,19 @@ object PlayerBuilderSigrid {
|
||||
|
||||
fun fillTestInventory(inventory: ActorInventory) {
|
||||
val blocks = arrayOf(
|
||||
Block.AIR, Block.DIRT, Block.GLASS_CRUDE,
|
||||
Block.AIR, Block.DIRT, Block.GLASS_CRUDE, Block.GLASS_CLEAN,
|
||||
Block.GRASS, Block.GRAVEL, Block.ICE_MAGICAL, Block.LANTERN,
|
||||
Block.PLANK_BIRCH, Block.PLANK_BLOODROSE, Block.PLANK_EBONY, Block.PLANK_NORMAL,
|
||||
Block.SANDSTONE, Block.SANDSTONE_BLACK, Block.SANDSTONE_GREEN,
|
||||
Block.SANDSTONE_RED, Block.STONE, Block.STONE_BRICKS,
|
||||
Block.STONE_QUARRIED, Block.STONE_TILE_WHITE, Block.TORCH,
|
||||
Block.DAYLIGHT_CAPACITOR, Block.ICE_FRAGILE,
|
||||
Block.ILLUMINATOR_WHITE, Block.ILLUMINATOR_BLACK, Block.ILLUMINATOR_ORANGE,
|
||||
Block.ILLUMINATOR_GREEN, Block.ILLUMINATOR_CYAN, Block.SUNSTONE,
|
||||
Block.SUNSTONE,
|
||||
Block.ORE_COPPER,
|
||||
Block.PLATFORM_STONE, Block.PLATFORM_WOODEN, Block.PLATFORM_BIRCH, Block.PLATFORM_BLOODROSE, Block.PLATFORM_EBONY
|
||||
)
|
||||
) + (Block.ILLUMINATOR_WHITE .. Block.ILLUMINATOR_BLACK).toList()
|
||||
val walls = arrayOf(
|
||||
Block.AIR, Block.DIRT, Block.GLASS_CRUDE,
|
||||
Block.AIR, Block.DIRT, Block.GLASS_CRUDE, Block.GLASS_CLEAN,
|
||||
Block.GRASSWALL, Block.ICE_MAGICAL,
|
||||
Block.PLANK_BIRCH, Block.PLANK_BLOODROSE, Block.PLANK_EBONY, Block.PLANK_NORMAL,
|
||||
Block.SANDSTONE, Block.SANDSTONE_BLACK, Block.SANDSTONE_GREEN,
|
||||
|
||||
@@ -196,7 +196,8 @@ object LightmapRenderer {
|
||||
* | | 3| |↗ | | ↖| |3 | |
|
||||
* `--+-----' `--------' `--------' `-----+--'
|
||||
* round: 1 2 3 4
|
||||
* for all lightmap[y][x]
|
||||
* for all lightmap[y][x], run in this order: 2-3-4-1
|
||||
* for some reason, this setup removes (or mitigates) directional artefacts.
|
||||
*/
|
||||
|
||||
AppLoader.debugTimers["Renderer.Lanterns"] = measureNanoTime {
|
||||
@@ -210,37 +211,37 @@ object LightmapRenderer {
|
||||
// each usually takes 8 000 000..12 000 000 miliseconds total when not threaded
|
||||
|
||||
if (!AppLoader.getConfigBoolean("multithreadedlight")) {
|
||||
// Round 1
|
||||
// Round 2
|
||||
AppLoader.debugTimers["Renderer.Light1"] = measureNanoTime {
|
||||
for (y in for_y_start - overscan_open..for_y_end) {
|
||||
for (y in for_y_end + overscan_open downTo for_y_start) {
|
||||
for (x in for_x_start - overscan_open..for_x_end) {
|
||||
setLight(x, y, calculate(x, y, 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Round 2
|
||||
// Round 3
|
||||
AppLoader.debugTimers["Renderer.Light2"] = measureNanoTime {
|
||||
for (y in for_y_end + overscan_open downTo for_y_start) {
|
||||
for (x in for_x_start - overscan_open..for_x_end) {
|
||||
for (x in for_x_end + overscan_open downTo for_x_start) {
|
||||
setLight(x, y, calculate(x, y, 2))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Round 3
|
||||
// Round 4
|
||||
AppLoader.debugTimers["Renderer.Light3"] = measureNanoTime {
|
||||
for (y in for_y_end + overscan_open downTo for_y_start) {
|
||||
for (y in for_y_start - overscan_open..for_y_end) {
|
||||
for (x in for_x_end + overscan_open downTo for_x_start) {
|
||||
setLight(x, y, calculate(x, y, 3))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Round 4
|
||||
// Round 1
|
||||
AppLoader.debugTimers["Renderer.Light4"] = measureNanoTime {
|
||||
for (y in for_y_start - overscan_open..for_y_end) {
|
||||
for (x in for_x_end + overscan_open downTo for_x_start) {
|
||||
for (x in for_x_start - overscan_open..for_x_end) {
|
||||
setLight(x, y, calculate(x, y, 4))
|
||||
}
|
||||
}
|
||||
@@ -471,10 +472,10 @@ object LightmapRenderer {
|
||||
// brighten if solid
|
||||
if (BlockCodex[world.getTileFromTerrain(x, y)].isSolid) {
|
||||
return Color(
|
||||
(l.r * 1.25f),//.clampOne(),
|
||||
(l.g * 1.25f),//.clampOne(),
|
||||
(l.b * 1.25f),//.clampOne()
|
||||
(l.a * 1.25f)
|
||||
(l.r * 1.2f),
|
||||
(l.g * 1.2f),
|
||||
(l.b * 1.2f),
|
||||
(l.a * 1.2f)
|
||||
)
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user