CS 457 / 557 -- Computer Graphics Shaders

Winter Quarter 2022

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

Resources Page


Projects Handouts PB Zoom


This page was last updated: March 13, 2022


"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:

OSU requires the use of face coverings in indoor spaces. Face coverings are defined as an item affixed to the face to help prevent the spread of the COVID-19 virus, including cloth garments that cover the nose and mouth and medical-grade disposable masks. This definition and policy exclude face coverings that incorporate a valve to facilitate easy exhalation, mesh masks, lace masks, face shields or other coverings with openings, holes, or visible gaps in the design, material or vents.

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:

Mondays 12:00 - 2:00
Tuesdays 2:00 - 4:00
Wednesdays 2:00 - 4:00
LL: Fridays 12:00 - 2:00
  or, by appointment -- send email
LL is Prof. Bailey's weekly Live Lecture on Zoom.

TAs

The TAs for this course are Jian Tang and Julie Kuang. Both have a huge amount of computer graphics experience. We are lucky to have them!

Total Office Hours

  Prof. Bailey Julie Kuang Jian Tang
Email mjb@cs.oregonstate.edu kuangqi@oregonstate.edu tangjian@oregonstate.edu
Zoom-room Zoom Zoom Zoom
Mondays 12:00 - 2:00 8:00 - 10:00  
Tuesdays 2:00 - 4:00   9:00 - 11:00 , 12:00 - 2:00
Wednesdays 2:00 - 4:00 8:00 - 10:00 , 3:00 - 5:00  
Thursdays     9:00 - 11:00 , 12:00 - 4:00
Fridays LL: 12:00 - 2:00 8:00 - 12:00  

The links point to the Zoom-Rooms.
LL is Prof. Bailey's weekly Live Lecture on Zoom.

  8:00 9:00 10:00 11:00 12:00 1:00 2:00 3:00 4:00 5:00
Mondays JK JK Class Class PB PB        
Tuesdays   JT JT   JT JT PB PB    
Wednesdays JK JK Class Class     PB PB , JK JK  
Thursdays   JT JT   JT JT JT JT    
Fridays JK JK JK JK PB: LL PB: LL        
PB = Prof. Bailey
JK = Julie Kuang
JT = Jian Tang
The links point to the Zoom-Rooms.
LL = Live Lecture


Optional Textbook

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

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

You can get everything you will need to know from the class notes and various web pages.

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

All required course materials for this class will cost you $0.00 (i.e., free)
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 Model vs. Eye/World Coordinates -- -- -- -- -- -- -- DV
1 GLSL API 1pp 2pp 4pp 6pp LV      
2 Glman PDF             DV
2 Mixing 1pp 2pp 4pp 6pp LV      
2 Morphing 1pp 2pp 4pp 6pp LV     DV
2 Stripes, Rings, and Dots 1pp 2pp 4pp 6pp LV-1 LV-2   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-1 LV-2 LV-3 DV
2 Noise Terrain 1pp 2pp 4pp 6pp LV     DV
3 Bump Mapping 1pp 2pp 4pp 6pp LV-1 LV-2   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 Screen Space Ambient Occlusion (SSAO) 1pp 2pp 4pp 6pp LV     DV
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 Behind 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 LV-3 DV
8 The SuperQuad 1pp 2pp 4pp 6pp LV     DV
9 GPU 101 (from the CS 475/575 notes) 1pp 2pp 4pp 6pp
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 Efficient Ray-Triangle Intersections 1pp 2pp 4pp 6pp
10 Algorithmic Art 1pp 2pp 4pp 6pp LV     DV
10 Introduction to RenderMan for GLSLers 1pp 2pp 4pp 6pp LV
10 More Information PDF       LV
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:50.

Unless otherwise specified, all of our classes will be in LiNC 228.

No class on: January 17.

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

