Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1] 2
  Print  
Author Topic: Storm at sea I (TV 6.5)  (Read 18198 times)
Waterman
Moderator
Community Member
*****
Posts: 1159


« on: February 19, 2005, 07:12:57 PM »

Here's 2 videos and 3 screenshots of the marine simulation i have been working on.

The ocean is made using an improved version of the Ocean.fx shader that comes with NVidia FX Composer. But the real work has been on developing generic physics calculation algorithms for the vessel (potentially several, but one only for now) seen in the picture.

Basically, the hull of vessel is simplified into 16 elements, each with independent calculation of various force vectors. Each individual element has a location and a size interpolated from a real vessel hull. Though, in this case i only managed to freeload a 3DS model of that British Hovercraft, so the physics behaviour is slightly trimmed to fit the special shape of that.

The physics calculation is a hybrid of custom code and the Newton physics engine. The repeated calculation first resolves the water surface height at each of the 16 points, by simulating a part of the shader code in application code. Then it gets the hull's current position, movement and rotation speed as given from Newton, and applies various forces (lifting force, various damping/counter forces, centrifugal forces, engine force etc.) and friction against the water. Then everything is composed into one total force and one total torque that are applied on the physics body, i.e. passed to the built-in Newton phyics engine. Newton then takes care of inertia etc. and re-positions the whole thing. This is a part of the "main loop", but i will probably later on slow down the in-code calculation to one or a few iterations per second.

Note that several elements are still missing in the simulation. This is still proto-typing. I am aiming at eventually getting a realistic simulation with real-world elements.



Sorry for the slow FPS. I am using a 650 MHz one for this, just to stay alert :-).

/ Waterman

Edit: Adding som info about the settings used in companion with the Newton physics engine.

The vessel is a single body, created using Physics.CreateBody 200000. That is, the mass of the vessel is 200 tonnes.

