CS 457 / 557 -- Computer Graphics Shaders

Winter Quarter 2023

http://cs.oregonstate.edu/~mjb/cs557

Resources Page


Projects Handouts


This page was last updated: March 28, 2023


"Don't wake me for the end of the world unless it has very good special effects."
-- Roger Zelazny (science fiction writer)


Coronavirus Information

Your well-being is our #1 concern! I want all of you to have ready-access to the latest information. Find it here.

Attention Ecampusers!

A special welcome to all you Ecampusers! I am excited because this is the first time ever that the Shaders class has been offered on Ecampus. You are my inaugural guinea pigs! :-)

You will experience the same course that the on-campus students experience. Same material, same notes, same projects, same quizzes, same tests, and same online Office Hours. There are recorded videos that go along with the notes (they are called "LV" for "Lecture Videos" and you will see them in the same table that has links to the notes).

Like I do whenever I have Ecampus students, I have setup a time every week to do a Live Lecture so that you also can hear a discussion of the topics with the chance to ask live questions. You can also ask questions in the Zoom Chat, and I will answer them in a document that I will post in the same place I post the recorded LL videos. These will be on Fridays, starting at 3:00 PM PT. They are on Zoom at: https://oregonstate.zoom.us/j/8340727662?pwd=b01tZ0hJUzdHNUtrdTRqSkdwbG4zdz09 On-campus Shaderers are welcome to come as well.

These Live Lectures will be recorded so that if you miss them, you can catch them later.

Thanks, Ecampusers, for being here!

Stuff You Should Be Interested In:


What We Will Be Doing

The goals of this course are to leave you "career-ready" (i.e., both work-ready and research-ready) for tasks that require the implementation of graphics algorithms in the form of shaders.

CS 457/557 topics include:


Graphics Card Levels

If you are wondering what types of shaders your own graphics card supports, check this table. You can tell what shaders the card supports by looking at the Shader Model (or Shader Level) or what DirectX / OpenGL version it supports:
Shader ModelOpenGLDirectXSupports
3.02.x9Vertex, Fragment
4.03.x10Geometry
5.04.x11Tessellation, Compute

We will cover all of these different types of shaders.


Prerequisites

While you don't exactly need previous 3D graphics programming experience to take this course, we are going to jump into shader topics as if you have it.

CS 450/550, 453/553, or 554 are good preparation. CS 491 is adequate preparation if you looked at and understood the graphics programs that were supplied to you.

If you don't have any of these under your belt, I suggest that you look over the CS 450/550 class notes, which can be found here.


Professor

The class is being taught by Professor Mike Bailey.

Office: Kelley 2117 (2nd floor, south side)
Phone: 541-737-2542
Email: mjb@cs.oregonstate.edu

Prof. Bailey's Zoom Office Hours:

See below.  
  or, by appointment -- send email

TAs

We have 3 TAs for CS 457/557: Jian Tang, Shengxuan Wang, and Jinta Zheng. All three have computer graphics experience. We are lucky to have them.

Total Office Hours

TA Office Hours are officially over. Prof. Bailey's Finals Week Office Hours are:
DayTime
Monday10:00-12:00
Tuesday11:00-12:00


There is no Required Textbook!

Course material will consist of my notes and web pages.
All required course materials for this class will cost you $0.00 (i.e., free).

Optional Textbook

There is a textbook, based on the notes for this class.

But, don't buy it! At least, not yet.

But, the book does have more detail in places. If you want to see what is inside it, there is one in the CGEL "library". It is chained to the bookshelf. I also have one in my office.

Bailey and Cunningham, Graphics Shaders: Theory and Practice, Second Edition, CRC Press, 2012. ISBN: 978-1-56881-434-6.

If you do end up wanting it, it is available through Amazon, or through CRC Press.

Last I looked, it was much cheaper on the CRC site. Not sure why.

Other Good References

The Shreiner and Upstill books are in the "CGEL Library".


Handouts and Recorded Videos