Week # Starting Date Topics
1 Jan 3 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 10 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 17 No class on January 17: Martin Luther King holiday.
More noise
Lighting
Disco-ball Lighting
Bump mapping
4 Jan 24 SSAO
Morphing
Timer
Noise Terrain
5 Jan 31 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 2 (Happy Groundhog's Day!). It closes at 23:59 on Sunday, February 6. It wil consist of 40 questions, on Canvas, multiple choice, open-notes.
6 Feb 7 Discuss the Final Project.
Image Manipulation
Render to Texture
A Public Service Announcement: Valentine's Day is next week!
7 Feb 14 Happy Valentines's Day!
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 16. Turn it in on Teach.
8 Feb 21 Geometry Shaders
Tessellation shaders
Scientific Visualization using shaders
9 Feb 28 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 7 Algorithmic Art
Vulkan and its GLSL Shaders
Test #2 review.
Test #2 goes live at 12:01 PM on Wednesday, March 16. It closes at 23:59 on Sunday, March 20. It wil consist of 40 questions, on Canvas, multiple choice, open-notes.
More Information

Live Lectures

Every Friday, 12:00-2:00, I will be hosting a Live Lecture. We will go over some current materials and see live demos. It will be a time for you to also ask live questions. Attendance at the live session is optional. These sessions will be recorded (see below) in case you missed them.

Here is my Zoom-room.
If you need a passcode, use ZeldaDog

LLV = Live Lecture Video

Week #Video
1LLV
2LLV
3LLV
4LLV
5LLV
6LLV
7LLV
8LLV
9LLV
10LLV


Projects

LV = Lecture Video
DV = Demo Video

Project # Points Title Due Date LV DV
1 60 Step- and Blended-edged Elliptical Dots January 14 LV DV
2 100 Noisy Elliptical Dots January 19 LV DV
3 100 Displacement Mapping, Bump Mapping, and Lighting January 26 LV DV
4 100 Cube Mapping Reflective and Refractive Bump-mapped Surfaces February 9 LV DV
5 100 Image Manipulation February 15 LV DV
FP Proposal 10 Final Project Proposal February 16, 23:59:59, no BDs LV
6 60 The Tiger Menagerie Project February 23 LV
7 100 Geometry Shaders March 4 LV DV
557 Paper 100 Paper Project (for those in CS 557) March 15, 23:59:59, no BDs LV
FP 90 Final Project March 15, 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 Sample2019.zip or SampleLinux.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 Sample2019.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
Linux Sample Program SampleLinux.tar Un-tar (tar xvf SampleLinux.tar), then cd SampleLinux, then make sample, then ./sample
Windows Visual Studio 2019 Sample Shaders Program ShaderIntro2019.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
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
Windows Visual Studio 2019 Vertex Buffer Object sample Program VBO.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
A color-picker program ColorPicker.exe  
Our own version of the sphere-drawing function osusphere.cpp  
C++ class to use GLSL shaders glslprogram.h, glslprogram.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  

If you want to load a .obj file as part of one of your projects, incorporate the file loadobjfile.cpp into your own code. I usually use this by placing the .obj object into a display list:

// a global variable:
GLuint DL;

. . .

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

. . .

// do this in Display( ):
glCallList( DL );

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


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.

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 yet 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.

Link to the Code of Student Conduct

https://beav.es/codeofconduct

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

Any student who has difficulty affording groceries or accessing sufficient food to eat every day, or who lacks a safe and stable place to live, is urged to contact the Human Services Resource Center (HSRC) for support: hsrc@oregonstate.edu, 541-737-3747. The HSRC has a food pantry, a textbook lending program, and other resources to help. Furthermore, if you are comfortable doing so, please come talk with me. I will do everything I can do to help you.

University Housing & Dining Services has been piloting a meal program called Food for Thought. Using the extra food generated by campus dining locations, they create pre-packaged, balanced meal options available at no cost to Oregon State students who meet eligibility criteria determined by the Human Services Resource Center. For others, these packages are available for purchase at a reduced price.


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