reviews2

Through my long years of programming, I met one of my best and most helpful friends... GOOGLE!

Programming is a very difficult task with many moving, ever changing parts. As such it is nearly impossible to keep up with and know every possible technique and best practice. This is where Google comes in. Other people in the world have made numerous blogs, posts, videos, and sources that showcase how to do millions of things.

For me, I have put many of my projects and tools onto Github where, hopefully, other people can find them and learn from them like I have from others.

An example of times that I have used Google to research was when I was building my Volumetric Clouds system. There were many resources I used, but the main one being a video by Sebastian Lague. Coding Adventure: Clouds

In this video, Sebastian shows the process he took to making his own Volumetric Clouds system. He shows code, mess ups, and, most importantly, hyper detailed and descriptave viaualizations that makes an advanced subject such as raymarching easier to understand and grasp.

Something else I have looked into but not yet programmed was another theory for rendering. Sphere Marching, which is another implementation for raymarching that is used to render objects. What makes Sphere Marching special is that objects can be blended in all kinds of ways due to the nature of the Signed Distance values that are returned and the math that goes along with Signed Distance Fields.

Below, you can find various Signed Distance Field Functions that Inigo Quilez has so nicely made for us in his blog 3D SDFs

Sphere

float sdSphere( vec3 p, float s )
{
  return length(p)-s;
}
                          

Cube

float sdBox( vec3 p, vec3 b )
{
  vec3 q = abs(p) - b;
  return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);
}
                          

Torus

float sdTorus( vec3 p, vec2 t )
{
  vec2 q = vec2(length(p.xz)-t.x,p.y);
  return length(q)-t.y;
}
                          

Death Star

float sdDeathStar( vec3 p2, float ra, float rb, float d )
{
  // sampling independent computations (only depend on shape)
  float a = (ra*ra - rb*rb + d*d)/(2.0*d);
  float b = sqrt(max(ra*ra-a*a,0.0));
  
  // sampling dependant computations
  vec2 p = vec2( p2.x, length(p2.yz) );
  if( p.x*b-p.y*a > d*max(b-p.y,0.0) )
    return length(p-vec2(a,b));
  else
    return max( (length(p            )-ra),
               -(length(p-vec2(d,0.0))-rb));
}
                          

In my old Cloud system, I use a 3D texture of a cloud shape that I then march through and sample at various points. This data is then applied to a lighting algorithm and then drawn to the srceen. This is works great for speed, but is super limited when it comes to shapes and movement.

Chris Wallis, in his blog post, Volumetric Rendering Part 1, talks about using Sphere Marching to draw shapes that get the lighting algorithm applied to them. The result is a fast, customizable render of clouds. Here's another cool thing about this method, it isn't limited to clouds we can make super realistic, volumetric explosions, fire, smoke, and whatever else we can dream up by simply changing the coloring and lighting algorithms used.

These are advanced tasks, but I was able to pull them off quicker than I might've otherwise because I conducted quick and efficiant research. It is how we learn and is the key to growth, not just in programming.

Thank you for reading this far about my research, you can find the source for my volumetric clouds here.