Page 1 of 1

2D Fluid a-la Plasma Ball via shaders?

Posted: Wed Aug 01, 2012 4:32 am
by Flojer0
I'm curious if anyone more in the know than I would know if something like this would be feasible:

http://www.youtube.com/watch?v=NDjseVmruH8

I believe the developer of said game used the vertex shaders to do all the work. And I can run this on a laptop of mine that has a graphics chip that doesn't appear to be much more powerful than the graphics of the pi.

Again, I'd like opinions/statements on how possible something like this fluid would be before I go unicorn hunting trying to make it happen myself. Thanks

Re: 2D Fluid a-la Plasma Ball via shaders?

Posted: Wed Aug 01, 2012 2:45 pm
by mnajera
This post may be helpful: http://stackoverflow.com/questions/6367 ... sma-shader.

You can also look at the hello_triangle2 code for an example of how to use vertex and fragment shaders in your program. Based on how well hello_triangle2 runs, the Pi should have no problem running the kind of plasma effect you're thinking about.

[EDIT:]

I just remembered about this site, which lets you play with various shader effects: http://www.iquilezles.org/apps/shadertoy/.

You can see a plasma effect (and a lot of other cool ones) in action, and you may be able to directly use the source code in your own program (with proper credits to the original author, of course).

Re: 2D Fluid a-la Plasma Ball via shaders?

Posted: Wed Aug 01, 2012 7:54 pm
by Flojer0
Neat, thanks for the extra resources. I'll have to take a look and see what I can pull together. I've been brainstorming for awhile for something interesting I can make game wise on the pi. If this works I'll have to see what I can do. Already have some thoughts simmering.

Re: 2D Fluid a-la Plasma Ball via shaders?

Posted: Wed Aug 01, 2012 8:11 pm
by dom
mnajera wrote: I just remembered about this site, which lets you play with various shader effects: http://www.iquilezles.org/apps/shadertoy/.

You can see a plasma effect (and a lot of other cool ones) in action, and you may be able to directly use the source code in your own program (with proper credits to the original author, of course).
And shadertoy has a Pi port:
http://www.raspberrypi.org/phpBB3/viewt ... 6&p=117404

Re: 2D Fluid a-la Plasma Ball via shaders?

Posted: Wed Aug 01, 2012 9:11 pm
by mnajera
dom wrote:And shadertoy has a Pi port:
http://www.raspberrypi.org/phpBB3/viewt ... 6&p=117404
Awesome.

I just spent a non-trivial amount of time trying to get a plasma shader working on the Pi. It works under Ubuntu, but the Pi version (using my admittedly crappy cross-platform SDL/OpenGL wrapper) is having problems compiling the shader. Now I can look through the shadertoy source to see what I'm doing wrong.

I'm surprised I didn't come across the shadertoy port earlier. I've been searching these forums for all manner of errors related to glUniform, ect., trying to figure out why my stuff wasn't working.

Re: 2D Fluid a-la Plasma Ball via shaders?

Posted: Thu Aug 02, 2012 4:02 am
by Flojer0
Just to make clear in case it wasn't earlier. What I'm primarily after is the fluid simulation itself. I'd imagine it would be possible on some scale seeing as there is a respectable amount of power in the GPU. I just wanted to touch base and see that my assumptions are sound. Or now that I have decent confirmation that the pi supports shaders well enough to at least attempt it I could just try and write the code and test performance myself!

I think I'll do that when I find the time, I can let you know if I come up with anything cool.