Write Unity CG Shaders From Scratch (2D, 3D)
Have you ever wanted to write your own CG/HLSL shader code from scratch? Do you need help with understanding the intricate details of what happens on the back end? Learn to write shaders without the help of the material editor, and rather use the material editor as a prototyping tool?
In this Unity CG course, I will be teaching you the fundamentals of shader code so that you can write, create and develop unique looks that not only look amazing but run optimally too.
Write Unity CG Shaders From Scratch (2D, 3D)
Have you ever wanted to write your own CG/HLSL shader code from scratch? Do you need help with understanding the intricate details of what happens on the back end? Learn to write shaders without the help of the material editor, and rather use the material editor as a prototyping tool?
In this Unity CG course, I will be teaching you the fundamentals of shader code so that you can write, create and develop unique looks that not only look amazing but run optimally too.
These techniques can be used for personal game development, and I will also go over best practices that can be used on the job in larger game companies.
My name is Benjamin Swee, your course instructor. I have been working at various game companies and been a Lead Rendering Engineer on popular titles such as Marvel Contest of Champions, Fast and the Furious games, & a few Lineage titles.
My role was often solo, as such I would create complete in-house rendering systems.
In this course, I not only want to bring you creative thinking when it comes to rendering, but also real-world industry experience, and the best practices that are used in titles that are launched today.
Shaders are a black box to many, I aim to unbox it
Note that this course is a work in progress. I plan on continually updating it. Let me know in the course messages, what moreyou want to see.
An introduction to myself, why rendering, and the initial setup that you need to begin this course.
This is how I've set up everything in Unity, remember, while I will give you all the course material, write your own shaders!
Welcome to the very first lesson of the shader course. I want to start right away by jumping into the basics of the shader. I will be going over exactly, line by line the core structure of a shader. It is unlike any other programming language, and strange to many programmers, so dive right into it.
Here we will be doing our very first texture sample! We will be learning UVs, what they mean, and how to use them to display our very first texture.
Once we got a handle on how UVs work, let's use them to sample textures. But more than that, we can also learn about how to transform and scale textures while we are at it.
Let's learn about transparency or ideally, blending. Blending is how all transparencies work across all games and even different game engines. So let's learn about the blend formula.
In this lesson, we will be learning about how UV animations work, how they slide, and how they animate
Two texture samples? Why would we ever do that? There are many reasons why and how a 2nd texture can support the first one.
Texture erosion. This is a cool-looking effect that helps make objects disappear. It's not the easiest to explain in the description, so just jump right in!
One of the really cool ways you can make erosion look even more awesome is by adding these searing colours.
Here we are going to animate a specific texture along with another texture that represents a UV. If that doesn't make much sense, check out the lesson, it will be much clearer.
Doing distortions and warps, concepts are similar to previous lessons, but what can we really achieve with these skills?
Creating UVs not from texture, but from math. That way, the UVs are perfect with no pixelation, and you can still do cool effects!
You don't want to have distortion everywhere, let's mask it and work with it
Screen Space UVs are ideal for creating shines and effects that go across the entire screen, often used in the UI for UI effects
Creating textured shines. But these shines are driven by the texture itself, no supporting textures needed
We will be rotating an image using a rotation matrix. This type of sampling combined with previous lessons can create all types of interesting effects!
In this lesson we will cover the basic's of setting up a 3D shader, involving lighting
Now let's also make sure we get ambient lighting, lighting from the light probes and global illumination.
Notice a small issue here, we should have lighting done in the fragment for that extra smooth look
In this lesson we will do basic specular math, let's create that specular highlight!
The core concepts of normal mapping and how it works, from the math to the implementation
It's odd to have some features on and some off, creates weird bugs, let's solve them!
I'm sure you have seen this effect before, it will make sense once you go through it.
A cheap way to get some version that looks like water, is normal blending
Let's start making our water flow, a basic way to do it, also a recap from some of the UV flow we did in past lessons.
Advanced flow, here is how we generate constant flowing water.
Want objects to look like they are underwater? Me too, let's make it happen!
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.