LV = Lecture Video ; DV = Demo Video ; CS = Coming Soon
Week #Topic
1 Introduction to CS 457/557 1pp 2pp 4pp 6pp LV      
1 Our Class Resources Page HTML       LV      
1 Project Notes for CS 457/557 1pp 2pp 4pp 6pp LV      
1 Teach Doesn't Work the Way You Think It Does 1pp 2pp 4pp 6pp LV      
1 History of Shaders 1pp 2pp 4pp 6pp LV      
1 Homogeneous Coordinates 1pp 2pp 4pp 6pp LV      
1 Shaders Notes from CS 450/550 1pp 2pp 4pp 6pp LV-A LV-B LV-C DV
1 GLSL API 1pp 2pp 4pp 6pp LV      
2 Glman PDF             DV
2 Stripes, Rings, and Dots 1pp 2pp 4pp 6pp LV     DV
2 Mixing 1pp 2pp 4pp 6pp LV      
2 Morphing 1pp 2pp 4pp 6pp LV     DV
2 Texturing in GLSL 1pp 2pp 4pp 6pp LV     DV
2 Displacement Textures 1pp 2pp 4pp 6pp LV     DV
2 Noise 1pp 2pp 4pp 6pp LV     DV
2 Noise Terrain 1pp 2pp 4pp 6pp LV     DV
3 Bump Mapping 1pp 2pp 4pp 6pp LV     DV
3 Disco-ball Lighting 1pp 2pp 4pp 6pp LV     DV
3 Dome Projection 1pp 2pp 4pp 6pp LV     DV
3 Hyperbolic Geometry 1pp 2pp 4pp 6pp LV     DV
4 Timer 1pp 2pp 4pp 6pp LV      
4 Lighting 1pp 2pp 4pp 6pp LV      
4 Cube Mapping 1pp 2pp 4pp 6pp LV     DV
5 Red-Cyan Stereographics 1pp 2pp 4pp 6pp LV     DV
5 Test #1 HTML       LV
6 Image Manipulation 1pp 2pp 4pp 6pp LV     DV
6 Render-to-Texture 1pp 2pp 4pp 6pp LV     DV
6 Spectral Effects 1pp 2pp 4pp 6pp LV     DV
6 Lens Effects 1pp 2pp 4pp 6pp LV     DV
7 Geometry Shaders 1pp 2pp 4pp 6pp LV-1 LV-2   DV
7 GLM 1pp 2pp 4pp 6pp LV      
7 A short GLM Primer HTML
7 Shadows 1pp 2pp 4pp 6pp LV     DV
7 The Science of Pixar 1pp 2pp 4pp 6pp LV      
8 Tessellation Shaders 1pp 2pp 4pp 6pp LV-1 LV-2   DV
8 Modeling Wave Motion 1pp 2pp 4pp 6pp LV     DV
8 Scientific Visualization using Shaders 1pp 2pp 4pp 6pp LV-1 LV-2   DV
8 The SuperQuad 1pp 2pp 4pp 6pp LV     DV
9 GPU 101 (from the CS 475/575 notes) 1pp 2pp 4pp 6pp LV-1 LV-2    
9 Compute Shaders 1pp 2pp 4pp 6pp LV     DV
9 Bump Mapping with Surface Local Coordinates 1pp 2pp 4pp 6pp LV     DV
9 Advanced Bump Mapping: Normal Mapping 1pp 2pp 4pp 6pp LV     DV
9 Advanced Bump Mapping: Parallax Mapping 1pp 2pp 4pp 6pp LV     DV
10 Introduction to Vulkan 1pp 2pp 4pp 6pp LV
10 Vulkan GLSL 1pp 2pp 4pp 6pp LV      
10 Vulkan Ray Tracing 1pp 2pp 4pp 6pp LV      
10 Algorithmic Art 1pp 2pp 4pp 6pp LV     DV
10 Introduction to RenderMan for GLSLers 1pp 2pp 4pp 6pp LV      
10 More Information PDF      
10 Test #2 Review HTML      
-- Creating a Video Demo of a Graphics Project 1pp 2pp 4pp 6pp


Class Schedule

To see an Academic Year calendar, click here.

Class time is: Mondays and Wednesdays, 10:00 - 11:30.

Unless otherwise specified, all of our classes will be in Milam Auditorium (room 026). The easiest entrance is on the west side.

No class on: Monday January 16.

Note: this schedule is my best guess at where we will be when. It is only approximate.

