PDA

View Full Version : Newton Cradle demo...



savage
03-04-2005, 06:07 PM
Not content with getting 2nd Place in the PGD competition ('http://www.pgd.netstarweb.com/competitions/PGDCompetition2005.html'), over on DelphiGL.de ('http://newton.delphigl.de/'), Sascha Willems has announced a new Newton demo, based on a well known office toy.

<center>http://newton.delphigl.de/newton_cradle_1t.jpg</center>

You can download this interactive demo
here ('http://www.delphigl.de/files/newtoncradle.zip').

He has also recently updated the NewtonPlayGround ('http://newton.delphigl.de/') so that it now uses the current version of the Newton SDK (1.32).

Gadget
06-04-2005, 01:40 PM
That's really cool! You just need some sound now =D

It's amazing that you can actually interact with it like the real thing. I managed to get a few to swing over, and some to swing through the harness of the one next to it.

Was it easy to implement the newton engine?

Sascha Willems
06-04-2005, 02:30 PM
Yes, it was very easy to do this with Newton. It only takes about two dozen lines of code to build the physics for the cradle.

Sascha Willems
07-04-2005, 10:43 AM
After some complaints over on the Newtonforums, I updated the demo (link is the same). List of fixes :
Shadows now work on NVidia-cards
No more need for GDIPlus.dll (only W98/Me/2k)
More realistic light position and therefore more realistic casting shadows

savage
07-04-2005, 11:42 AM
Hi Sascha,
Any chance of the environment map on the balls being updated in real-time?

Unless this has something to do with my graphics card.

Sascha Willems
07-04-2005, 11:50 AM
I could implement that, but it would kill performance. Cause for each ball you need to render six different views to get a cubemap and this would have need to be done every frame for all the balls. Although one then normally renders the cubemap in a much lower resolution (maybe 128x128 would be enough for each cubemap face) it would still mean that you have to render the scene thirty times (5 balls and 6 textures) either each single frame or at least all 5 (or more) frames and together with the stencil shadows that would kill performance.

But when I find the time I'll implement it and see how much it impacts on performance.

Sascha Willems
07-04-2005, 08:21 PM
I couldn't resist ;) :

(Click for 800x600)
http://newton.delphigl.de/t_newton_cradle_shader_cubemap_1.jpg (http://newton.delphigl.de/newton_cradle_shader_cubemap_1.jpg) http://newton.delphigl.de/t_newton_cradle_shader_cubemap_2.jpg (http://newton.delphigl.de/newton_cradle_shader_cubemap_2.jpg) http://newton.delphigl.de/t_newton_cradle_shader_cubemap_3.jpg (http://newton.delphigl.de/newton_cradle_shader_cubemap_3.jpg)

I added water refractions using glSlang-shaders and as you can also see I added dynamic (updated every frame) reflections for all the balls using cubemapping. The reflections do really reflect everything, even the already reflection balls.

But the bad thing : It's painfully slow. My good'ol Radeon 9700 won't get more than 10 fps, but on the other hand it has a lot of work to do. Not only does it need to render 30 different views (for the reflection cubemap) it also has some shaderwork to do with the water and the balls itself, as I also apply sheen-lighting and details to the balls via a glSlang-shader.

So I hope those screenshots are enough, as I don't plan to release that version to the public.

savage
07-04-2005, 09:35 PM
It looks very sweet indeed. Why not release a binary with these changes, but have it as a switch that can be turned on or off, so that those with the hardware can see it in all it's glory, while those without can still play with it in real-time.
And you definately need to get some of these images up on www.flipcode.com/iotd, which would also be good PR for your excellent site.

Sascha Willems
08-04-2005, 06:53 AM
@ Newton's cradle :
You're right. I think I'll just check for the extension on starting and then enable what the card can do, this way users of better graphics cards get all the eye-candy. I already optimized some stuff last evening and now get around 30 fps.

@ ITOD :
I already had in IOTD there fore one of my games some years back. But I don't want too much exposure for my page, especially as feedback (except from forums) is almost non-existant.

tux
08-04-2005, 07:36 AM
wouldnt updating the reflection map every other frame work?

Traveler
08-04-2005, 07:41 AM
Looks indeed mighty nice! I really hope you change your mind about a demo as I can't wait to see what it does on my 6800GT

Sascha Willems
09-04-2005, 09:50 AM
OK, here you go : :arrow: download version 2.0 (http://www.delphigl.de/files/newtoncradle_v2.zip) of the demo (~2 MBytes).

Changes :
Some minor changes to the joints configuration, so that the cradle now
should act even more realistic
Dynamic reflections on the balls, using dynamic cubemaps
Support for some eye-candy on cards that support glSlang (Shader Model 2.0) :
* The dynamic reflection balls are lighting using sheen lighting
* The reflections on the water are now distorted to give a more realistic water effect


Here are two screenshots (click for 800x600) :
http://newton.delphigl.de/t_newton_cradle_shader.jpg (http://newton.delphigl.de/newton_cradle_shader.jpg) http://newton.delphigl.de/t_newton_cradle_noshader.jpg (http://newton.delphigl.de/newton_cradle_noshader.jpg)

left : Everything enabled, including shaders via glSlang. This can only be done on cards that support Shader Modell 2.0. It should work with all GeForce from 5200 and up and all Radeons 9500 and up.

right : Basic version that does not use shader. Reflections on the balls are still dynamic, works on all other cards.


P.S. : I could test the shaders and advanced stuff only on a Radeon 9700. Would be nice if GeForce (FX) 5x00/6x00 users could tell if it works and if it looks proper.

tux
09-04-2005, 10:34 AM
that is so cool.

would it be possible to make a screensaver out of it?

Traveler
10-04-2005, 10:48 AM
Well, it works like a charm!

I couldn't tell what fps I have with fullscreen, but in windowed mode its a near steady 60 (which is max for my lcd monitor)

Everyt effect is enabled and looks great, really excellent work!

My hat off to you!