-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Description:
When running identical GLSL shader code on the VSCode shader-toy extension and the shadertoy website, this water caustic effect behaves differently. The original code (as used on Shadertoy.com) produces the intended look, while the VSCode preview renders the water layers incorrectly (resulting in blown‐out white areas).
Expected Behavior:
The shader should produce an identical water caustic effect on both the VSCode shader-toy extension and theshadertoy.com website since they are using the same GLSL code.
Actual Behavior:
- Shadertoy.com:
The original code renders water layers and highlights correctly. - VSCode Extension:
The original code results in a white or blown-out image, where adjusting the thresholds/inequalities (as shown below) is necessary to match the intended visual output.
Steps to Reproduce:
-
Original shader (Shadertoy.com):
- Link: https://www.shadertoy.com/view/wdG3Rz
- Running this on Shadertoy.com produces the expected water ripple and highlight effects.
-
Original shader in VSCode Extension Preview:
- The identical code produces a blown‐out white output, with water highlights not rendering as expected.
- code to run on vscode preview: https://github.com/meisei4/shadertoy/blob/main/shaders/ref_for_galaxy.glsl (apologies for the local file paths)
Original shader in VSCode preview:

- Refactored Version in VSCode:
In order to correct for the blown-out output and achieve a similar visual effect in the VSCode GLSL preview, I adjusted lines 44~50 to invert the inequalities and the threshold values as follows:
Original:
if(avg(water1 + water2) > 0.3) {
alpha = 0.0;
}
if(avg(water1 + water2 + highlights1 + highlights2) > 0.75) {
alpha = 5.0 * opacity;
}Refactored version:
if(avg(water1 + water2) < 1.7) {
alpha = 0.0;
}
if(avg(water1 + water2 + highlights1 + highlights2) < 1.25) {
alpha = 0.5 * opacity;
}Refactored Version in VSCode preview:

- full refactored code: https://github.com/meisei4/shadertoy/blob/main/shaders/ref_for_galaxy_vscode.glsl
- And while this is not a perfect correction to replication, it at least seems to demonstrate what might be leading to the discrepancy in the behavior? I don't understand why this is happening though.
- Refactored shader in shadertoy website view:
- For comprehensiveness, conversely when i run the refactored version on the shadertoy website it eliminates much of the caustic highlights from the original
Refactored Version in shadertoy website preview:

Textures used:
source: https://shadertoyunofficial.wordpress.com/2019/07/23/shadertoy-media-files/
Gray Noise Small texture 64x64
Environment:
- Shader Toy Extension Version: 0.11.2 (Last Updated 2025-02-01, 12:40:24)
- VSCode Version: 1.97.2 (Commit: e54c774e0add60467559eb0d1e229c6452cf8447)
- VSCode Architecture: x64
- OS: macOS 12.7.6 (Build: 21H1320)
- Kernel: Darwin 21.6.0