Adding time to a shader #520
-
I apologize if my question is rather basic. How can I pass a time variable to a shader in your library? I was looking at modifying the Mandlebrot example to display this complex function plotter. complex_numbers.rs.txt I'm not sure what I should name the time variable. In Shadertoy it was called Thank you so much |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No problem. Simply define it in the shader and use the |
Beta Was this translation helpful? Give feedback.
No problem. Simply define it in the shader and use the
Program::use_uniform
to send it to the shader each frame. It would probably be simpler if the Mandelbrot example didn't use a material (similar to the triangle_core example) but just send the uniform value in the MandelbrotMaterial::use_uniforms. You can either compute the time in that material or pass it in somehow to the material from the frame input. The name of the uniform is completely up to you.