Viewport texture pink when used in multimesh and project run

Godot Version

4.2.2

Question

I’m trying to make a multimesh to render grass which sets its colour based on that of the ground below it. To do this, I have a camera overhead rendering to a viewport, which is then passed to the grass mesh shader, which reads from the viewport texture and sets its colour accordingly. In the editor this is working just fine, but when I run the project, all the grass turns pink. If I replace the viewport texture with another texture, the grass shows that texture. Further, if I use just a single mesh, not in a multimesh but by itself, it works both in the editor and when the project is run. Does anybody know why this might be, what I need to change to fix it, or if I’ve gotten something fundamentally wrong.


It’s sorta hard to see but the squares are the billboarded multimesh meshes when viewed in the editor, which are correctly showing the texture from the overhead camera.

image
Then the same thing, except when the project is run. Now the meshes are pink :frowning:

image
The shader for the meshes

Thanks!