Developing Games on Intel Graphics
If you are gaming on graphics integrated in your Intel Processor, this is the place for you! Find answers to your questions or post your issues with PC games
Announcements
This forum offers only peer-to-peer support. Thank you!
Learn more about Developing Games on Intel Graphics
555 Discussions

OpenGL procedurally generated night nebula shader malfunctioning in Minecraft.

djmrFunnyMan
New Contributor II
3,354 Views

This is a continuation from https://community.intel.com/t5/Developing-Games-on-Intel/Driver-level-bugs-causing-issues-in-Minecraft-amp-OpenGL-shaders/td-p/1664368 which will be split into 3 separate reports.

Issue:

Night Nebula function from Complementary Shaders is broken on certain nights.

This issue also isn't present on Nvidia or AMD cards.
The function that drives this effect is located in nightNebula.glsl (in the attached shaderpacks.zip)
(3 showcase images attached)

Reproduction Steps

Preparation:
- Install Iris & Sodium for 1.21.4 : https://github.com/IrisShaders/Iris/blob/multiloader-new/docs/guide.md
- Unpack the shaderpacks.zip inside the (...)\AppData\Roaming\.minecraft folder
- Unpack the Driver Bug Test.zip inside the \AppData\Roaming\.minecraft\saves folder
- Go into options>video settings>shaderpacks and select "complementary unbound 5.4 + euphoria patches 1.5.2"
- Press apply

Reproduction:
- Open the Driver Bug Test world in-game
- Step on the pressure plate that says "Broken Night Sky"
- Step on any of the pressure plates and you should notice graphical issues on the sky

0 Kudos
12 Replies
karen_intel
Moderator
3,292 Views

@djmrFunnyMan noted!
Adding to debug queue

Karen

0 Kudos
djmrFunnyMan
New Contributor II
1,239 Views

I have narrowed down the issue to one line in nightNebula.glsl

return fract(sinM(dot(inCoord, vec2(23.53, 44.0))) * 42350.45);

Changing it to 

return fract(sinM(dot(inCoord, vec2(23.5, 44.0))) * 42350.45);

fixes the issue.

I have no idea why is this the cause. This definitely feels like a bug on your side, because afaik this code meets the spec.

0 Kudos
djmrFunnyMan
New Contributor II
536 Views

Addendum: The change above does not actually fix the issue. I was mistaken.

I did find another solution which does actually fix the issue.

So for clarity, the following line has issues:

return fract(sinM(dot(inCoord, vec2(23.53, 44.0))) * 42350.45); //unexpected behaviour

Changing it to the following fixes the issue:

uniform float value = 23.53;
return fract(sinM(dot(inCoord, vec2(value, 44.0))) * 42350.45);  //behaves as expected




0 Kudos
Arturo_Intel
Moderator
468 Views

Hello,

I change the code to use uniform and const float with the same value to reproduce this behavior, what I notice is that on latest gen (B390 or series 3) iGPUs, both declarations are behaving the exact same way (abrupt vertical cuts in a procedural noise pattern) which proves that the issue is on how the driver is dealing with this floats. 

I'm still gathering all the evidences possible to push this to the corresponding team. 

A new article will be created to follow this case. I will share the link once is public.

 

Thanks a lot for your patience,

r2

0 Kudos
djmrFunnyMan
New Contributor II
462 Views

@Arturo_Intel That's unexpected

On my B580 the two paths differ, with only the left side exhibiting erroneous behaviour.

There may be some difference between iGPU and dGPU drivers.

I suggest you try to run the code on a B580 to compare the difference.

djmrFunnyMan_0-1784068955039.png

 

0 Kudos
Arturo_Intel
Moderator
169 Views

Yes, I can confirm on Arc A-Series and B-Series the behavior is as described above: abrupt vertical cuts in a procedural noise pattern.

But in B390 igpu the uniform prefix is behaving as the const/normal float. (in both sides I can see the corruption) 

Indeed we have another level of complexity here.

0 Kudos
Arturo_Intel
Moderator
674 Views

hey @djmrFunnyMan 

I create a homebrew code to reproduce this behavior outside Minecraft based on the path the nightNebula.glsl was following.

here is the repo with the code: https://github.com/Arturo-Intel/06501550

and here is what you will see if you run it

Arturo_Intel_0-1783715467136.png

left side is using 23.53

right side is using 23.5

 

Please review the code and share any input you have.

I will use this to escalate the case to the corresponding team.

--r2

 

djmrFunnyMan
New Contributor II
664 Views

@Arturo_Intel What I managed to figure out is that the issue seems to be related to the number of decimal places of the value actually stored in the float. 
For example 23.53 is actually stored as 23.5300006866455078125 while 23.5 is stored as precisely 23.5. The reason 23.53 has errors is because it has more decimal points than 23.5

The more decimal precision the value actually stored in the float uses up, the more frequent the error is.
For example 23.5 will have less errors than 23.3125 which will have less errors than 23.265625 which will have less errors than 23.53

I still don't know why this is the case but that's the pattern. And to reiterate this issue doesn't manifest on hardware from other gpu vendors.

0 Kudos
djmrFunnyMan
New Contributor II
662 Views

Just to be clear. The issue isn't that the left side differs from the right side. That is expected.

The issue is the existence of these lines on the left side (highlighted in red)

djmrFunnyMan_0-1783725757166.png

 

0 Kudos
djmrFunnyMan
New Contributor II
602 Views

@Arturo_Intel I provided a lot of information on your github.

https://github.com/Arturo-Intel/06501550/issues/1

https://github.com/Arturo-Intel/06501550/issues/2

Please check out my fork to verify my findings.

Unrelated to the above: I think I should note that a few months ago I created a duplicate report on IGCIT 
To prevent duplicate effort I believe it may need to be closed.

0 Kudos
Arturo_Intel
Moderator
169 Views

Here is the public article on this case:

https://www.intel.com/content/www/us/en/support/articles/000103040.html

 

--r2

djmrFunnyMan
New Contributor II
121 Views

Well I have nothing more to add, other than: good luck!
Hope the issue can be resolved.

0 Kudos
Reply