Development Diaries, Volume 2
Posted by Alex Jordan on
Why hello there, friends. I bet you're wondering if I managed to fix the problem discussed at length in my previous Development Diary. Well, you're in luck! I fixed that problem, only to create more problems. All in the time-honored tradition of video game design, I can attest.
I decided to tackle the issue by creating a shader from scratch and stripping out most of the other bells and whistles that cluttered up the one I want to use. (What is a shader? Wikipedia can tell you, or I can simply say that it literally "shades" the screen, drawing models where I want them and how I want them to look.) That means no normal mapping, no environment mapping, no specularity, etc. I took a couple of minutes and whipped up a quick shader that handled texturing and lighting. That's it.
I easily recreated the problem. Why was I happy that I recreated it as opposed to solving it, you ask? It meant that the logic in my shader design was sound. That could only mean one thing: I was feeding variables to the shader incorrectly, i.e. giving it the wrong instructions. I fiddled with the variables until, TA DA! I got it to work!
What this video doesn't really show is my new problems.
The video shows me moving the sphere left and right and rotating it. You wouldn't know unless you were behind the controls, but the sphere kept sliding when I tried to move it, even after I took my finger off the keys. Furthermore, you'll notice that, unlike the last video, when the sphere rotates, it doesn't rotate around the sphere's vertical axis. It kind of twirls around, making a small circle instead of spinning tightly in place.
So where does that leave me? I've surmised (correctly!) that my issue is not with the shader, but with the instructions I send to the shader, or the manner in which I send them. Changes I made to order and syntax fixed the problem of how the model draws but created new problems as to where the model is drawn.
Here's what I do next:
- Work on syntax and instructing the shader until I reproduce the desired results on my simpler test shader.
- Once I figure that out, instruct my more advanced game shader in the same manner to reproduce the same results (but with better graphics).
- Once I'm satisfied that everything's working like it should, that means it's time to take the advanced shader, the instructions, and apply it to an actual game.
And that makes me happy in the pants. Stay tuned!