My little sandbox app

Amazing! This is working wonderfully with anything that I can throw at it - great work! 😀 Support for holes is fantastic too.

Thanks so much for your hard work on this - are you releasing this under the same license as Box2D?

Cheers,
Simon
This is nothing compared to the stability and performance increase that a legitimate constrained delaunay edge-insertion routine would provide. I may need to add the other notch-slicing method for optimal polygon count should there be too many triangles, but in any case it should be able to handle as many points as you want to throw at it (thousands of vertices), which is ideal since at that point we're hitting the box2D limits. I do believe that the current implementation is bug-free as far as that's concerned, but one problem you'll run into is far too many sub-divisions of triangles, resulting in some little chunks being left out, or excessive slicing of parts that arent getting merged together well since the convex merging is not optimal (props to ewjordan for making it bug-free though, that function alone is loads tougher than what I did).

I'm going to keep adding functionalities to the sandbox, such as joints, but I'm not certain just how far it'll get before I go closed-source, since I'm planning to take a shot at going commercial with a game based on dynamic shape alteration (convex decomposition is a key component to that).

So i can't promise a really nice GUI or anything, at least for the sandbox app, but definitely expect to see functions added such as saving and loading shapes to data files, joints and joint motor controls, etc.

The convex decomp source code (and anything I put into this project) is on the SVN repository on the sourceforge page. A warning, though, my code isn't the cleanest...
That's really neat. Breakable objects will definitely be interesting.

(When I put asteroids/planetoids in my own game, I'll just have them break into smaller asteroids/planetoids since I'm lazy and that's how Asteroids did it. 😀)
I've successfully implemented full-scene motionblur using the accumulation buffer and I've figured out how to do texture mapped fonts and load in 32-bit alpha blended textures... You can see the texture that my fonts are to be built from, each letter except the capital W (which does not fit) is in one 64x64 sub-section. It's nice and flexible, but it is a MAJOR pain in the butt to create these font-images because they have to be adjusted and I've been doing it in GIMP. Plus for each different font you would need values for each letter to specify how wide it is, unless we are using a fixed-width font (which are not nice looking).

The motion blur automatically gets applied to anything in my engine which utilizes the physics interpolation, which in this case includes the camera itself, but not the bit that handles moving the camera around using the right-click drag, since that occurs on a per-frame basis... as a result, that motion isn't blurred. There is a significant performance hit by enabling this, and causes the app to be even more severely restricted by fill-rate than it already was. As such I will probably not enable it by default, and in the final product, probably run an automated machine speed test before choosing graphics settings. This build has multisampling and motion blur both set at 4 samples. Should run >60 fps on Radeon 9800 and faster hardware.

I continue to be amazed by the ridiculous smoothness and fidelity afforded by the combination of box2d, linear interpolation of physics states, vsync, and now, sub-frame motion blur (the way I implemented it, it is unaffected by framerate and instead controlled by a variable analogous to a camera shutter-speed).. especially with vsync enabled and working, the resulting animation quality is almost too realistic (gives that pre-rendered CG animation feel)

download: https://sourceforge.net/projects/box2dsandbox/ (get v0.25)
I can run 0.23 fine, but 0.25 gives me this error:
"The application has failed to start because its side-by-side configuration is incorrect."
I really wanted to see this motion blur. 🙁
(I'm in Vista right now, without Visual Studio installed)
I have never seen that error before. I think I compiled it in vc8 but I'm not sure anymore. I'll have to do it in Code::Blocks (mingw) i guess.

Edit: I no longer have that exact version of the code and am currently in the middle of writing something. I'll post a newer version that should work later.
Haha, I just noticed something pretty amusing. Since my code to draw the framerate (FPS) is in the render loop, and since it does a sort of averaging with a buffer value so that it's not jumping all over the place, the value changes each sub-frame during the motion blur accumulation. Result? if you take a screenshot or freeze the program (clicking the titlebar does the trick) the FPS reading's last two digits are usually blurred and it makes for a neat effect.
Mingw32 compiled code up on SF site as v0.299.

It's not really set up very well at the moment. You'll see that right now, left clicking will generate an animated box that spins and contorts and changes colors.. I just finished some code to render animations, and the code that defines the behavior of the box is something like this:

Code:
Animation b(box);
   b.setPos(mousePos());
   //C for color, P for position, etc ... the last argument is the time from start (think keyframes)
   b.addC(1,1,1,0);
   b.addC(1,0,0,1);
   b.addC(0,1,0,2);
   b.addC(0,0,1,3);   
   b.addP(0,0,0);
   b.addP(1,1,.5);
   b.addP(1,0,1.);
   b.addP(0,1,1.5);
   b.addP(0,0,3);
   b.addR(0,0,QUADRATIC_INVERTED);
   b.addR(90,1,COSINE);
   b.addR(360,2,QUADRATIC);
   b.addR(0,3);
   b.addS(1,1,0);
   b.addS(5,.5,1.3);
   b.addS(2,6,2.7);
   b.addS(1,1,3);
   b.addA(1,0);
   b.addA(.2,3);

Pretty flexible I think. It works on any openGL drawlist so it should be great for particle effects.

Also to see the motion blur in all its glory, press F8 for 1/5th speed slow-motion.

Unfortunately I think i've just about gone closed source at this point since I'm close to arriving at a game engine...
That worked on my Vista computer, awesome. 🙂
Making progress on dynamic breakage. There are a couple possible approaches, and I have been working on what seemed to be one of the easier-to-implement methods, which will, given a shape and a series of points, break up the shape according to the points, based on a delaunay triangulation.

A more realistic method to shatter shapes would be to make an evenly dense mesh throughout the shape, and use a stress analysis tool to determine along which edges the shape should be broken.

It would be rather hard to keep large shapes intact with the second method, even though it would look a bit more spectacular, and I think my first method allows more control over the style of breakage depending on the shape and properties of the set of points given. Of course if I ever successfully implement the other method I would love to incorporate a "glass" style brittle material which would shatter realistically.

Since I had a terrible time trying to debug geometry code earlier, I invested some time in some geometric debug routines, using which you can see that my algorithms are working great. The filled-in triangles are the triangles that are the result of the "damage" and will be separated from the main shape. I generated this with the zig-zaggy shape that's always been in this program (hey i had the vertex list handy..), and a series of 20 random points from x,y=3 to x,y=6. The pattern isn't quite that pretty and wouldn't look terribly good as the result of explosion damage, but I'm sure that with a refined point generator that makes circular arcs (with more points at the impact point than elsewhere for example) would make for a great effect.

Image

All that remains for me to do is to come up with a way to separate main shape pieces that have been broken apart by the damage, since I need to have a list of edges for every shape, but I only have the set of triangles. In the example, that third spike up from the bottom should now be completely disconnected from the main shape. I have an algorithm for the outline edges (which works well as you can see in the picture) but I need to convert it from a list/set of edges into a list/set of polygons (each made up of an ordered list of vertices).

Original thread: https://box2d.org/forum/viewtopic.php?t=975