Week # Starting Date Topics
1 Jan 9 Introductions. General course information.
History of Shaders
The graphics pipeline -- how it really works.
Homogeneous coordinates.
Coordinate systems: Model, World, Eye, NDC, Clip, Screen.
Introduction to the OpenGL Shading Language (GLSL)
Attribute, Uniform, and Varying variables GLSL built-in functions and variables
glman
The GLSL API
The GLSLProgram C++ class
Vertex shaders
2 Jan 16 No class on January 16: Martin Luther King holiday.
Stripes in model vs. world coordinates
The smoothstep( ) function
Checkers
Z-buffer pollution
Geometry Morphing
GLSL Textures: unsigned byte, floating point, 2D, 3D, parameters, binding, texture units, multitextures, sampler functions
Using textures in the vertex shader: displacement maps
Noise: Positional, Gradient. Cubic and quintic interpolation. Fractional Brownian Motion (FBM, 1/f), turbulence.
glman Noise
Reading a noise texture
Using noise to create terrain
3 Jan 23 More noise
Lighting
Disco-ball Lighting
Bump mapping
4 Jan 30 SSAO
Morphing
Timer
Noise Terrain
5 Feb 6 Cube mapping
Reflection, Refraction
More fun with vertex shaders: Dome projection, Hyperbolic geometry.
Test #1 Review
Test #1 goes live at 12:01 PM on Wednesday, February 8. It closes at 23:59 on Sunday, February 12. It wil consist of 40 questions, on Canvas, multiple choice, open notes.
A Public Service Announcement: Valentine's Day is next week!
6 Feb 13 Happy Valentines's Day tomorrow!
Discuss the Final Project.
Image Manipulation
Render to Texture
7 Feb 20 The optics of rainbows
The optics of diffraction
The optics of lenses
Geometry Shaders
A one-page PDF project proposal is due to me by 23:59:59 on Wednesday, February 22. Turn it in on Teach.
8 Feb 27 Geometry Shaders
Tessellation shaders
Scientific Visualization using shaders
9 Mar 6 Compute Shaders
Click here to see the Compute Shader particle system from the class notes.
Advanced Bump Mapping: Surface Local Coordinates
Advanced Bump Mapping: Normal Mapping
Advanced Bump Mapping: Parallax Mapping
10 March 13 Algorithmic Art
Vulkan and its GLSL Shaders
Test #2 review.
Test #2 goes live at 12:01 PM on Wednesday, March 22. It closes at 23:59 on Sunday, March 26. It wil consist of 40 questions, on Canvas, multiple choice, open-notes.
More Information

Live Lectures

Every Friday, staring at 3:00 PT, I will be hosting a Live Lecture. We will go over some current course materials and see live demos. The important thing is that it will be a time for you to ask live questions. Each LL will probably last anywhere from 60 to 90 minutes.

Attendance at the LLs is optional. These sessions will be recorded (see below) in case you missed them.

When the LL is over, this will become Zoom Office Hours until 6:00 PT.

Here is my Zoom-room.

LLV = Live Lecture Video

Week #VideoChat
1A LLV PDF
1B LLV PDF
2 LLV PDF
3 LLV PDF
4 LLV PDF
5 LLV PDF
6 LLV PDF
7 LLV PDF
8 LLV PDF
9 LLV PDF
10 LLV PDF


Projects

LV = Lecture Video

Project # Points Title Due Date LV
1 60 Step- and Blended-edged Elliptical Dots January 20 LV
2 100 Noisy Elliptical Dots January 28 LV
3 100 Displacement Mapping, Bump Mapping, and Lighting February 6 LV
4 100 Cube Mapping Reflective and Refractive Bump-mapped Surfaces February 15 LV
5 100 Image Manipulation February 21 LV
FP Proposal 10 Final Project Proposal February 22, 23:59:59, no BDs LV
6 60 The Bunny Menagerie Project March 1 LV
7A 100 Geometry Shaders March 10 LV
7B 100 Alternative to the Geometry Shaders Project March 10 LV
557 Paper 100 Paper Project (for those in CS 557) March 21, 23:59:59, no BDs LV
FP 90 Final Project March 21, 23:59:59, no BDs LV


Project Turn-In Procedures


Bonus Days and Late Assignments

Projects are due at 23:59:59 on the listed due date, with the following exception:

Each of you has been granted 5 Bonus Days, which are no-questions-asked one-day extensions which may be applied to any project, subject to the following rules:

  1. No more than 2 Bonus Days may be applied to any one project
  2. Bonus Days cannot be applied to tests or quizzes
  3. Bonus Days cannot be applied to the Final Project Proposal, the Final Project, or the CS 557 Paper Project

If you turn in a project three or more days late, your score is a zero.

If you turn in a project late and you don't have enough Bonus Days left to spend on it, your score is a zero.

You don't need to ask me, or even tell me, that you are using Bonus Days. Just turn your project in two-or-less days late. I have a script that will check your turn-in date and deduct the Bonus Days.

It is up to you to track how many Bonus Days you have used up. However, I also keep a spreadsheet of all of your Bonus Days. If you lose track, send me an email and ask.


Grading

Your scores will be posted on Canvas

CS 557 will be graded on a fill-the-bucket basis. There will be 8 programming projects, 10 quizzes, and two tests. You get to keep all the points you earn.

Those taking the class as CS 557 will also do a 100-point essay summarizing a research paper. (Those taking the class as CS 457 will get a free 100 points for this assignment.)

The quizzes will be done via Canvas. They will open each Friday at 12:01 PM and will close Sunday night at 23:59. Canvas is very unforgiving about due times -- don't push it.

Your final grade will be based on your overall class point total. Based on an available point total of 1120, grade cutoffs will be no higher than:

Points Grade
1080
1060 A- 
1040 B+
1020
1000 B- 
980 C+
960
940 C- 
920 D+
900
880 D- 

Notice that this grade scale is not 90%-80%-70%-60%. That is because I just do a soft grade on the projects.


Downloadable Files

Here is a folder with some of my favorite OBJ files.

Opening up the ShaderSampleWindows.zip or ShaderSampleLinux.tar or ShaderSampleMac.tar file will produce a folder full of all the other files you need. You do not need to go hunt the internet for any other files. Use the ones that have been given to you.

Windows Visual Studio 2019 Sample Program ShaderSampleWindows.zip Un-zip, get into the ShaderSampleWindows folder, and double-click on the .sln file, then select Build→Clean Solution, then select Build→Build Sample, then select Debug→Start Without Debugging
Linux Sample Program ShaderSampleLinux.tar Un-tar (tar -xvf ShaderSampleLinux.tar), then cd ShaderSampleLinux, then make sample, then ./sample
Mac Sample Program * ShaderSampleMac.tar * Un-tar (tar -xvf ShaderSampleMac.tar), then cd ShaderSampleMac, then make sample, then ./sample
Windows Visual Studio 2019 Shadows Program Shadows2019.zip Un-zip and double-click on the .sln file, then select Build→Clean Solution, then select Build→Build Sample, then select Debug→Start Without Debugging
BMP-to-Texture function bmptotexture.cpp  
Our own version of the sphere-drawing function osusphere.cpp  
The full version of the C++ class to use GLSL shaders glslprogram.h, glslprogram.cpp
A cut-down version of the C++ class to use GLSL shaders (might be better for Macs) glslprogramP5.h, glslprogramP5.cpp  
Vertex Buffer C++ class vertexbufferobject.h, vertexbufferobject.cpp  
Code to load an OBJ file loadobjfile.cpp  
glm Folder glm.zip Un-zip into your VS project folder
Keytime Animation C++ class keytime.h, keytime.cpp  
2D Noise Texture noise2d.064.tex  
3D Noise Texture noise3d.064.tex  
Kelley Engineering Center test image kec.bmp  
The find shader find.glib, find.vert, find.frag  
Shader code to produce the rainbow and heated-object color scales colorscales.txt
Mars Panoram MarsPanoram.zip  

* Previous Mac users in this class have recommended that, rather than use the trackpad, you go get a Bluetooth 3-button mouse. If you need to use the Mac trackpad, I've been told that a two finger click/tap works as a right click and option+click works as a middle click.

An alert CS 450/550 student put together these instructions for getting shadsrs to run on a Mac.

If you want to use an OBJ object in glman, download it and include it in your GLIB file like this:
Obj spaceship.obj

Or use an OBJ file in your C/C++ file by including the file loadobjfile.cpp into your own code. Then, place the .obj object into a display list:


// a global variable:
GLuint DL;

. . .

// do this in InitLists( ):
DL = glGenLists( 1 );
glNewList( DL, GL_COMPILE );
LoadObjFile( "spaceship.obj" );
glEndList( );

. . .

// and do this in Display( ):
Pattern->Use( );
. . .
glCallList( DL );
Pattern->Use( 0 );

Other Files

  1. OpenGL/GLSL-related files
  2. .obj files

  3. Want to use the Nvidia Lobby in a cube map? Here are the files:
    nvposx.bmp
    nvnegx.bmp
    nvposy.bmp
    nvnegy.bmp
    nvposz.bmp
    nvnegz.bmp

  4. Want to use the Kelley Engineering Center Atrium in a cube map? Here are the files:
    kec.posx.bmp
    kec.negx.bmp
    kec.posy.bmp
    kec.negy.bmp
    kec.posz.bmp
    kec.negz.bmp

Downloadable Executables

