Replies: 5 comments 6 replies
-
If you check out the reaction-diffusion example I posted, all the dynamics are happening in the "rxnDiffusion" GPUProgram (lines 48-112): https://github.com/amandaghassaei/gpu-io/blob/main/examples/reaction-diffusion/index.js That GPUProgram solves the following: where: You pass in parameters into the GPUProgram via uniforms, so you'll need to define some extra ones for your equations. The Laplace operator is the same between your equations and mine, even though the symbol is different. So you can use the same "laplacian" calculation that I have in there. Hope that clarifies things, let me know if you have more questions. I'm really interested to see what this looks like! |
Beta Was this translation helpful? Give feedback.
-
Thank for the answer, I tried to rewrite the equations in a similar way as the example and I will try to code, somehow, this new set: I'll let you know if I can figure out. |
Beta Was this translation helpful? Give feedback.
-
if you take a stab at editing that GPUProgram code and run into trouble, I can help debug. Really interested to see what these looks like. Since you're not as familiar with js, you might also want to check out the demo.html page: |
Beta Was this translation helpful? Give feedback.
-
Ok, I think I am almost there. I spent a lot of time trying to understand everything, Let's see if I am doing it right. First of all, I've noticed that my equations above have errors (k parameter is missing) so the equations should be like this ones, with A and B instead of B and T for better reading: Now, in index.js I've changed some constants, uniforms, the main equation in rxnDiffusion and GUI parameters like so:
and finally the GUI:
The HTML page starts but I can see only a white canvas. The GUI works, I can change every parameter set but apparently with no effect. I think the problem is in the main equations in |
Beta Was this translation helpful? Give feedback.
-
you need to change the 1 to 1.0 in the shader code, otherwise it is treated as an int. |
Beta Was this translation helpful? Give feedback.
-
I am trying to test the Reaction-Diffusion example with some custom reaction-diffusion differential equations.
Unfortunately I am a completely newbie to JavaScript (I have experience with Python and a little bit of C#) so I am seeking for help and suggestions.
The equations I want to use and test are these, where B and T are the two chemicals as in the example:
The parameter I would like to be set via GUI are the ones in this table:
Someone could help me to achieve this? I will obviously share the results.
Thankks
Beta Was this translation helpful? Give feedback.
All reactions