Repository: godot
Issue: Modifying an Instance Shader Parameter seem to affect Instance Shader Params of Next Pass materials
Labels: discussion,topic:shaders

### Godot version

v4.1.1

### System information

Godot v4.1.1.stable.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 30.0.14.7212) - AMD Ryzen 7 5800X3D 8-Core Processor (16 Threads)

### Issue description

It seems that setting an instance shader parameter from code changes instance params on the "next pass" shaders as well. 
What I would expect to happen is that these shaders and their instance uniforms are completely decoupled and independent from one another. Below I describe the set up I have and there is a gif showing the effect. project file attached.

In the attached project, I have 3 simple custom shaders. 
1. SHADER 1 - has an exposed color instance uniform, that albedo is set to. 
![image](https://github.com/godotengine/godot/assets/81264039/67d0b027-143f-409c-bbff-6e1097041bf4)
2. SHADER 2 - (this is the "next pass" on SHADER 1) - has an exposed color instance uniform that albedo is set to, it is multiplied by sin(TIME). this shader is blend_mult and unshaded so it should just be multiplied on the existing SHADER 1 color. 
![image](https://github.com/godotengine/godot/assets/81264039/40a451ff-746e-430c-8241-0d32e3f9f22b)
3. SHADER 3 - ( this is the "next pass" on SHADER 2) - has an expose instance uniform float that controls the size of the model in the vertex function. again blend_mult and unshaded.
![image](https://github.com/godotengine/godot/assets/81264039/9624560c-7da9-4e00-8157-e3aff4fa7001)

I then have a sphere with a collider that I call set_instance_shader_param from on mouse enter and mouse exit, changing ONLY SHADER 1's color parameter. I observe differences in all "next pass" shaders down the stack. 
![ezgif com-crop](https://github.com/godotengine/godot/assets/81264039/a3c2cab3-ce21-46b8-97e2-e2bd5726386b)
It seems to lose the yellow color immediately from SHADER 2, this instance param is not set anywhere but on the shader initialization
and the size from SHADER 3 seems to get reset every time the mouse is either on or off the sphere

Ideally mousing over would just change the base color on shader 1 between blue and red, 
the yellow multiply color from shader 2 would always stay consistent
the size and presence of shader 3 would stay consistent. 

I'm not sure exactly how the next pass is supposed to work, please correct me if I'm wrong but I wasn't expecting that changing the color of one pass shouldn't affect seemingly unrelated factors of other passes.


### Steps to reproduce

1. make a shader with an instance uniform 
2. make a second shader with an instance uniform
3. make a material for shader 1
4. make a material for shader 2
5. set shader 1's 'next pass' field to shader 2
6. change shader 1 instance parameter via script
7. observe shader 2's instance parameter either being changes or improperly rendering

### Minimal reproduction project

[SetParamOnMouseOver.zip](https://github.com/godotengine/godot/files/12923619/SetParamOnMouseOver.zip)
this project is the ball project shown above, uses same recreation steps but with 3 shaders.