Then a box is added to the body, using Physics.AddBoxEx Body(#.TV.Glob.TV_3DVECTOR.New 28 2 10)0 0 0 0 0 0. That makes the hull 28 meters long, 10 meters wide and 2 metes high. These settings are not fully real, but close enough for that Hovercraft. They are important for Newton's inertia calculations.

The damping of the body is set to a constant Physics.SetDamping Body 0.001(#.TV.Glob.TV_3DVECTOR.New 1,1,1). The damping turned out to be one of the trickiest issues: I first run into a situation where the body just bounced up and down, or spinned quickly, etc. However, the Newton damping must remain small, because otherwise it slows down movement where there should be normal acceleration by gravity or simply no resistance at all (e.g. when the ship is partially above the water surface). So this is insted solved by calculating various counter-forces depending on momentary water displacement and applying them together with all other forces on the body.

Gravity is -9.81 AND SHOULD ALWAYS BE SO!!!

Newton solver model is linear.

The forces acting on the body easily grow to hundreds of kilonewtons and kilonewtonmeters.

All rotation using Sylvains excellent TV3D quaternions for mesh and camera, in companion with in-code maths.

Needless to say that the Newton engine does an excellent job here!!!

[edited links]
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
TroM
Customers
Community Member
*****
Posts: 300


« Reply #1 on: February 19, 2005, 07:25:15 PM »

Nice!  Cheesy

Are you using a volumetric fog ?
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #2 on: February 19, 2005, 07:38:07 PM »

Wow, really cool videos.  :shock:
But since it's 6.5, why no cool pixel-shader reflections on the water? Tongue I know, you're showcasing the physics, but still...
Logged

darqSHADOW
Administrator
Community Member
*****
Posts: 2817


« Reply #3 on: February 19, 2005, 07:54:19 PM »

Wow, simply, wow...  I've known for quite some time what you were working on, but I never expected this, amazing quality.  The fog looks to "roll" across the scene, and the water is simply beautiful!  Hell, take away the boat and the whole thing is STILL amazing!

Would you mind if I put the vids on our site, and linked to the Beta page?  I'd also like to post a msg over on the Newton forums, to show off what you've achieved in 6.5 and Newton.  (The Newton devs like to see their work in action, too.)  Wink

Again, great work man!

DS
Logged

TrueVision3D Project Manager
The fast and simple way of 3D development.
AriusMyst
Guest
« Reply #4 on: February 19, 2005, 08:06:09 PM »

Quote from: "darqSHADOW"
Hell, take away the boat and the whole thing is STILL amazing!


I just thought that needed to be re-said.

An I agree completely, i'd been waiting for a vid of this an its far better than I was expecting. Amazing.
Logged
BlindSide
Customers
Community Member
*****
Posts: 760


« Reply #5 on: February 19, 2005, 11:35:37 PM »

when I think about what can be done with 6.5, *this* is what comes to mind. Amazing job, gives us kiddie-coders something to strive for  :wink:
Logged
[Alvaron]
Community Member
*
Posts: 256


« Reply #6 on: February 20, 2005, 01:50:24 AM »

very nice Shocked

I hope TV3D 6.5 comes out soon Cheesy
Logged
potato
Customers
Community Member
*****
Posts: 800


WWW
« Reply #7 on: February 20, 2005, 02:14:34 AM »

Nice Waterman! Good to see those session with Sylv on IRC paid off! Cheesy

Absolutely stunning physics simulating. Makes me jealous  Smiley
Logged
Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #8 on: February 20, 2005, 07:43:31 AM »

Thanks to everyone for the feedback!

DS, i'll be happy if you can use this material to promote anything you wish. Please use! I'll edit to original post to include some hints about the Newton settings.

Should have mentioned in the first post: Sylvain has helped me to resolve several tricky issues. The man is an oracle! In addition, he is annoyingly often right :-).

TroM, no this is not volumetric fog, in fact something much more simple. I played around with darqSHADOW's excellent particle editor (6.5) and got the idea to create an emittor than throws out randomly a suitable amount of large billboards. So what we see is up to a few dozen ones, each scaled uo to be big enough to cover the whole FOV, and additionally set quite transparent. By doing some smart positioning of emittors and  attractors, and adjusting particle simulation speed, i can control the movement well enough. So in fact, the scene camera is a "rain god", everywhere else in the scene the weather is quite clear. The rain follows the camera wherever it goes. The billboard used is in fact included with the particle editor.

Zaknafein, there is in fact already reflection and refraction in the scene, but it takes only the environment (skybox) as input at the moment. Only that it's mostly covered by all that fog, so you can't really see the effect. I'll include rendering of a new environment map based on scene contents later on. And most certainly shadows as well, they play an important role out at sea.
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
gappy_
Community Member
*
Posts: 74


« Reply #9 on: February 20, 2005, 10:52:24 AM »

Wow ! I can't stand waiting for 6.5  .
Logged

Click to view my project. Smiley                                                                                        
  By Gappy
Dragoon
Community Member
*
Posts: 414


« Reply #10 on: February 20, 2005, 11:30:00 AM »

simply...stunning   :shock:  *faints*
Logged

TV3D doc (6.3):                           http://www.truevision3d.com/tvdna/
Wiki Tuts + 6.5 community doc:   http://wiki.truevision3d.com/
rocky
Customers
Community Member
*****
Posts: 956


« Reply #11 on: February 20, 2005, 12:24:35 PM »

Clap-Clap-Clap   Outstanding.....  Cool

The rolling fog (simulated volumetric fog) is something we have all been trying to achieve for quite some time. And hell if I can figure it out why none of us didn't think of your approch (particle ) to it earlier. Excellent effect!

Glad to see someone other than Javin has been able to achieve some fantastic results using the Newton physics code. I like many others have been trying to figure it all out without much success. Ok, then I'm the only one who is not fully gettintg it. LOL!

A few code physics snippets would be way cool if you could swing it.

All in all, this is some excellent results we all aim to achieve.

Rocky
Logged
potato
Customers
Community Member
*****
Posts: 800


WWW
« Reply #12 on: February 20, 2005, 04:25:15 PM »

Here's something: Have you tried testing the code with giant 50-foot tall waves? It'd be interesting to see if the physics holds out there Cheesy
Logged
BlindSide
Customers
Community Member
*****
Posts: 760


« Reply #13 on: February 20, 2005, 04:28:15 PM »

lol
Logged
GoodVillain
Community Member
*
Posts: 1631


« Reply #14 on: February 20, 2005, 05:11:00 PM »

Quote from: "potato"
Here's something: Have you tried testing the code with giant 50-foot tall waves? It'd be interesting to see if the physics holds out there Cheesy

The videos are cool, you should try what Mr. Potato Head said.
Logged
Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #15 on: February 20, 2005, 06:40:40 PM »

Rocky & others thanks for the replies. I'll try to come up with some more detailed pseudo code later on. As many of you already know, i am the guy who uses an interpreted language (APL), so this will be limited to general terms.

50 feet waves... that would be a wave height of 12.5 meters, which may very well appear in real-life situations. In fact, only a few weeks ago, there was a storm at the Baltic sea (the water surrounded by Finland, Sweden, Estonia, Latvia and Lithuania) with wave peaks at 17 meters, and an efficient wave height of around 10 meters, iirc.

A quick test reveals that the vessel cannot take it. Nothing wrong with the physics code, but Great Britain tonnage is simply not built for such environments.
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
isaac
Community Member
*
Posts: 70


« Reply #16 on: March 08, 2005, 05:29:54 AM »

can you help me? i need add water in a 6.5 landscape
Logged
Flatline
Community Member
*
Posts: 65


« Reply #17 on: March 08, 2005, 07:27:44 AM »

Firstly, this is the Showcase forum, and not really for questions, and secondly, there's a whole forum (allegedly) for 6.5 questions which you should be able to access.
Logged
nacra
Community Member
*
Posts: 47


« Reply #18 on: March 18, 2005, 12:05:15 PM »

Waterman, great look and feel.  The hovercraft interacts with the waves pretty nicely.  A little spray off the skirt will make it look very good.

I'm wondering how you handle damage and flooding with a single physics object?  
EDIT: after rereading I see you have 16 virtual compartments so I expect that answers my question.

And also wondering what kind of ship models (and poly count) you'd like for your prototyping - it sounds like you just got the hovercraft and weren't really after that type of vessel.
Logged
Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #19 on: March 18, 2005, 01:55:43 PM »

Thx :-)

Yes, the 16 compartments are essential for all involved dynamics calculation. Flooding will be a question of 1) increasing the total mass of the body and 2) adding a torque.

I'd like to point out two very essential things related to this, things that probably only people who have studied mechanics "know in their bones". A very simple thing actually, but not obvious for everyone:

A FORCE VECTOR ACTING ON A BODY
1) You are allowed move the point where the vector touches the body to any point on the body, as long as that point stays on the line described by the force arrow.

2) You are allowed to move a force vector (the "arrow") sideways to a different touch point, for example the center point of the body, provided that you also add an additional torque.

As simple as that. Think of those 16 compartments; each experiences a (different) lifting force (buoyancy) and i apply the sum of all lifting forces onto the center point of the body. However, since the vessel may be elevating, and the waves may lift it with different forces at different locations, i must also calculate torques. Each of the 16 lifting forces causes a torque around the center point of the body; and they can be summed into a single torque to apply on the body centerpoint.

The torque may then cause some of the compartments to sink deeper -> their lifting force increases -> the cause counter-torques -> we get balance. The situation is alive all time.

I am focusing on quite small vessels, between 10 and 100 meters LOA. Gonna have to buy them, there's some awesome ones available on the net.
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
Pages: [1] 2
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks