Tag: 3d

Simulating Hydraulic Erosion of Terrain
Hydraulic erosion is a naturebased algorithm that simulates erosion caused by water on terrain. It is useful to make procedurally generated terrains look more realistic & interesting. Hydraulic Erosion Overview Water from mountains come down through slopes, forming creases along the way. This water is then accumulated as is travels, causing the formations of streams.…

Marching Cubes Algorithm
In a Nutshell Imagine that you have a 3D space having a color assigned to each point ranging from black to white. Now imagine that you take a reference color, for example grey; and call whatever is lighter than it to be “inside” and whatever darker than it to be “outside”. Now to enforce this separation,…

3D Procedural World Generation
In procedural geometry generation, we need two things: algorithms to define the shape & algorithms to construct it. Those algorithms that define the shapes are often based on perlin or simplex noise & other mathematical functions. These often take spatial values (xyz values) in its inputs & return the vertex displacement value. The other class…

3D Boat Physics
In a Nutshell When an object is submerged in a fluid, it displaces the surrounding fluid. This displacement results in the elevation of the fluid around the object. As the fluid is lifted against gravity, it gains potential energy. The source of this potential energy is the work done by the object in displacing the…

3D Grass Shader with Distortion & Wind
In a Nutshell Player interact distortion: Calculate a vector that points away from player position & assign it to the vertex. This will move the vertex away from player position. This is the core concept behind grass distortion due to player standing on it. (Yes, in reality, you’ll need to normalize this vector, and only apply…

3D Refraction Shader
After you have created vertex part of ocean shader using gerstner waves, you can make your ocean look more better by adding refraction effect for objects under the surface. Bird Eye’s View We need to sample screen texture with distorted UVs based on normals of object. Then we mix the screen texture color with object’s…

3D Ocean Shader Using Gerstner Waves
Sine wave displaces vertices up and down. Gerstner wave, in addition to this sinebased yaxis displacement, also does horizontalaxes displacement of vertices using same sinewave. Imagine a surface made up of many points. Suppose we apply sine function like this: