Tuesday, November 20, 2012

Physics Demo & God Rays


This is a physics  and graphics demo written in C# using XNA.
It demonstrates a number of point-based physics techniques in the form of force generators.
These generators apply forces to objects in forms such as collisions, gravity, springs, bungees, cables, and rods.

The first video demonstrates most of the physics techniques in their simplest form, so you can see what each one does. In order of appearance, the demos in the video are:

1. Orbiting planets (small ones orbit large one)
2. Objects connected by a spring
3. Objects connected by a bungee
4. Objects colliding in gravity (two demos)
5. Objects colliding in zero gravity
6. A pool ball demo
7. Objects connected by a cable (cables have a max length but can be compressed)
8. Objects connected by rods (rods cannot be stretched or compressed at all)
9. A Newton's cradle demo

The second video is just me showing off the gravity and collisions, and a demo of my favorite feature, what I like to call THE CLUMP. Essentially, it's a giant ball of planets all attracted by gravity. Just watch and enjoy it!

As for the god rays, they are a post-process shader written in HLSL.
God rays are cast whenever an object is in front of a light source (in this case the sun).
You can see them most clearly in the second video.
These particular god rays are an implementation of the light rays described in GPU Gems 3.

p.s. Sorry, but YouTube destroyed the quality of these videos :(