Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-144608

Reloading a shader with modified vert/frag files won't update it

    XMLWordPrintable

    Details

    • Confirmation Status:
      Unconfirmed
    • Category:
      (Unassigned)

      Description

      If you have an existing glowing shader that works, then modify the vsh, fsh, or json file associated with it under the programs file, then reload the resource pack in game, it will not update to the new shader. This might be because the game caches the vsh/fsh files and thus if you want to see your updated shader, you have to copy the original vsh/fsh file and rename it and reference them instead. Additionally, the game retains the caches after every reload, meaning every compiled version of the vsh/fsh shaders since the game was launched will be unable to be reloaded until the game is restarted.

      TO TEST:
      1. Download the provided resource pack, then open up assets/minecraft/shaders/program/shaderreloadbug.fsh. Notice that the output color is vec4(1.0,0.0,0.0,1.0), representing solid red.

      2. Open up a world, apply the resource pack, and run /summon armor_stand ~ ~ ~ {Glowing:1b}. You should see your screen turn red.

      3. Inside shaderreloadbug.fsh, remove '//' to uncomment vec4(0.0,0.0,1.0,1.0) which is blue and add '//' to comment out the original vec4(1.0,0.0,0.0,1.0) which is the original red.

      4. F3+T to reload and you'll see your screen is still red.

      5. Rename shaderreloadbug.fsh to shaderreloadbug1.fsh. Open up assets/minecraft/shaders/program/shaderreloadbug.json and replace shaderreloadbug for the fragment shader with shaderreloadbug1. Save.

      6. F3+T to reload and your screen is now blue.

      7. For further testing, you can delete/modify/rename the fragment shader file with extension .fsh completely and simply change the referenced shader in shaderreloadbug.json to the two fragment shader names you created and you'll see your game turn red and blue respectively even though the fragment shader files are no longer there.

       

       

      Alternatively, you can test this by first summoning a glowing entity in game. Then copy out the shaders file from Minecraft's assets, then going into program > entity_sobel.fsh, and changing the code inside main() to just `gl_FragColor = texture2D(DiffuseSampler, texCoord)`. Reload the shader in game to see that nothing changes. You can swap back between the modified code and original to see if anything is changing. If you then rename the file to entity_sobel2.fsh, then go in program/entity_outline.json and change entity_sobel to entity_sobel2, you'll see the shader update in game.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                onnowhere Onnowhere
              • Votes:
                7 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: