Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In my game the water movement is done in a shader using Gerstner equations. The water movement looks realistic enough for a school project but I encounter serious problem when I wanted to do sailing on waves (similar to this). I managed to do collision with land by calculating quad's vertices and normals beneath ship, however same method can not be applied to water because XZ are displaced and Y is calculated in a shader :(

  1. How to approach this problem ?

  2. Is it possible to retrieve transformed grid from shader?

  3. Unfortunately no external physics libraries can be used.

share|improve this question
2  
The simplest option is to reproduce the equations for your water simulation on the CPU and apply them to the object you want to float. –  Byte56 Dec 15 '12 at 19:32
    
Perhaps you can define a "floating plane" on the ship where the top of the ocean always intersects. Then, after the water is calculated, orient the ship so the intersection of the water and the ship closely resembles the plane. I might be missing the point of the question, but that is my first thought. –  Eric Thoma Dec 16 '12 at 1:46
1  
a bit overkill, but you might find this article on the tech used for the same thing by Assassin's Creed 3 insightful and might give you some ideas –  codemonkey Dec 21 '12 at 13:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.