diff --git a/assets/mods/basegame/blocks/16.tga b/assets/mods/basegame/blocks/16.tga index 1d11835f4..a70d53dad 100644 --- a/assets/mods/basegame/blocks/16.tga +++ b/assets/mods/basegame/blocks/16.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfb8139fd2ae8dc1f70ecdebd403d25051aa977bedaa051883a9f393d895da69 +oid sha256:c853e75f214a60369b419959804dcdd23a6ccb80647ff1446fbe09248067fabe size 56594 diff --git a/assets/mods/basegame/blocks/20.tga b/assets/mods/basegame/blocks/20.tga index f8563f8cd..9037de227 100644 --- a/assets/mods/basegame/blocks/20.tga +++ b/assets/mods/basegame/blocks/20.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25ce3c34bc15624618255881ea07ce1351c3fa7d2b71cdf9adeb47add15dea96 +oid sha256:f2a8b7ec928879b071f7c67f89602c16e9cbd7bd0afa5a7eec576d2505123566 size 56594 diff --git a/assets/mods/basegame/blocks/21.tga b/assets/mods/basegame/blocks/21.tga index 89c8ef673..33b72b813 100755 --- a/assets/mods/basegame/blocks/21.tga +++ b/assets/mods/basegame/blocks/21.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d6534442095ae33810582aaabdbe4db8215c8d6aa98e7f46481252437609915 +oid sha256:9f41fc1f8ccde814e66b749d2f6333c53100dc1b4b4653244a1078d9cf8584aa size 56594 diff --git a/assets/mods/basegame/blocks/35.tga b/assets/mods/basegame/blocks/35.tga index e3c6295b3..bb82b205c 100644 --- a/assets/mods/basegame/blocks/35.tga +++ b/assets/mods/basegame/blocks/35.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91290165dd65bfd28a1ef701104024369c39201881ceaaea89110371c0593f7f +oid sha256:422e9e7043e48ee22e06df187f4f5d7499461008e265662f12eb89d012e152e5 size 56594 diff --git a/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt b/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt index 0a7474e69..30d437533 100644 --- a/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt +++ b/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt @@ -607,7 +607,7 @@ internal object BlocksDrawer { (breakage / maxHealth).coerceIn(0f, 1f).times(BREAKAGE_STEPS).roundToInt() else 0 - if (mode == TERRAIN || mode == WALL) { + /*if (mode == TERRAIN || mode == WALL) { // translate nearbyTilesInfo into proper subtile number val nearbyTilesInfo = getNearbyTilesInfoDeblocking(mode, x, y) val subtiles = if (nearbyTilesInfo == null) @@ -623,7 +623,7 @@ internal object BlocksDrawer { /*TR*/writeToBufferSubtile(BLURMAP_BASE + mode, bufferBaseX * 2 + 1, bufferBaseY * 2 + 0, subtiles[1].x, subtiles[1].y, 0, 0) /*BR*/writeToBufferSubtile(BLURMAP_BASE + mode, bufferBaseX * 2 + 1, bufferBaseY * 2 + 1, subtiles[2].x, subtiles[2].y, 0, 0) /*BL*/writeToBufferSubtile(BLURMAP_BASE + mode, bufferBaseX * 2 + 0, bufferBaseY * 2 + 1, subtiles[3].x, subtiles[3].y, 0, 0) - } + }*/ if (renderTag.maskType >= CreateTileAtlas.RenderTag.MASK_SUBTILE_GENERIC) { hash = getHashCoord(x, y, 268435456, mode, renderTag.tileNumber) @@ -1173,7 +1173,7 @@ internal object BlocksDrawer { private var _tilesBufferAsTex: Texture = Texture(1, 1, Pixmap.Format.RGBA8888) private var _tilesBufferAsTex2: Texture = Texture(1, 1, Pixmap.Format.RGBA8888) - private var _blurTilesBuffer: Texture = Texture(1, 1, Pixmap.Format.RGBA8888) +// private var _blurTilesBuffer: Texture = Texture(1, 1, Pixmap.Format.RGBA8888) private val occlusionIntensity = 0.25f // too low value and dark-coloured walls won't darken enough private val doTilemapUpdate: Boolean @@ -1279,26 +1279,26 @@ internal object BlocksDrawer { _tilesBufferAsTex2 = Texture(drawBuffer2) _tilesBufferAsTex2.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest) - _blurTilesBuffer.dispose() - _blurTilesBuffer = Texture(blurTilesBuffer) - _blurTilesBuffer.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest) +// _blurTilesBuffer.dispose() +// _blurTilesBuffer = Texture(blurTilesBuffer) +// _blurTilesBuffer.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest) if (drawEmissive) { - nullTex.bind(4) +// nullTex.bind(4) _tilesBufferAsTex2.bind(3) _tilesBufferAsTex.bind(2) tilesEmissive.texture.bind(1) tilesEmissive.texture.bind(0) // for some fuck reason, it must be bound as last } else if (drawGlow) { - nullTex.bind(4) +// nullTex.bind(4) _tilesBufferAsTex2.bind(3) _tilesBufferAsTex.bind(2) tilesGlow.texture.bind(1) tilesGlow.texture.bind(0) // for some fuck reason, it must be bound as last } else { - _blurTilesBuffer.bind(4) +// _blurTilesBuffer.bind(4) _tilesBufferAsTex2.bind(3) _tilesBufferAsTex.bind(2) tilesTerrainNext.texture.bind(1) @@ -1312,7 +1312,7 @@ internal object BlocksDrawer { shaderTiling.setUniformi("tilesBlendAtlas", 1) shaderTiling.setUniformi("tilemap", 2) shaderTiling.setUniformi("tilemap2", 3) - shaderTiling.setUniformi("deblockingMap", 4) +// shaderTiling.setUniformi("deblockingMap", 4) shaderTiling.setUniformi("tilemapDimension", drawBuffer1.width, drawBuffer1.height) shaderTiling.setUniformf("tilesInAxes", tilesInHorizontal.toFloat(), tilesInVertical.toFloat()) shaderTiling.setUniformi("cameraTranslation", camTransX, camTransY) // usage of 'fmod' and '%' were depend on the for_x_start, which I can't just do naive int div @@ -1457,7 +1457,7 @@ internal object BlocksDrawer { blurTilesBuffer.dispose() _tilesBufferAsTex.dispose() _tilesBufferAsTex2.dispose() - _blurTilesBuffer.dispose() +// _blurTilesBuffer.dispose() tilesQuad.tryDispose() shaderTiling.dispose() shaderDeblock.dispose() diff --git a/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt b/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt index c829bfc32..1bbd9524d 100644 --- a/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt +++ b/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt @@ -471,9 +471,8 @@ class CreateTileAtlas { // 0000 (0): INVALID // 1000 (1): connect-mutual // 0100 (2): connect-self - // Line 3: Request for Post-Processing + // Line 3: Request for Post-Processing (currently does nothing) // 0000 (0): do nothing - // 1000 (1): subtile deblocking // NOTE: For this system, the "NORANDTILE" tag is ignored val maskType = if (tilesPixmap.width >= 3*W_SUBTILE_GENERIC) MASK_SUBTILE_GRASS else MASK_SUBTILE_GENERIC var connectionType0 = 0 diff --git a/src/shaders/tiling.frag b/src/shaders/tiling.frag index 545b095fe..b6426af29 100644 --- a/src/shaders/tiling.frag +++ b/src/shaders/tiling.frag @@ -12,7 +12,7 @@ uniform sampler2D tilemap; // RGBA8888 uniform sampler2D tilemap2; // RGBA8888 uniform sampler2D tilesAtlas; // terrain, wire, fluids, etc. uniform sampler2D tilesBlendAtlas; // alternative terrain for the weather mix (e.g. yellowed grass) -uniform sampler2D deblockingMap; +//uniform sampler2D deblockingMap; uniform vec2 tilesInAxes; // 8x8 uniform float tilesBlend = 0.0; // percentage of blending [0f..1f]. 0: draws tilesAtlas, 1: draws tilesBlendAtlas @@ -78,15 +78,15 @@ vec2 uvFlipRot(int op, vec2 uv) { return (flipRotMat[op] * vec3(uv, 1.0)).xy; } -const vec4 _four = vec4(1.0 / 4.0); -const vec4 _three = vec4(1.0 / 3.0); -const vec4 _two = vec4(1.0 / 2.0); -const vec4 zero = vec4(0.0); -const float blur = 1.0; -const vec2 blurU = vec2(0.0, -blur); -const vec2 blurD = vec2(0.0, +blur); -const vec2 blurL = vec2(-blur, 0.0); -const vec2 blurR = vec2(+blur, 0.0); +//const vec4 _four = vec4(1.0 / 4.0); +//const vec4 _three = vec4(1.0 / 3.0); +//const vec4 _two = vec4(1.0 / 2.0); +//const vec4 zero = vec4(0.0); +//const float blur = 1.0; +//const vec2 blurU = vec2(0.0, -blur); +//const vec2 blurD = vec2(0.0, +blur); +//const vec2 blurL = vec2(-blur, 0.0); +//const vec2 blurR = vec2(+blur, 0.0); vec2 overscannedScreenDimension = tilesInAxes * tileSizeInPx; // how many tiles will fit into a screen; one used by the tileFromMap; we need this because screen size is not integer multiple of the tile size @@ -96,11 +96,11 @@ vec4[2] getTileNumbersFromMap(vec2 fragCoord) { return vec4[2](tileFromMap, tileFromMap2); } -vec4 getBlurmapNumbersFromMap(vec2 fragCoord) { - return texture(deblockingMap, fragCoord / overscannedScreenDimension);// raw tile number -} +//vec4 getBlurmapNumbersFromMap(vec2 fragCoord) { +// return texture(deblockingMap, fragCoord / overscannedScreenDimension);// raw tile number +//} -vec4[3] getFragColorForOnscreenCoord(vec2 fragCoord) { +vec4[2] getFragColorForOnscreenCoord(vec2 fragCoord) { vec4[] tileFromMap = getTileNumbersFromMap(fragCoord); ivec3 tbf = _colToInt(tileFromMap[0], tileFromMap[1]); int tile = tbf.x; @@ -111,11 +111,11 @@ vec4[3] getFragColorForOnscreenCoord(vec2 fragCoord) { ivec2 tileQ = tileXYnQ.zw; ivec2 breakageXY = tileNumberToXY(2*(breakage + 5)).xy; // +5 is hard-coded constant that depends on the contents of the atlas - vec4 blurFromMap = getBlurmapNumbersFromMap(fragCoord); - ivec3 tbf2 = _colToInt(blurFromMap, zero); - int blurTileNum = tbf2.x; - ivec4 blurXYnQ = tileNumberToXY(blurTileNum); - ivec2 blurXY = blurXYnQ.xy; +// vec4 blurFromMap = getBlurmapNumbersFromMap(fragCoord); +// ivec3 tbf2 = _colToInt(blurFromMap, zero); +// int blurTileNum = tbf2.x; +// ivec4 blurXYnQ = tileNumberToXY(blurTileNum); +// ivec2 blurXY = blurXYnQ.xy; // calculate the UV coord value for texture sampling // @@ -124,13 +124,13 @@ vec4[3] getFragColorForOnscreenCoord(vec2 fragCoord) { vec2 uvCoordForTile1 = mod(fragCoord, tileSizeInPx) * _tileSizeInPx * _tilesInAtlas;// 0..0.00390625 regardless of tile position in atlas vec2 uvCoordOffsetTile = tileXY * _tilesInAtlas; // where the tile starts in the atlas, using uv coord (0..1) vec2 uvCoordOffsetBreakage = (breakageXY + tileQ) * _tilesInAtlas; - vec2 uvCoordOffsetBlurmap = blurXY * _tilesInAtlas; +// vec2 uvCoordOffsetBlurmap = blurXY * _tilesInAtlas; // get final UV coord for the actual sampling // vec2 finalUVCoordForTile = uvCoordForTile + uvCoordOffsetTile;// where we should be actually looking for in atlas, using UV coord (0..1) vec2 finalUVCoordForBreakage = uvCoordForTile1 + uvCoordOffsetBreakage; - vec2 finalUVCoordForBlurmap = uvCoordForTile1 + uvCoordOffsetBlurmap; +// vec2 finalUVCoordForBlurmap = uvCoordForTile1 + uvCoordOffsetBlurmap; // blending a breakage tex with main tex // @@ -139,8 +139,8 @@ vec4[3] getFragColorForOnscreenCoord(vec2 fragCoord) { return vec4[]( mix(tileCol, tileAltCol, tilesBlend), - texture(tilesAtlas, finalUVCoordForBreakage), - texture(tilesAtlas, finalUVCoordForBlurmap) + texture(tilesAtlas, finalUVCoordForBreakage) +// texture(tilesAtlas, finalUVCoordForBlurmap) ); } @@ -178,20 +178,20 @@ void main() { vec4[] tile_breakage_blur = getFragColorForOnscreenCoord(fragCoord); vec4 tileC = tile_breakage_blur[0]; - vec4 tileL = getFragColorForOnscreenCoord1(fragCoord + blurL); - vec4 tileR = getFragColorForOnscreenCoord1(fragCoord + blurR); - vec4 tileU = getFragColorForOnscreenCoord1(fragCoord + blurU); - vec4 tileD = getFragColorForOnscreenCoord1(fragCoord + blurD); +// vec4 tileL = getFragColorForOnscreenCoord1(fragCoord + blurL); +// vec4 tileR = getFragColorForOnscreenCoord1(fragCoord + blurR); +// vec4 tileU = getFragColorForOnscreenCoord1(fragCoord + blurU); +// vec4 tileD = getFragColorForOnscreenCoord1(fragCoord + blurD); - vec4 blurH = (tileC + tileL + tileR) * _three; - vec4 blurV = (tileC + tileU + tileD) * _three; - vec4 blurPower = tile_breakage_blur[2]; +// vec4 blurH = (tileC + tileL + tileR) * _three; +// vec4 blurV = (tileC + tileU + tileD) * _three; +// vec4 blurPower = tile_breakage_blur[2]; - vec4 finalTile = mix( - mix(tileC, blurH, blurPower.x), - mix(tileC, blurV, blurPower.y), - 0.5 - ); + vec4 finalTile = tileC;//mix( +// mix(tileC, blurH, blurPower.x), +// mix(tileC, blurV, blurPower.y), +// 0.5 +// ); vec4 finalBreakage = drawBreakage * tile_breakage_blur[1]; // drawBreakeage = 0 to not draw, = 1 to draw diff --git a/work_files/graphics/terrain/terrain_variable_subtiling_full.kra b/work_files/graphics/terrain/terrain_variable_subtiling_full.kra index e0ccb5394..47ef49ec1 100644 --- a/work_files/graphics/terrain/terrain_variable_subtiling_full.kra +++ b/work_files/graphics/terrain/terrain_variable_subtiling_full.kra @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:79840ef28cbcd18dee3ba782661d5c8d92d8e06f536359ca9ed212af6b5d30aa -size 1698760 +oid sha256:761909f9941fdd9aa6f9ac76d74e87fc5e1083c4fde6ef7717e3ce86a963157e +size 1724763