

An Overview of Phong Shading in GLSL - mattdesl
https://github.com/stackgl/glsl-lighting-walkthrough

======
yoklov
Does `#pragma glslify : foo = require('foo')` leave an awful taste in anyone
elses mouth?

Not sure if it's because it's totally opaque, or because it adds a dependency
and potentially a whole heap load of transitive dependancies. You're putting
your game/app/whatever's performance in the hand of someone else (moreso than
for infrequently run CPU code), not only hoping they didn't write a crappy
implementation of whatever, but hoping nothing they depended on did either.

Not to mention, they might have done it differently than you would. For
example, lots of times you want to do gamma correction using square/square
root, and not using pow 2.2 (monitors vary so much that this is in all
likelihood just as/nearly as correct, and it's vastly cheaper).

... Also, you'd think in a discussion about how to do most of these things,
they'd actually show the code and not just say 'oh a library magically handles
it'

~~~
jawngee
As someone who writes a lot of glsl (for effects for a video editor, not for
3D), I ended up writing my own preprocessor to include dependencies (and to
"patch" differences between GLSL ES and regular GLSL). Package management is
the next logical step, so I personally don't see a problem with it.

It's like anything, you're not just going to dump a third party library into
your code and hope for the best. You're going to see if it does the job, does
the job well, and if it doesn't - you'll figure something else out.

~~~
codeka
This is something I really miss from a few years ago when I was using Cg to do
my shaders. It had (what I would consider) fairly basic features like #include
and the ability to specify texture states and so on within the shader file.
Now I have to do all of that manually, or write my own preprocessor or
something...

------
bhouston
Nice tutorial. :) It is impressive the breath of glslify coverage there is.