These executables are all loaded on the CGEL machines, but you can also get them here in case you want to run them on other Windows machines.

  1. noisegraph.exe
  2. glman.exe

You might also need these dlls:

  1. glew32.dll
  2. glut32.dll
  3. libcd.lib
  4. libcid.lib
  5. msvcr71d.dll


Class Rules


MySSP: Mental Health Support for Students

MySSP @ OSU is an app that gives all OSU students, including Ecampus students, 24/7 access by text or phone with a licensed mental health counselor (MySSP stands for “My Student Support Program”). The app makes it easy to schedule short-term counseling appointments with the same ongoing counselor and provides educational materials covering mental health topics. Students can communicate with a counselor in five different languages (Mandarin, Cantonese, French, Spanish or English); additional language options are available upon request. Students can download the Anytime Anywhere: MySSP @ OSU and learn more about the service at http://beav.es/anytimeanywhere. For questions, please contact Bonnie Hemrick ( bonnie.hemrick@oregonstate.edu ), Director of Mental Health Promotion.

Establishing a Positive Community

It is important you feel safe and welcome in this course. If somebody is making discriminatory comments against you, sexually harassing you, or excluding you in other ways, contact the professor, your academic advisor, and/or report what happened at https://studentlife.oregonstate.edu/studentconduct/ reporting so we can connect you with resources.

Academic Dishonesty

You are expected to do your own work. Helping each other, with explanations or clarifications, is OK. Sharing code, however, is considered cheating. Anyone caught cheating will fail this class, and the matter will be turned over to the Dean's Office.

You are expected to read and understand Oregon State University's Statement of Expectations for Student Conduct, found here: https://beav.es/codeofconduct . If there is any parts of this document that you don't understand, ask me!

Students With Disabilities

Accommodations for students with disabilities are determined and approved by Disability Access Services (DAS). If you, as a student, believe you are eligible for accommodations but have not obtained approval please contact DAS immediately at 541-737-4098 or at http://ds.oregonstate.edu. DAS notifies students and faculty members of approved academic accommodations and coordinates implementation of those accommodations. While not required, students and faculty members are encouraged to discuss details of the implementation of individual accommodations.

Student Bill of Rights

OSU has twelve established student rights. They include due process in all university disciplinary processes, an equal opportunity to learn, and grading in accordance with the course syllabus. See: https://asosu.oregonstate.edu/advocacy/rights

Religious Holidays

Oregon State University strives to respect all religious practices. If you have religious holidays that are in conflict with any of the requirements of this class, please see me immediately so that we can make alternative arrangements.

Life Events

As {John Lennon? Allen Saunders?} has said: "Life is what happens to you while you're busy making other plans". I care about you as a person. When life happens to you, send me an email and come see me. I might be able to help. But I surely can listen. You are not alone.

Reach Out for Success

University students encounter setbacks from time to time. If you encounter difficulties and need assistance, it's important to reach out. Consider discussing the situation with me or an academic advisor. Learn about resources that assist with wellness and academic success at http://oregonstate.edu/ReachOut. If you are in immediate crisis, please contact the Crisis Text Line by texting OREGON to 741-741 or call the National Suicide Prevention Lifeline at 1-800-273-TALK (8255)

Basic Needs

Success at OSU means knowing and using your resources. One helpful resource is the community of staff available at the Basic Needs Center (BNC) for support (bnc@oregonstate.edu, 541-737-3747, https://studentlife.oregonstate.edu/bnc). Students can drop in during open hours and talk with a BNC student leader for resources, ideas and strategies connected to basic needs challenges. The BNC is often known for its food pantry but there are other resources connected to groceries and affording food and staff who can help you work through housing stressors. Undergraduate students, living in Oregon, are especially encouraged to explore SNAP (up to $236 in grocery money each month for eligible students) as a resource. Domestic undergraduate students living in Oregon are more likely than not to be eligible for SNAP. BNC staff are skilled with helping students navigate this process.

Additionally, the BNC Textbook Lending Program offers students the opportunity to check out required textbooks for the academic term.

Furthermore, if you are comfortable doing so, please talk with Professor Bailey. He will do everything he can to help you.


Other Notes You Might Enjoy!

University Classes
Intro to Computer Graphics
Scientific Visualization
Parallel Programming
CS Skills for Simulation and Game Programming
Vulkan
Paraview

Grades 2-12 Outreach
Scratch (including Scratch Jr.)
TinkerCad
Blender
Processing
SketchUp


Other Useful Online Graphics and Shader Information