GPU Programming for Video Games
Homework #4: A Portfolio-Quality Surface Shader
Due: Friday, July 15 at 23:59:59 (via T-square)
Late policy: The homework will be graded out of 100 points. We will
accept late submissions up to Saturday, July 16 at 23:59:59; however,
for every day that is it is overdue (including weekend days),
we will subtract 30 points from the total.
(We understand that sometimes multiple assignments hit at once, or other
life events intervene, and hence you have to make some tough choices. We’d
rather let you turn something in
late, with some points off, than have a “no late assignments
accepted at all”
policy, since the former encourages you to still do the assignment
and learn something from it, while the latter just grinds down your soul.)
The main goal of this assignment is to have fun! If you are not having
fun with this assignment — you’re doing it wrong. 🙂
Write an interesting Surface Shader that uses a custom Lighting model
(i.e. not the built in Lambert or BlinnPhong),
and create a Unity scene that
effectively demonstrates how interesting it is using free 3D models
from the Unity Asset Store. The shader should meaningfully react to
Unity’s lighting system in some way — that’s the point of the Surface
(As an aside,
someone needing a stylized shader that ignores Unity’s
built in lighting is better off writing vertex and fragment
It should also use textures in some creative fashion
beyond conventional “base maps” and “normal maps.”
Use of vertex
final color modification is not required,
but can use those facilities if you
find them useful for your goals.
As a general guideline,
the more specialized your shader is,
the better; that may help ensure a variety of different
shaders so I won’t get bored while looking through them.
(But that’s much more of a vague suggestion than anything
resembling a rule.)
The goal is to create something that you would be proud enough of to
include on a website portfolio that you would point a potential employer
too, but also simple enough in scope that you can complete it in the
given time frame.
There are countless shaders available in books, papers, and blogs; you
should draw inspiration from these without copying any of them directly.
A guilding principle is that your shader should be sufficiently original
that you could sell it on the Unity asset store without worrying that
someone might accuse you of plagarism. (Of course, for some common
one-line formulas, there are only so many ways write them.) Be sure to
properly cite your sources! (For instance,
I think the
physically based shader framework
provide some good examples of citing sources, for instance, where
they cite a writeup on The
Possible approaches for getting started might include:
written in terms of non-Unity-specific,
generic vertex and pixel shader code and “porting” it
to Surface Shader code.
- Implementing a technique from a paper or presentation that is described
in terms of regular mathematical notation instead of shader code, i.e.
turning the math into code.
- Reading the description of a not-free shader on the Unity
Asset Store, and then trying to come up with something along the
without actually buying the shader and looking at its code.
- Coming up with something completely original (this should still be
“meaningful” in some way — i.e. don’t just swap the red and green channels
and call it psychedelic; make it something that someone besides you might want to use).
Whatever sources you are drawing from, be sure to put your own “twist” on it,
for instance, making additional paramaters tweakable via custom textures.
If you are in the CS game development class, you are encouraged (but of course
not required) to make a shader that would be appropriate for your game.
Note that it should be a shader that you wouldn’t ordinarily bother writing
for that class. The same overall idea applies if you have your own game
in mind that you might want to write someday, even if it’s not for a
Unity defaults to using Shader Model 2.0; if you need to, go ahead and
use a #pragma to set the shader model to 3.0 or higher. Use the
shader model you can get away with; that way your shader could target
the largest number of platforms.
For this assignment, you need not put much effort into trying to optimize
your shader; just don’t write any code that is blatantly rediculous.
Unlike the last two assignments where you turned in a Word-type document,
on this one, you will turn in a unitypackage.
Take a screenshot of your fantastic
demo, and include it in your unitypackage (you can just drag and drop the
screenshot onto your top-level Assets folder). Include a readme file briefly
describing what you did, what sources you drew inspiration from, etc.;
please also place that in your Assets folder.
Export your project as a unitypackage (use the Assets->Export Package
menu option, and be sure to have “include dependencies” checked.)
unityproject to T-square.
Include “HW4” and as much
as possible of your full name in the
filename, e.g., HW4_Aaron_Lanterman.doc. (The upload
procedure should be reasonably self explanatory once
you log in to T-square.)
Be sure to finish sufficiently in
advance of the deadline that you will
be able to work around any troubles
T-square gives you to successfully
submit before the deadline. If you have
trouble getting T-square to work,
please e-mail your compressed
file to Prof. Lanterman at firstname.lastname@example.org,
with “GPU HW #4” and your full
name in the header line;
use this e-mail submission as a last resort if T-square isn’t working.
If the file is too big to e-mail, see if you can upload it to one
of your web spaces and e-mail Prof. Lanterman a link, again with “GPU HW #4”
in the header.