Ambient occlusion bug on staircase structures
NOTE: the following fix pertains to 1.7, an updated version will be needed for 1.16+
Let me first off say that I know this is a duplicate, but I have code-fixes for it.
As you can see in the 2 images, the first one (The bugged version), has inconsistent lighting travelling from one block to the next, the corners don't match up. This is primarily noticeable in 1 wide staircases underground, and for good reason.
Basically what is happening is that the render code is checking the transparency of blocks with an incorrect offset. When you get your coordinates wrong you're bound to get some weird results.
This code is drawing the bottom face.
if (this.renderMinY <= 0.0D) { --y; } this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z); this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z - 1); this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z + 1); this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x + 1, y, z); this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z); this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z - 1); this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z + 1); this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x + 1, y, z); transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)]; if (!transparencyYZNN && !transparencyXYNN) { this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; } else { this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z - 1); this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z - 1); }
What it does is decrements the y value to save a bunch of subtractions since the whole next section uses "y - 1". It appears as if in the case of every face, a part was left as "y - 1" (Or any other respective coordinate changes such as "y + 1", "x - 1", "x + 1", "z - 1", "z + 1").
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)];
The way I was able to fix this was by adding 3 ints at the top of the method called xConst, yConst, zConst (or more appropriate names), set those to the coordinates passed into the function and changed the code to
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, yConst - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, yConst - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z - 1)];
This bug is both aesthetically unpleasing, but also causes the "Lava light leaking through corners" bug.
Also, while I was looking through the rendering code, I found the source of the upside-down half-slab lighting bug. A half-slab gets lit using the highest of the neighbour's light values, but it doesn't check the light value of the block below.
topBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3 + 1, par4); eastBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 + 1, par3, par4); int westBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 - 1, par3, par4); int northBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 + 1); int southBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 - 1); if (eastBrightness > topBrightness) { topBrightness = eastBrightness; } if (westBrightness > topBrightness) { topBrightness = westBrightness; } if (northBrightness > topBrightness) { topBrightness = northBrightness; } if (southBrightness > topBrightness) { topBrightness = southBrightness; } return topBrightness;
The first idea that comes to mind is to push this code into the Block class so that it can be overloaded in child classes such as slabs.
Linked Issues
is duplicated by5
relates to5
- Unresolved
Connor Steppie
Jonathan Sells
- 85
- 33
- Confirmed
Normal
- Platform
- Lighting Rendering
- rendering smooth-lighting smooth-lighting-interpolation-incorrect smooth-lighting-not-smooth
1.7.4 - 23w44a
1.7.4 1.8.1-pre3 1.8.2 1.8.4 15w42a 1.10.2 16w41a 16w42a 16w43a 1.11 1.11.2 17w14a 1.12 1.12.1-pre1 1.12.1 1.12.2 17w47b 18w16a 1.13-pre2 1.13.1 1.14.4 19w34a 19w45b 1.15-pre1 1.15-pre6 1.15.2 20w15a 20w28a 20w29a 20w30a 1.16.2-pre1 20w51a 21w03a 21w05b 21w10a 21w20a 1.17-pre1 1.17.1 1.18-pre1 1.18.1 22w05a 22w16b 23w44a
Created Issue:
MInecraft Ambient Occlusion bug (With fix)
Let me first off say that I know this is a duplicate, but I actually have a 30 second fix to the issue.
As you can see in the 2 images, the first one (The bugged version), has inconsistent lighting travelling from one block to the next, the corners don't match up. This is primarily noticeable in 1 wide staircases underground, and for good reason.
Basically what is happening is that the render code is checking the transparency of blocks with an incorrect offset. When you get your coordinates wrong you're bound to get some weird results.
This code is drawing the bottom face.
if (this.renderMinY <= 0.0D) { --y; } this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z); this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z - 1); this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z + 1); this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x + 1, y, z); this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z); this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z - 1); this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z + 1); this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x + 1, y, z); transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)]; if (!transparencyYZNN && !transparencyXYNN) { this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; } else { this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z - 1); this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z - 1); }What it does is decrements the y value to save a bunch of subtractions since the whole next section uses "y - 1". This is a good change as long as you remember to remove all "y - 1" until it is incremented again. It appears as if in the case of every face in both of the rendering methods, a part was left as "y - 1" (Or any other respective coordinate changes such as "y + 1", "x - 1", "x + 1", "z - 1", "z + 1").
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)];This is a simple fix, just change the respective coordinate to match all the other coordinates in the section, for the one I showed as example, you would change it to
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y, z - 1)];This bug is both aesthetically unpleasing, but also causes the "Lava light leaking through corners" bug, and all it takes is 30 seconds to fix it.
Environment
Windows 7 64-bit, Java 7
is duplicated by
Let me first off say that I know this is a duplicate, but I
actually have a 30 second fix to the issue.As you can see in the 2 images, the first one (The bugged version), has inconsistent lighting travelling from one block to the next, the corners don't match up. This is primarily noticeable in 1 wide staircases underground, and for good reason.
Basically what is happening is that the render code is checking the transparency of blocks with an incorrect offset. When you get your coordinates wrong you're bound to get some weird results.
This code is drawing the bottom face.
if (this.renderMinY <= 0.0D) { --y; } this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z); this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z - 1); this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z + 1); this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x + 1, y, z); this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z); this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z - 1); this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z + 1); this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x + 1, y, z); transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)]; if (!transparencyYZNN && !transparencyXYNN) { this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; } else { this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z - 1); this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z - 1); }What it does is decrements the y value to save a bunch of subtractions since the whole next section uses "y - 1".
This is a good change as long as you remember to remove all "y - 1" until it is incremented again.It appears as if in the case of every facein both of the rendering methods, a part was left as "y - 1" (Or any other respective coordinate changes such as "y + 1", "x - 1", "x + 1", "z - 1", "z + 1").transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)];Th
is is a simple fix, just change the respective coordinate to match all the other coordinates in the section, for the one I showed as example, you would change ittotransparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y, z - 1)];This bug is both aesthetically unpleasing, but also causes the "Lava light leaking through corners" bug
, and all it takes is 30 seconds to fix it.Let me first off say that I know this is a duplicate, but I have code-fixes for it.
As you can see in the 2 images, the first one (The bugged version), has inconsistent lighting travelling from one block to the next, the corners don't match up. This is primarily noticeable in 1 wide staircases underground, and for good reason.
Basically what is happening is that the render code is checking the transparency of blocks with an incorrect offset. When you get your coordinates wrong you're bound to get some weird results.
This code is drawing the bottom face.
if (this.renderMinY <= 0.0D) { --y; } this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z); this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z - 1); this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z + 1); this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x + 1, y, z); this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z); this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z - 1); this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z + 1); this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x + 1, y, z); transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)]; if (!transparencyYZNN && !transparencyXYNN) { this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; } else { this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z - 1); this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z - 1); }What it does is decrements the y value to save a bunch of subtractions since the whole next section uses "y - 1". It appears as if in the case of every face, a part was left as "y - 1" (Or any other respective coordinate changes such as "y + 1", "x - 1", "x + 1", "z - 1", "z + 1").
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)];The way I was able to fix this was by adding 3 ints at the top of the method called xConst, yConst, zConst (or more appropriate names), set those to the coordinates passed into the function and changed the code to
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, yConst - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, yConst - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z - 1)];This bug is both aesthetically unpleasing, but also causes the "Lava light leaking through corners" bug.
Also, while I was looking through the rendering code, I found the source of the upside-down half-slab lighting bug. A half-slab gets lit using the highest of the neighbour's light values, but it doesn't check the light value of the block below.
topBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3 + 1, par4); eastBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 + 1, par3, par4); int westBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 - 1, par3, par4); int northBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 + 1); int southBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 - 1); if (eastBrightness > topBrightness) { topBrightness = eastBrightness; } if (westBrightness > topBrightness) { topBrightness = westBrightness; } if (northBrightness > topBrightness) { topBrightness = northBrightness; } if (southBrightness > topBrightness) { topBrightness = southBrightness; } return topBrightness;The first idea that comes to mind is to push this code into the Block class so that it can be overloaded in child classes such as slabs.
MInecraft Ambient Occlusion bug (With partial fix)
is duplicated by
relates to
is duplicated by
is duplicated by
Ambient occlusion bug on stairs (With partial fix)
Let me first off say that I know this is a duplicate, but I have code-fixes for it.As you can see in the 2 images, the first one (The bugged version), has inconsistent lighting travelling from one block to the next, the corners don't match up. This is primarily noticeable in 1 wide staircases underground, and for good reason.
Basically what is happening is that the render code is checking the transparency of blocks with an incorrect offset. When you get your coordinates wrong you're bound to get some weird results.
This code is drawing the bottom face.
if (this.renderMinY <= 0.0D) { --y; } this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z); this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z - 1); this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z + 1); this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x + 1, y, z); this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z); this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z - 1); this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z + 1); this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x + 1, y, z); transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)]; if (!transparencyYZNN && !transparencyXYNN) { this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; } else { this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z - 1); this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z - 1); }What it does is decrements the y value to save a bunch of subtractions since the whole next section uses "y - 1". It appears as if in the case of every face, a part was left as "y - 1" (Or any other respective coordinate changes such as "y + 1", "x - 1", "x + 1", "z - 1", "z + 1").
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)];The way I was able to fix this was by adding 3 ints at the top of the method called xConst, yConst, zConst (or more appropriate names), set those to the coordinates passed into the function and changed the code to
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, yConst - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, yConst - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z - 1)];This bug is both aesthetically unpleasing, but also causes the "Lava light leaking through corners" bug.
Also, while I was looking through the rendering code, I found the source of the upside-down half-slab lighting bug. A half-slab gets lit using the highest of the neighbour's light values, but it doesn't check the light value of the block below.
topBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3 + 1, par4); eastBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 + 1, par3, par4); int westBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 - 1, par3, par4); int northBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 + 1); int southBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 - 1); if (eastBrightness > topBrightness) { topBrightness = eastBrightness; } if (westBrightness > topBrightness) { topBrightness = westBrightness; } if (northBrightness > topBrightness) { topBrightness = northBrightness; } if (southBrightness > topBrightness) { topBrightness = southBrightness; } return topBrightness;The first idea that comes to mind is to push this code into the Block class so that it can be overloaded in child classes such as slabs.
NOTE: the following fix pertains to 1.7, an updated version will be needed for 1.16+
Let me first off say that I know this is a duplicate, but I have code-fixes for it.
As you can see in the 2 images, the first one (The bugged version), has inconsistent lighting travelling from one block to the next, the corners don't match up. This is primarily noticeable in 1 wide staircases underground, and for good reason.
Basically what is happening is that the render code is checking the transparency of blocks with an incorrect offset. When you get your coordinates wrong you're bound to get some weird results.
This code is drawing the bottom face.
if (this.renderMinY <= 0.0D) { --y; } this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z); this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z - 1); this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, x, y, z + 1); this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x + 1, y, z); this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z); this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z - 1); this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x, y, z + 1); this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x + 1, y, z); transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)]; if (!transparencyYZNN && !transparencyXYNN) { this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; } else { this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, x - 1, y, z - 1); this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, x - 1, y, z - 1); }What it does is decrements the y value to save a bunch of subtractions since the whole next section uses "y - 1". It appears as if in the case of every face, a part was left as "y - 1" (Or any other respective coordinate changes such as "y + 1", "x - 1", "x + 1", "z - 1", "z + 1").
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, y - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, y - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, y - 1, z - 1)];The way I was able to fix this was by adding 3 ints at the top of the method called xConst, yConst, zConst (or more appropriate names), set those to the coordinates passed into the function and changed the code to
transparencyXYPN = Block.canBlockGrass[this.blockAccess.getBlockId(x + 1, yConst - 1, z)]; transparencyXYNN = Block.canBlockGrass[this.blockAccess.getBlockId(x - 1, yConst - 1, z)]; transparencyYZNP = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z + 1)]; transparencyYZNN = Block.canBlockGrass[this.blockAccess.getBlockId(x, yConst - 1, z - 1)];This bug is both aesthetically unpleasing, but also causes the "Lava light leaking through corners" bug.
Also, while I was looking through the rendering code, I found the source of the upside-down half-slab lighting bug. A half-slab gets lit using the highest of the neighbour's light values, but it doesn't check the light value of the block below.
topBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3 + 1, par4); eastBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 + 1, par3, par4); int westBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 - 1, par3, par4); int northBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 + 1); int southBrightness = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 - 1); if (eastBrightness > topBrightness) { topBrightness = eastBrightness; } if (westBrightness > topBrightness) { topBrightness = westBrightness; } if (northBrightness > topBrightness) { topBrightness = northBrightness; } if (southBrightness > topBrightness) { topBrightness = southBrightness; } return topBrightness;The first idea that comes to mind is to push this code into the Block class so that it can be overloaded in child classes such as slabs.
Ambient occlusion bug on staircase structures (With partial fix)
relates to
relates to
Ambient occlusion bug on staircase structures(With partial fix)












