Like most people, I struggle with self-doubt — that sometimes-crippling feeling that you are simply incapable of doing something that you’d like to do.
As a story-teller, CG enthusiast, and life-long learner, understanding and creating GPU shaders has always been one of my highest mountains to climb, something that I have always been incredibly fascinated by, but always seemed so incredibly far out of reach.
Specifically, I’ve always been mesmerized by water… its hypnotic movement and dance with light is soothing, mysterious, and entrancing. Through the years I’ve seen countless GPU simulations of water and always wondered how people made them. Folks have tried to explain bits and pieces to me in the past, but every time they’ve attempted, I’ve felt a little dumber and little further away from believing I’ll ever understand how shaders work.
I guess you could say that I’ve been starring at the edge of the water, as long as I can remember, but never really knowing why…
Ok sorry, that joke was just too good to avoid — yes I used the word “good” to describe THAT joke.
Earlier this year, as we closed the chapter on Babylon’s 4.0 release and looked ahead at version 4.1, it was clear that the Node Material and its editor were going to be big, bold, and exciting new features for us to add to the platform.
Something else was also clear to me — this was a very important opportunity for me personally. It was an opportunity to finally dive into something that terrified me, an opportunity to start to climb my mountain, and to force myself to deeply learn about shaders. And I was going to do it with water!
I wanted to use Babylon’s new Node Material Editor to create a water shader and I was terrified and excited at the exact same time.
I started with the experts. If anyone knows how to harness the power of GPU shaders to create stunning visuals, it’s Nvidia. Their GPU Gems book series is full of fantastic visuals and detailed instructions on how to create them.
You’ll never guess what the first chapter of the first book in the series was about.
Ok, well, for someone like me… the title alone was pretty intimidating, but I didn’t start the climb up this mountain just to stop at base camp right?
Sine waves are up first. At this point I have a fairly solid conceptual grasp of the fact that people create water shaders by using mathematical waves to create patterns in geometry and then layer them together. Doing that practically, however… that was a different story.
Marching past base camp, I continue to read the article and follow along until we get to the very first equation.
All joking aside, this is where self-doubt punched me in the stomach… HARD. I had absolutely no clue what I was looking at. I was overwhelmed and discouraged. I closed the article, went home for the day, and looked up at the mountain completely convinced that it was never going to happen.
Lucky for me, there were two other important variables at play.
- One of my natural strengths is relentless stubbornness when it comes to learning.
- I’m surrounded by the world’s smartest and most encouraging teammates.
So, with the encouragement of my team and the spirit of learning pushing me forward, I put one foot in front of the other, dissected each part of the equation, and rebuilt it in Babylon’s Node Material Editor.
Getting to this point was an incredible feeling. While there’s far more mountain ahead of me than below — I’m actually looking down at part of the mountain! MY mountain! I pushed past self doubt, leaned on the help of others and started to climb. What a rush…and fuel to keep moving forward.
Ok, adding more Greek doesn’t help the intimidation factor, but I can’t stop. I’ve gotta keep climbing. As it turns out, this equation is actually pretty simple… all this actually means is that the overall height of any given vertex is a sum of multiple different waves. I actually understood that! So if I take my graph, duplicate the sine wave portion several times, change the parameters and add the result together I’ll get waves right?
YES! What a satisfying feeling! It’s working, and even better… I’m understanding it. I have pushed the self-doubt away and climbed further up the mountain.
I’m not done yet though. It’s awesome, but it doesn’t look enough like water yet. There’s still more mountain to climb. What I have at this point is a wave based on each vertex moving up and down… resulting in something too smooth. Real waves don’t just move up and down though, they move in all directions and have sharper peaks. From here, the path up the mountain gets even more intimidating: Gerstner waves.
Panic… that’s the feeling. Just when I think I’m understanding things, self-doubt begins to creep back in eroding my confidence all over again. It starts to convince me that the next part of the mountain is just too steep for me to climb. It’s too daunting. I can’t do it.
Time to once again lean on amazing teammates for encouragement and help in understanding.
This new equation is just 3 equations combined into something scary. I can break down each one and solve it a piece at a time. In fact I’ve actually already solved one of them.
This red part is actually the same as equation 2! It’s the equation for height. So I actually only have 2 more to solve, and they are remarkably similar.
I can do this!
No way! Look how high up the mountain I’ve come! Only a little bit further to the top. Now it’s time to add multiple Gerstner waves together!
So here’s what I’d like to leave you with from this story:
I’d be willing to bet that at some point in your life, you’ve faced your own mountain. You’ve looked up at a goal but were shackled by self-doubt, unable to climb, the feeling that you aren’t good enough overpowering your ability to move forward.
YOU have everything in you to succeed. You CAN climb up your mountain. It will take tenacity, passion, resilience, and encouragement, but you CAN battle self-doubt and win…
You CAN climb your mountain… and the view from the top is simply breathtaking.
Jason Carter — Babylon.js Team