<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: OpenGL mix() function not working correctly with Minecraft shaders. in Developing Games on Intel Graphics</title>
    <link>https://community.intel.com/t5/Developing-Games-on-Intel/OpenGL-mix-function-not-working-correctly-with-Minecraft-shaders/m-p/1665097#M2585</link>
    <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/410902"&gt;@djmrFunnyMan&lt;/a&gt;&amp;nbsp;thanks for splitting the cases.&lt;BR /&gt;I'll check this one too&lt;BR /&gt;&lt;BR /&gt;Stay tuned&lt;BR /&gt;&lt;BR /&gt;Karen&lt;/P&gt;</description>
    <pubDate>Tue, 11 Feb 2025 22:24:02 GMT</pubDate>
    <dc:creator>karen_intel</dc:creator>
    <dc:date>2025-02-11T22:24:02Z</dc:date>
    <item>
      <title>OpenGL mix() function not working correctly with Minecraft shaders.</title>
      <link>https://community.intel.com/t5/Developing-Games-on-Intel/OpenGL-mix-function-not-working-correctly-with-Minecraft-shaders/m-p/1665023#M2577</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;This is a continuation from &lt;/SPAN&gt;&lt;A class="" href="https://community.intel.com/t5/Developing-Games-on-Intel/Driver-level-bugs-causing-issues-in-Minecraft-amp-OpenGL-shaders/td-p/1664368" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;https://community.intel.com/t5/Developing-Games-on-Intel/Driver-level-bugs-causing-issues-in-Minecraft-amp-OpenGL-shaders/td-p/1664368&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class=""&gt; which will be split into 3 separate reports.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The issue:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;The OpenGL mix() function seems to not work correctly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;It produces NaN's in situations where AMD and Nvidia cards don't have such issues.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;In this particular case the line of code affected is line 21 in blocklightColors.glsl (in the attached shaderpacks.zip)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;vec3 torchBlockSpecialLightColor = mix(vec3(2.0, 0.87, 0.27), fireSpecialLightColor, 0.75);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Rudimentary investegation:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Doing this will fix the issue and make it behave as expected. This fix makes zero sense however as &lt;SPAN&gt;clamp&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;.75&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;.0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;.0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; should do absolutely nothing to the 0.75&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;vec3 torchBlockSpecialLightColor = mix(vec3(2.0, 0.87, 0.27), fireSpecialLightColor, clamp01(0.75));  //this works as expected&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;clamp01 is just a simple function that looks like this (it's in commonFunctions.glsl)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;float clamp01(float x) {
    return clamp(x, 0.0, 1.0);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What makes even less sense is that, not using the function and directly doing clamp(0.75, 0.0, 1.0) results in different broken behaviour (also a NaN but it doesn't spread over the entire screen anymore)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;vec3 torchBlockSpecialLightColor = mix(vec3(2.0, 0.87, 0.27), fireSpecialLightColor, clamp(0.75, 0.0, 1.0));  //this is broken&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This makes precisely zero sense as clamp01 is just clamp(x , 0.0, 1.0) so there should be absolutely no difference between the two.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;The suspected culprit is malfunctioning constant folding.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Reproduction Steps&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Preparation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;- Install Iris &amp;amp; Sodium for 1.21.4 :&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://github.com/IrisShaders/Iris/blob/multiloader-new/docs/guide.md" target="_blank" rel="noopener nofollow noreferrer"&gt;&lt;SPAN class=""&gt;https://github.com/IrisShaders/Iris/blob/multiloader-new/docs/guide.md&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;- Unpack the shaderpacks.zip inside the (...)\AppData\Roaming\.minecraft folder&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;- Unpack the Driver Bug Test.zip inside the \AppData\Roaming\.minecraft\saves folder&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;- Go into options&amp;gt;video settings&amp;gt;shaderpacks and select "complementary unbound 5.4 + euphoria patches 1.5.2"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;- Press apply&lt;/SPAN&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Reproduction:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;- Open the Driver Bug Test world in-game&lt;BR /&gt;- Step on the pressure plate that says "NaN apocalypse"&lt;BR /&gt;- Press the button to place a torch&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 16:56:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Developing-Games-on-Intel/OpenGL-mix-function-not-working-correctly-with-Minecraft-shaders/m-p/1665023#M2577</guid>
      <dc:creator>djmrFunnyMan</dc:creator>
      <dc:date>2025-02-11T16:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: OpenGL mix() function not working correctly with Minecraft shaders.</title>
      <link>https://community.intel.com/t5/Developing-Games-on-Intel/OpenGL-mix-function-not-working-correctly-with-Minecraft-shaders/m-p/1665097#M2585</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/410902"&gt;@djmrFunnyMan&lt;/a&gt;&amp;nbsp;thanks for splitting the cases.&lt;BR /&gt;I'll check this one too&lt;BR /&gt;&lt;BR /&gt;Stay tuned&lt;BR /&gt;&lt;BR /&gt;Karen&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 22:24:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Developing-Games-on-Intel/OpenGL-mix-function-not-working-correctly-with-Minecraft-shaders/m-p/1665097#M2585</guid>
      <dc:creator>karen_intel</dc:creator>
      <dc:date>2025-02-11T22:24:02Z</dc:date>
    </item>
  </channel>
</rss>