This is still a concern in 1.8.1-pre3. Old bug, but still present. I recently made a report about a different issue with ambient occlusion... Best fix is to start from scratch.
Still a concern in 1.8.2.
Still a concern in 1.8.4. Added a screenshot showing a much more noticeable example.
Still a concern in 1.12.1: http://i.imgur.com/xGzCGV0.png
Confirmed for 17w47b
Confirmed for 18w16a
Still a concern in 19w34a.
Still a concern in 1.14.4
Still present in 1.15 Pre-release 6
is there any way i can download this fix
How do i apply the fix? I'd love to be rid of this bug.
Can you reproduce this bug in 1.16 pre release 5?
Affects 1.16.1 and 20w27a
Can confirm that this affects 20w28a
Can I request ownership of this issue? Original author has not been active at all for over three quarters of a decade
Can confirm in 20w51a.
Can confirm in 21w05b.
Gotta love how this bug has basically been ignored for nearly 8 years.
Can confirm in 21w10a, too.
The latest snapshot has made changes to smooth lighting that make this less apparent, but the bug is still there in some capacity. Should this be resolved as fixed and a ticket on the new behaviour be made?
Relates to MC-12558.
Can confirm in 1.17.1.
It appears this issue and MC-12558 were caused by the optimizations done to smooth lighting in the experimental snapshot 13w12~, which can be still dowloaded from this bug report: https://bugs.mojang.com/browse/MC-8824?focusedCommentId=55414#comment-55414
This is how a staircase structure appeared before the optimization fixes:

And this is how it appeared after, and still continues to appear in modern versions: