[MC-10480] Blindness + Night-vision Effects Create Complete Blindness Created: 28/Feb/13 Updated: 02/Apr/20 Resolved: 02/Apr/20 |
|
| Status: | Resolved |
| Project: | Minecraft: Java Edition |
| Component/s: | None |
| Affects Version/s: | Snapshot 13w09b, Snapshot 13w09c, Snapshot 13w10b, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Snapshot 13w24a, Snapshot 13w24b, Snapshot 13w25a, Snapshot 13w25b, Minecraft 15w31a |
| Fix Version/s: | 1.15.2 |
| Type: | Bug | ||
| Reporter: | Michael Cooper | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| CHK: | |||||||||||||||||||||||||||||||||||||||||||||||||
| Confirmation Status: | Confirmed | ||||||||||||||||||||||||||||||||||||||||||||||||
| Game Mode: | Creative | ||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
I was messing around with the effects and I found that the blindness effect and the night vision effect cause you to see nothing but the sun and the light in the sky. /effect @p minecraft:night_vision 1000000 0 /effect @p minecraft:blindness 1000000 0 Code analysis by quadraxis in this comment. |
| Comments |
| Comment by Ben Staddon [ 08/Sep/17 ] |
|
Having had a chance to look at this earlier, here's an explanation of the bug. The issue is in EntityRenderer.updateFogColor() and is the cause of both Looking at the relevant section of code there (based on MC 1.12.1): double d1 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks) * world.provider.getVoidFogYFactor(); if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.BLINDNESS)) { int i = ((EntityLivingBase)entity).getActivePotionEffect(MobEffects.BLINDNESS).getDuration(); if (i < 20) { d1 *= (double)(1.0F - (float)i / 20.0F); } else { d1 = 0.0D; } } if (d1 < 1.0D) { if (d1 < 0.0D) { d1 = 0.0D; } d1 = d1 * d1; this.fogColorRed = (float)((double)this.fogColorRed * d1); this.fogColorGreen = (float)((double)this.fogColorGreen * d1); this.fogColorBlue = (float)((double)this.fogColorBlue * d1); } if (this.bossColorModifier > 0.0F) { float f14 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks; this.fogColorRed = this.fogColorRed * (1.0F - f14) + this.fogColorRed * 0.7F * f14; this.fogColorGreen = this.fogColorGreen * (1.0F - f14) + this.fogColorGreen * 0.6F * f14; this.fogColorBlue = this.fogColorBlue * (1.0F - f14) + this.fogColorBlue * 0.6F * f14; } if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.NIGHT_VISION)) { float f15 = this.getNightVisionBrightness((EntityLivingBase)entity, partialTicks); float f6 = 1.0F / this.fogColorRed; if (f6 > 1.0F / this.fogColorGreen) { f6 = 1.0F / this.fogColorGreen; } if (f6 > 1.0F / this.fogColorBlue) { f6 = 1.0F / this.fogColorBlue; } this.fogColorRed = this.fogColorRed * (1.0F - f15) + this.fogColorRed * f6 * f15; this.fogColorGreen = this.fogColorGreen * (1.0F - f15) + this.fogColorGreen * f6 * f15; this.fogColorBlue = this.fogColorBlue * (1.0F - f15) + this.fogColorBlue * f6 * f15; } After some calculations, the fog colour values are multiplied by the value d1. If this value is zero, which can occur both due to being subject to the blindness effect and also a negative y position, then all three colour components of the fog will be zero upon entering the block of code applying the night-vision effect. This is what triggers the bug. Within the night-vision code, the value f6 is calculated as the minimum of the reciprocal of the red, green, blue colour values. For the case where these are all 0, this value will be infinity. The colour values are then linearly interpolated (based on the night-vision intensity value, f15) between their original values, and the value multiplied by the calculated factor f6. In the case described above, this multiplication will be 0 * infinity, which has no defined value, and will evaluate to NaN (Not a Number). The NaN value will propagate here, leading to a final NaN value being assigned as the fog colours. These invalid values are then passed to various OpenGL fog functions, which is what seems to be causing the effects described. As NVidia cards do have alternative fog rendering methods (that are used by Minecraft - the optional "GL_NV_fog_distance" extension) it's likely that the implementation used handling this differently is the reason why it's hardware dependent. The night-vision code needs to handle this edge case, to avoid passing invalid values here. If the developers do intend on having the end result, it should be coded specifically, rather than relying on implementation quirks. Notes: |
| Comment by [Mod] Sonicwave [ 27/Apr/17 ] |
|
Based on grum's comment, I actually think that he misunderstood this issue since he said that you can see the floor without issues, while this bug is describing the exact opposite. There are discussions on Reddit about this issue here and here. In any case, this behavior is inconsistent between computers: it didn't occur to me in 17w17b or 1.11.2 on a Windows 10 with NVIDIA (seen in attachment 2017-04-27_16.13.25.png), but when I tested it on another computer in the same versions it did occur (will get screenshots/specs when I get access to that computer again). Edit: This seems to have the same cause as |
| Comment by Jacob Larsen [ 09/Apr/16 ] |
|
It is breaking one of my maps though. I want to limit a players ability to see (distance wise) but light up he area around said player i.e. Holding a torch. It makes no sense that a torch could light up areas 160 m away. Instead, they are completely blinded. Bug still in 1.9 Possible fix: Everybody wins. |
| Comment by user-f2760 (Inactive) [ 30/Jul/15 ] |
|
no it's not, also this is resolved as intended |
| Comment by [Mod] Sonicwave [ 30/Jul/15 ] |
|
Fixed in 15w31b. What makes regular blindness + Moody brightness not enough? |
| Comment by Martin LaTour [ 30/Jul/15 ] |
|
Wait, heres a good question: why consider this a bug? |
| Comment by [Mod] Sonicwave [ 29/Jul/15 ] |
|
|
| Comment by [Mod] Sonicwave [ 30/May/15 ] |
|
Confirmed for 1.8.6, see above comments for why it's still an issue. |
| Comment by [Mod] Sonicwave [ 26/Dec/14 ] |
|
This still affects 1.8.2-pre1 and could be related to |
| Comment by [Mod] Sonicwave [ 26/Dec/14 ] |
|
Is this really intended? Shouldn't Night Vision and Blindness reduce the player's vision to a few blocks, but still give them Night Vision (as in the videos linked by psomguy)? After all, that is how blindness behaves around other light sources (sunlight, block light etc). |
| Comment by Christie N [ 09/Mar/14 ] |
|
I've heard it's a problem with some graphics cards. Here's my specs: ---- Minecraft Crash Report ---- // I bet Cylons wouldn't have this problem. Time: 3/8/14 8:16 PM Description: Manually triggered debug crash java.lang.Throwable at beo.p(SourceFile:1467) at beo.ai(SourceFile:801) at beo.f(SourceFile:755) at net.minecraft.client.main.Main.main(SourceFile:121) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at bpo.a(SourceFile:308) -- Affected level -- Details: Level name: MpServer All players: 1 total; [brs['kwerti'/75, l='MpServer', x=-1810.65, y=4.00, z=1710.77]] Chunk stats: MultiplayerChunkCache: 625, 625 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: -1859.00,4.00,1698.00 - World: (-1859,4,1698), Chunk: (at 13,0,2 in -117,106; contains blocks -1872,0,1696 to -1857,255,1711), Region: (-4,3; contains chunks -128,96 to -97,127, blocks -2048,0,1536 to -1537,255,2047) Level time: 1434004 game time, 1000 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 32 total; [yk['Iron Golem'/9, l='MpServer', x=-1868.13, y=4.00, z=1672.25], xx['Cow'/10, l='MpServer', x=-1878.81, y=4.00, z=1788.72], brs['kwerti'/75, l='MpServer', x=-1810.65, y=4.00, z=1710.77], xx['Cow'/13, l='MpServer', x=-1856.88, y=4.00, z=1670.06], xx['Cow'/14, l='MpServer', x=-1849.16, y=4.00, z=1657.13], xx['Cow'/15, l='MpServer', x=-1854.91, y=4.00, z=1671.91], xx['Cow'/18, l='MpServer', x=-1830.94, y=4.00, z=1656.97], ud['entity.ItemFrame.name'/27, l='MpServer', x=-1794.03, y=5.50, z=1700.50], ud['entity.ItemFrame.name'/26, l='MpServer', x=-1794.03, y=5.50, z=1702.50], ud['entity.ItemFrame.name'/29, l='MpServer', x=-1794.03, y=5.50, z=1699.50], ud['entity.ItemFrame.name'/28, l='MpServer', x=-1794.03, y=5.50, z=1703.50], ud['entity.ItemFrame.name'/31, l='MpServer', x=-1794.03, y=5.50, z=1701.50], ud['entity.ItemFrame.name'/30, l='MpServer', x=-1794.03, y=4.50, z=1699.50], ud['entity.ItemFrame.name'/34, l='MpServer', x=-1794.03, y=6.50, z=1702.50], ud['entity.ItemFrame.name'/35, l='MpServer', x=-1794.03, y=6.50, z=1703.50], ud['entity.ItemFrame.name'/32, l='MpServer', x=-1794.03, y=6.50, z=1699.50], ud['entity.ItemFrame.name'/33, l='MpServer', x=-1794.03, y=6.50, z=1701.50], ud['entity.ItemFrame.name'/38, l='MpServer', x=-1800.50, y=6.50, z=1697.03], xx['Cow'/39, l='MpServer', x=-1792.28, y=4.00, z=1764.19], ud['entity.ItemFrame.name'/36, l='MpServer', x=-1794.03, y=6.50, z=1700.50], ud['entity.ItemFrame.name'/37, l='MpServer', x=-1801.50, y=6.50, z=1697.03], xw['Chicken'/42, l='MpServer', x=-1761.41, y=4.00, z=1661.41], ye['Pig'/43, l='MpServer', x=-1769.13, y=4.00, z=1785.03], xw['Chicken'/46, l='MpServer', x=-1745.59, y=4.00, z=1654.63], xw['Chicken'/47, l='MpServer', x=-1751.75, y=4.00, z=1673.44], ye['Pig'/51, l='MpServer', x=-1757.22, y=4.00, z=1761.16], xx['Cow'/50, l='MpServer', x=-1748.03, y=4.00, z=1740.91], xx['Cow'/49, l='MpServer', x=-1755.81, y=4.00, z=1740.09], xw['Chicken'/48, l='MpServer', x=-1749.34, y=4.00, z=1674.53], xx['Cow'/55, l='MpServer', x=-1732.16, y=4.00, z=1721.00], xx['Cow'/54, l='MpServer', x=-1746.78, y=4.00, z=1698.69], ye['Pig'/52, l='MpServer', x=-1759.97, y=4.00, z=1773.81]] Retry entities: 0 total; [] Server brand: vanilla Server type: Integrated singleplayer server Stacktrace: at bpo.a(SourceFile:308) at beo.b(SourceFile:2069) at beo.f(SourceFile:764) at net.minecraft.client.main.Main.main(SourceFile:121) -- System Details -- Details: Minecraft Version: 14w10c Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_45, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 151231728 bytes (144 MB) / 307232768 bytes (293 MB) up to 954728448 bytes (910 MB) JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 Launched Version: 14w10c LWJGL: 2.9.1 OpenGL: AMD Radeon HD 6700 Series GL version 4.2.11931 Compatibility Profile Context, ATI Technologies Inc. GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Probably not. Jar signature remains and client brand is untouched. Type: Client (map_client.txt) Resource Packs: [Argon 32x] Current Language: English (US) Profiler Position: N/A (disabled) Anisotropic Filtering: On (4) |
| Comment by Aifer Gettisnem [ 12/Dec/13 ] |
|
The issue is stacking Night Vision and Blindness creates a super blindness that makes it impossible to see anything. Not even the floor! Just pure darkness! Whereas before, it would give you the visual limitations of blindness but change the appearance of the block light level for what you could still see(i.e. the floor) to 15. Now I don't see anything wrong with this, as much as I like how the two effects stacked previously I can certainly use this new behavior for other things as well, but I want you to understand what the community here is pointing out. In short...this is what we've come to expect: This is what we're getting now: Is this really working "as intended"? |
| Comment by [Mojang] Grum (Erik Broes) [ 19/Jun/13 ] |
|
Not really sure what the issue is, this works as intended. 'nightvision' doesn't override blindness and removes its effect. You can also still see the floor beneath you without any issues. |
| Comment by Ethan Brown [ 19/Jun/13 ] |
|
AND as of 13w25b |
| Comment by Craig McKinley [ 07/Mar/13 ] |
|
and as of the 1.5 pre-release |
| Comment by Michael Cooper [ 01/Mar/13 ] |
|
Still in the game as of 13w09c. |
| Comment by Anon Ymus [ 28/Feb/13 ] |
|
Confirmed. |