- Home /
Writing a shader that creates an infinite number of water ripples
I would like to write a shader that can draw water ripples onto one object; however, I can't seem to make the shader render multiple occurrences of these ripples without manually specifying ripple1Origin, ripple2Origin, ripple3Origin, etc...
Is there a way to configure the shader so that it can just spawn in a new shader at a random point without manually telling the shader that it will have to render a fixed number of ripples? Is there a way (hypothetically, of course) to write a shader to take a mutable array of points or something?
Answer by Namey5 · Jul 09, 2020 at 11:41 PM
Probably not in the way you're imagining. If you want to see one way of doing this by purely manipulating image data, this video goes through the process;
https://www.youtube.com/watch?v=BZUdGqeOD0w
This is kinda the situation that custom rendertextures were designed for, but they can be pretty hard to work with. Just make sure that you either use double buffering or two textures so that they can render into themselves.