Update at bottom of the article after the break, how I got rid of the springiness in game physics.
This last weekend, my girlfriend and I went to Vegas. We had a lot of fun, but for some reason it always gets me in this mood. I just love the thought of Vegas, and gambling. We've been home for a few days, and I felt like testing out blender's physics engine.
She loves to play roulette, and personally I like craps, and the video poker machines. I just love poker chips.
I have a stack of poker chips here at home, I love the way they feel, and clink. Mostly, I enjoy seeing them bounce around on a table or the floor. Playing with them I got an idea, I'm sure people have done this many times before.
I built two stacks of chips in this simple render, and let the blender physics take over. I recorded the simulation to f-curves using blender game. I changed the background of the blog to a still frame from this video.
Now, some issues I ran into:
I started with the basic physics, and noticed that everything landed just too far apart, chips didn't even touch to collide. I know this was the collision bounds for the objects. I adjusted this to Convex Hull, I then turned down the margin to make it acceptable. But still, it bounced around all weird... Some of the chips hit through the table, not what I wanted. They bounced as if they were on a trampoline.
I played with everything I could think of to make it act right, till I thought about it, the objects were relatively too small!
For anyone wanting to create this scene, take into consideration the size of your objects. This goes back to my blender fluid simulation tutorial, too small and you're playing with ant sized poker chips, relative to the physics.
If things are reacting weird with colliding objects, select everything and just scale it up.
Turn down the margins, to about 0.05 to where you don't see a gap between objects when they touch.
Another issue is when they fell and bounced, they didn't seem to have much weight to them, so scaling up the mass to about 10 fixed this. After running the game engine I noticed they had a bounce from when they all stacked up, this may be due to the margins being too big still, but I haven't played with it enough to fix it, so I just rendered it out with it in.
Now, I'm not satisfied with the materials and the lighting, this was more a test of the physics to get it working, but I modeled the chips to what could be recognized as a poker chip. I would like to put a custom graphic on them, but this would take more time than I was interested in investing in this quick build.
The render time is shown in the frames of the video.
Camera focal length set to 23mm.
Focus Distance: 13.58
Aperture Size: 0.13
Samples: 150 per frame
Full Global Illumination defaults
Film Gaussian Width: 0.70
Frame Range: 50-500 @ 24fps
An afterthought of the render, and setup would be to use fluid simulation to throw the chips out as particles. I'd like to add more lights, but I think in a post production (done with enhancements in youtube), this could be modified quickly. I also noticed that things stopped moving and didn't fall correctly after about frame 450, which is odd, but I think it's just something I hadn't done with the physics.
Lastly, In the blender game I had the physics running at 30fps and the animation at 24fps. This caused it to go into slow motion, not intentional. Something to look out for... I may re-render this but it took a few hours to do, so I might do it tomorrow or over night.
So as an update I tried to figure out what caused the spring in the physics. Found this weird option in the world settings while in blender game engine. Obstacle Simulation, Type: RVO Cells.
This produced solid impact and collisions with obstacles, being the table and other chips. No bouncing through the table, no spring when the chips stack up.
I'm much happier with these results, they feel accurate to real physics. The resulting blend file is here and in the files list page. I'm off to bed, and tomorrow I'll play with the materials a bit and see if I can get a good felt look and some kind of icon on the chips.
If you want to do something similar, build a poker table scene, and use the physics, I'd love to see it. Let me know what you think, and share your results.
Post a Comment