[sharing is bang bang bang] Explody

Andrew Benson's icon

I had an idea recently to make a basic run-of-the-mill explosion effect in Jitter. Something like what you'd see in your favorite shoot em up bang bang video game. Originally, I wanted it to be a Jitter recipe, but as I dug into it, it started to get complicated. At this point, I just want to go ahead and share this as an exercise in going down the rabbit hole to make something cool. Included in this patch is a really handy geometry shader that takes a mesh of points and renders it as textured quads (great for particle fx), and a decent jit.gen implementation of basic particle physics. Hopefully the comments in the patch are enough of a roadmap for you to take it apart and have some fun too.

Andrew Benson's icon

Here's the attachment. OOPS

3414.explody.zip
zip
ćwiek's icon

sounds fantastic, but i get something like this :(

jit.gl.shader: -- START GLSL INFO LOG: fp --

0(69) : error C7532: global type sampler2DRect requires "#version 140" or later

0(69) : error C0000: ... or #extension GL_ARB_texture_rectangle : enable

0(74) : error C7531: global function texture2DRect requires "#extension

GL_ARB_texture_rectangle : enable" before use

jit.gl.shader: -- END GLSL INFO LOG: fp --

jit.gl.shader: GLSL program failed to compile.

ob3d_draw_preamble camera: GL Error: Invalid value

jit.gl.shader: -- START GLSL INFO LOG: fp --

0(69) : error C7532: global type sampler2DRect requires "#version 140" or later

0(69) : error C0000: ... or #extension GL_ARB_texture_rectangle : enable

0(74) : error C7531: global function texture2DRect requires "#extension GL_ARB_texture_rectangle : enable" before use

jit.gl.shader: -- END GLSL INFO LOG: fp --

jit.gl.shader: GLSL program failed to compile.

Andrew Benson's icon

Sounds like your hardware might not have very good support for geometry shaders. It varies a great deal across different graphics cards. What sort of GPU do you have?

ćwiek's icon

i am working on geforce 9600 gt.

Andrew Benson's icon

Actually, on second look, those errors are coming from a fragment program (not the geometry program), and your card should be able to handle it. Do other jit.gl.slab/shader patches work on your machine? What version of Max? What operating system?

ćwiek's icon

yes, the helpfile of jit.gl.slab is running great. i am using max 6 and windows 7 x64. thanks for interest :)

matmat's icon

hi Andrew
same thing here , windows 7 x64 too, nvidia gtx 580...

Andrew Benson's icon

If you go into jitter-examples/render/Shaders/ and try the gm patches do those work too?

matmat's icon

hi,
yes same error on gm.videopoint;
gm.solidpoint.demo and gm.illumilines.maxpat work fine...

jit.gl.shader: -- START GLSL INFO LOG: gp --
0(52) : error C7532: global type sampler2DRect requires "#version 140" or later
0(52) : error C0000: ... or #extension GL_ARB_texture_rectangle : enable
jit.gl.shader: -- END GLSL INFO LOG: gp --
jit.gl.shader: GLSL program failed to compile.
ob3d_draw_preamble initial: GL Error: Invalid value
jit.gl.shader: -- START GLSL INFO LOG: gp --
0(52) : error C7532: global type sampler2DRect requires "#version 140" or later
0(52) : error C0000: ... or #extension GL_ARB_texture_rectangle : enable
jit.gl.shader: -- END GLSL INFO LOG: gp --
jit.gl.shader: GLSL program failed to compile.

Luke Woodbury's icon

FWIW

Works for me with a Geforce 9600M GT and Max 6, but I'm on OSX.

Neato, thanks!

Andrew Benson's icon

Thanks to matmat, I think I've got a fixed shader for those of you on Windows 7 who are having trouble.

3420.ab.gmquads2.jxs
jxs
t's icon

Thank you, great stuff!

PS: I had to update to Max 6.0.4., gen didn't compiled in 6.0.3.

t's icon

the ab.gmquads2.jxs shader is really awesome! i wonder if there is any way to individually rotate the images? like you can individually set the opacity of each image...

Andrew Benson's icon

It's possible to encode the rotation information into one of the unused GL attributes, like normals or something, and then read that inside the vertex program and pass to the geometry shader for transforming the generated quad points. that was a little more effort than I cared to bother with for this particular thing. Alternately, you could do the whole deal with jit.gl.multiple and do all sorts of other things.

matmat's icon
Max Patch
Copy patch and select New From Clipboard in Max.

here an another basic explosion with physics....

matmat's icon
Max Patch
Copy patch and select New From Clipboard in Max.

with Text3d :

ygreq's icon

Hey Andrew,

Thank you for your patch. Unfortunately it gives me the errors below. I am on a Macbook Pro 2.8GHz, NVIDIA GeForce 9600M GT 512 MB. I tried both versions of jxs file.

class noise does not work in gen domain jit.gen
class concat does not work in gen domain jit.gen
jit.gl.shader: -- START GLSL INFO LOG: fp --
ERROR: 0:65: '' : #version must occur before any other statement in the program
jit.gl.shader: -- END GLSL INFO LOG: fp --
jit.gl.shader: GLSL program failed to compile.
jit.gl.shader: -- START GLSL INFO LOG: fp --
ERROR: 0:65: '' : #version must occur before any other statement in the program
jit.gl.shader: -- END GLSL INFO LOG: fp --
jit.gl.shader: GLSL program failed to compile.
name blip01 already in use. ob3d does not allow multiple bindings
class noise does not work in gen domain jit.gen
class concat does not work in gen domain jit.gen
jit.window: object with name thisguy already exists, generating a unique name
jit.gl.shader: -- START GLSL INFO LOG: fp --
ERROR: 0:65: '' : #version must occur before any other statement in the program
jit.gl.shader: -- END GLSL INFO LOG: fp --
jit.gl.shader: GLSL program failed to compile.

Andrew Benson's icon

Not sure what's up with the shader errors, but it sounds like you have an older version of Max 6. Go update to 6.0.4 and those gen errors should go away.

Tobias Rosenberger's icon

Hi thanks,

that's nice.
One question: If I want to make a "flame" or "fire" that can be animated (getting small, large...) I should take a "flame shader" as a starting point and bring it into jxs format, right? That's the easiest way? Or should I start to build something with particles within jitter? Or export an animation-file from blender or similiar software and then animate it?