Home 128
Post
Cancel

128

I know almost nothing about the intricacies of graphics programming. I don’t know how to swizzle a matrix or whatever it is graphics programmers do. I know that swizzling is a real thing, and I think I may have even done it once or twice, but I’m not sure I could tell you exactly how or why. I don’t have the words.

I recently updated a shader I had created so that it would work in Unity 5. There were some small bugs that previous version of Unity were fine with, but the latest version just could not abide. Every object using this shader would come up fuchsia. Fuchsia is a terrible color. That’s why it is used to spotlight an error. No one would ever willingly use fuchsia. To some part of our lizard brain, fuchsia means broken.

The bugs were relatively minor, but it still took me quite a while to track them down and fix them. Not because the shader is particularly complex. It isn’t. It was because, even though I had created this shader entirely from scratch, adjusted and set each variable, and used elements of the render engine in ways that, at least I, think are somewhat clever, I had never actually looked at the code.

I used a visual, node based shader editing tool to author the shader. I can already picture the indignant sneers of the coding grognards out there. There is a contingent of the game dev community who even regard a pre made game engine, Unity Unreal and the like, as if it were an especially pungent cheese. I may not have made the most inventive or precision tuned shader ever, but It creates a look that was not available through any simple means. It is unique, and while it may be a problem that a very few people have, the shader solves a problem. That’s what good tools do.

I occasionally drift into the wonderful world of linux, unix, dos, and command line interfaces. I grew up using the command line. My childhood was populated with computers that were completely impenetrable to the uninitiated. Flashing cursor boxes and arcane commands like LOAD “*”,8,1 were common. I still habitually type ls when I mean to type dir. Z80 basic is a major part of my construction as a human. I have it in me to be the uber geek that looks down his nose at gui based tools, yet I bristle at the comment that using the command line is more efficient.

I have driven many stick shift vehicles. They are not more efficient than driving an automatic. A practiced driver can accomplish things with a manual transmission that an automatic vehicle might not be capable of. They have more options available, but I think it is important to never mistake options for skill or efficiency. The learning curve of an automatic vehicle is significantly smoother. It lets the driver get better faster. Knowing how and when to shift gears is much less important than learning to be a good driver.

I view writing code in much the same way. I often find that variances in syntax hold me back more than the actual problems I’m trying to solve. Since I’m not hip deep in the programming language of the day, I spend most of my time looking at documentation, and a small amount of time actually writing code. Gui based development tools are like an automatic transmission for code. The learning curve is smoothed out. That doesn’t mean that it’s not important to know what is going on under the hood.

Since I had created the shader, even if it was with a gui based editor, I was able to walk through the code looking for landmarks that I had placed to ferret out the offending bits. Creating the program in a streamlined way allowed me to better understand what was actually going on in there. If I had sat down with openGL documentation and a book on shader programming, I would probably still be sitting there with no shader to show for it. As it stands, I have it running in two versions of the engine and I’m well on my way to making it work with the new Unity lighting model.

Even now I feel like I’m being overly defensive of visual scripting and programming systems. There is a part of me that use to set up batch renders using small unix scripts that feels like shader editors and node based graphical programming is a cop out. It’s coding for babies. Maybe it is, but babies learn faster than any other human, and they learn by testing the world and getting feedback. They don’t learn by building up layers of theory that they eventually employ in one triumphant effort. Test, receive feedback, adjust, test receive feedback, adjust. That is what these tools let you do.

Mostly I am just trying to justify buying Shader Forge, since the free shader editors don’t work in in Unity 5.

This post is licensed under CC BY-NC-SA 4.0 by the author.
Trending Tags
Trending Tags