Posts

Showing posts with the label Ocean

Row, Row, Row Your Cube!

Image
When it comes to game development, the precursor of a sailboat is a sailcube! For buoyancy, I place a series of ‘test buoys’ around an object.  Each frame the object checks if those points are above or below water.  If significantly above, it applies gravity, and if significantly below, it applies upwards buoyancy.  If somewhat above or somewhat below, it applies a smaller force.  The result is an object that bobs and tilts with the water. Simple buoyancy When I implement the full ships, I will need to optimize each for the right balance of weight and ‘floatiness’.  This ultimately depends on the shape, mass, test buoy positions, and dampening.  I currently have an issue where the buoys do not account for horizontal displacement of the waves when determining if they are above or below water on steep waves, resulting in a momentarily floating ship or a ship that takes a little too long to rise with a wave.  I will test how significant ...

Ocean Simulation- or, Thank Goodness I Took Computer Graphics

Image
OceanConstructor Developer controlled settings As I dove into ocean simulation, I remembered a joke we used to tell in undergrad computer science classes.  “We’re just coming up with increasingly complicated ways of being lazy.”  To avoid the tedium of manually animating water, I coded a model based on Gerstner waves.  Detailed in Mark Finch’s Nvidia’s GPU Gems chapter ( linked here and below ), Gerstner waves determine the horizontal and vertical shift of a point in space as a wave passes.  Summing the displacement of several varied waves produces a naturalistic undulation. My current system in the Unreal Engine consists of three elements—a Blueprints ‘OceanConstructor’, a shader, and a C++ ‘OceanManager.’ The OceanConstructor class generates a dynamic material instance of the ocean shader, allowing for definition of parameters at runtime.  The developer chooses the number of waves to sum, the general wind direction, wave steepness, varia...