Shader Development from Scratch for (Unity 6 Compatible)
- Descrição
- Currículo
- FAQ
- Revisões
Now Updated for Unity 2017 to Unity 6!
This course presents a comprehensive guide to programming with Cg and High Level Shader Language in Unity’s Shaderlab, to create your own visual surface effects for colouring and lighting game objects. It covers the mathematics of light and surfaces and steps you through the recreation of some of the most popular shaders. Many computer graphics concepts will be presented to help you understand the graphics pipeline and provide you with an essential toolkit of rendering knowledge, that will have you developing your own transparent, animated and texturised shaders in no time.
In this course, Penny teaches all the invaluable skills you will require to program the computer graphics pipeline in Unity from scratch using her internationally acclaimed teaching style and knowledge from over 25 years working with games and graphics. But hold on tight as you’ll be taken on a journey across the computer graphics realm as it is taught to post-graduate university students. Through detailed descriptions and hands-on workshops examining all you need to know about rendering queues, vector mathematics, graphics buffers, colour theory, 3D meshes, texture mapping, lighting models and much more.
Learn how to program and work with:
-
variables and packed arrays
-
meshes, vertices and UVs
-
the mathematics for working with objects in 3D and 2D spaces
-
a variety of lighting models from creating flat shaded objects to highly reflective shiny surfaces
-
bump maps for adding extra depth and dimension to surface textures
-
special effects such as holographic, scrolling textures and surface deformations
-
the variety of graphics buffers used in the rendering pipeline
-
forward and deferred lighting
-
surface, vertex and fragment shaders written in CG/HLSL
-
volumetric rendering
Contents and Overview
After diving right in and creating your very first shader from scratch, we will begin the lessons by examining how 3D models are structured and how that is used within shader code to colour and display the surface in computer graphics. You’ll discover all the properties of a shader and how they can be controlled in code and via values fed in through Unity’s Inspector.
Following this, we will examine a variety of lighting models and how lights and surface textures can influence the final look of a render. Included here, an overview of the buffers involved in the rendering queue will be given with practical examples for creating special effects that require more than one draw call. Students will also be exposed to the power of vector mathematics and especially the dot product and its role in creating beautiful effects such as outlines, rim lighting and holograms. In addition, issues surrounding transparency and blending will be discussed along with many practical hands-on workshops in which students can flex their newfound skills to interrogate the code they write for better understanding.
The next section brings together all the skills learned throughout together, to develop some of the more popular complex shaders including animated plasma and animated water with waves.
Finally volumetric shaders are covered in which you will follow along to create special effects such as fake geometry, fog and clouds.
What students are saying about this course:
-
This is the best course I’ve ever taken. It is perfect for me. I worked for 15 years in feature animation. A large part of my career was spent developing shaders for a proprietary renderer. This course has already helped me to bring the value of my previous experience into Unity.
-
Best shader course I’ve come across. There are enough and more tutorials on youtube to teach you how to develop your own shaders, but nothing falls into the class of Penny’s tutorials. They are clear and to the point. Really happy about this one.
-
Wow! Thank you so much! If there were 10 stars – this course would deserve it. Going from absolutely knowing nothing about Shader writing to have a profund understanding about it.
-
I wanted to let you know that I just finished your shader course and thought it was fantastic. It was a pleasure to take the course and finally get a grasp on a topic that seemed so foreign to me not so long ago. Your teaching style and personality really worked for me and made learning a breeze!
-
1WelcomeVídeo Aula
This lecture introduces the course and takes you through the content that will be covered showing demos of the effects that will be covered.
-
2Join the H3D Student CommunityVídeo Aula
H3D has a bustling online student community. Here's how to get involved.
-
3Contacting H3DTexto
How to contact us
-
4FAQsTexto
-
5Help! Why can't I see my shaders correctly?Texto
More often than not when you are learning something new with software you will find it difficult to tell when you've done something wrong or the software is not working. Here are a couple of common issues you might come across when you start to develop shaders. Be sure to use these as a go to when debugging your own work.
-
6Working with Unity 6 in this course.Texto
This article explains how to get the shaders in this course to work with Unity 6.
-
7The Rendering PipelineVídeo Aula
In this lecture we will take a look at the graphics pipeline and the stages in taking a model from virtual to an image on the screen.
-
8Your First Surface ShaderVídeo Aula
There's nothing like seeing your first shader program come to life. There's still much to discuss about the technical and programmatic specifications of shaders, but lets start with a simple example to get the ball rolling.
-
9ChallengeTexto
-
10Crash Course in Vector MathematicsTexto
-
11Variables and Packed ArraysVídeo Aula
Shader code has a lot in common with regular C# but can sometimes look a little strange especially with respect to data types. In this lecture we will go over these types and discuss how they are used.
-
12The Anatomy of a Mesh and Shader InputVídeo Aula
The structure of a model's mesh is crutial in determiing how a shader will affect its surface. Understanding all the 3D components of a mesh is a fundamental you should have under your belt before attempting to manipulate the look of its surface with shaders.
-
13Shader PropertiesVídeo Aula
In this lecture we will examine in detail the properties block and investigate how external values and images can be used in shaders.
-
14Properties Challenge 1Texto
-
15Properties Challenge 2Texto
-
16Properties Challenge 3Texto
-
17Properties Challenge 4Texto
-
18Lambert & LightingVídeo Aula
Before you can start writing more complex shaders an understanding of the way surface brightness is calculated based on the lighting model is necessary. In this lecture we will introduce the concept of lighting models and examine the simpliest: Lambert.
-
19Normal MappingVídeo Aula
In this lecture normal mapping will be introduced. The method is a way to add detail and depth to a model when no geometric detail exists.
-
20Bumped Diffuse ChallengeTexto
This lecture is a challenge on modifying the bumped and diffuse textures.
-
21Visualising NormalsTexto
Sometimes it can be difficult to visualise mathematical concepts without models to support them. In this article I will provide a tool for examining normals in Unity which will visualise them and how they change as their coordinates do.
-
22Illumination ModelsVídeo Aula
In this section we will examine three illumination models from the history of computer graphics. Learning how each is applied across the surface of a polygon to give a resulting visual effect will give you a better appreciation for the role of the normal in developing shaders.
-
23Bumped EnvironmentsVídeo Aula
When you want to create an effect that involves multiple vectors, such as the world reflection and normals you need to mix these together in the shader so one affects the other before adding a texture. In this lecture you will learn how to effect a world reflection with a normal map.
-
24Bumped Environments ChallengeTexto
-
25Buffers and QueuesVídeo Aula
At some point in the rendering pipeline a pixel ends up in a buffer or two. As you create more shaders and shaders containing multiple effects it becomes critical to understand exactly whats going on otherwise it becomes difficult to debug your code. In this lecture we will examing the roles of the frame buffer, z buffer and g buffer and touch on the processes of forward and deferred lighting.
-
26The Dot ProductVídeo Aula
Being able to tell where the part of a model is facing with respect to the viewer is critical for the production of numerous shader effects. The dot product function is "need to know" information for any shader writer.
-
27QuizQuestionário
-
28Rim LightingVídeo Aula
Rim lighting demonstrates perfectly the use of the dot product, though it requires a little mathematical manipulation to get just the right results. In this lecture we will look at introducing other mathematical operations into the code to tweak the dot product.
-
29Logical CutoffsVídeo Aula
When you want to vary the effect a shader has on different parts of a surface, logical statements are your friend. In this lecture we will explore the use of logical statements embedded in the code to turn parts of an effect on and off.
-
30ChallengeTexto
-
31Lighting ModelsVídeo Aula
Thus far we've only used Lambert as the lighting model for our shader. To expand the possibilities of what you can do with shaders, we now examine the other lighting models available in Unity.
-
32Blinn-Phong Lighting & Surface OutputVídeo Aula
Lambert lighting cannot produce specular highlights. For that you need BlinnPhong. In this lecture we will employ the BlinnPhong lighting model to add glossy effects to our model.
-
33Physically-Based RenderingVídeo Aula
In this lecture we take a look at the Unity Physically-Based Lighting Shaders and use the lighting models to investigate the metallic and specular features.
-
34Challenge 1Vídeo Aula
To the Standard PBR shader created in the last lecture add an emissive slider that makes the model glow in the same areas that are grey and white in the metallic gloss map. See the working example in this video. The solution is attached.
-
35Challenge 2Vídeo Aula
To the Standard Specular PBR shader created in the previous lecture reverse the glossiness effect so the black areas of the map are highly reflective and the grey and white much more diffuse. See the working example in this video. The solution is attached.
-
36Writing Your Own Lighting ModelVídeo Aula
In this lecture we will explore the creation of custom lighting models through the development of our own Lambert, BlinnPhong and Toon Ramped lighting from scratch.
-
37Challenge 3Texto
-
38Challenge 4Texto
-
39The Alpha ChannelVídeo Aula
Many effects including particles and vegetation in games rely on textures which use the alpha channel. In this lecture we will explore the creation of shaders that manipulate this channel as well as discover how transparency works withing the rendering pipeline with respect to the Z buffer.
-
40HologramsVídeo Aula
In this lecture we will use the alpha channel with rim lighting to create a holographic effect. Included in the lesson will be pointers on using mulitple passes to clear up z buffer issues arising from making models transparent.
-
41BlendingVídeo Aula
Blending provides you with control over the way incoming colours are added to colours already in the frame buffer. Through a series of very simple blend statements you can create a plethora of effects. This lecture shows you how.
-
42Leaves and CullingVídeo Aula
By default in computer graphics the reverse side of polygons are not shown to save on processing. However, in the case of billboards you might want to be able to draw on both sides. This lecture shows you how to turn on the drawing of the backfaces.
-
43Blending Two ImagesVídeo Aula
Sometimes you might want a shader that takes more than one image and then merges them together onto a single surface. In this lecture you will learn how to do this as well as dynamically turn one on and off at runtime.
-
44Stencil BufferVídeo Aula
In this lecture we will examine the use of another buffer called the Stencil Buffer. This is useful for masking certain pixels to create a variety of effects including XRay Vision and Drawing Holes in walls.
-
45Advanced StencilsVídeo Aula
The best way to get to understand the stencil buffer is to try it out many different ways. In this lecture we will use the stencil buffer to create a fun optical illusion as well as a dynamic piece of stencil code to let you play with the stencil settings via the Inspector.
-
46The Anatomy of a Vertex/Fragment ShaderVídeo Aula
In this lecture we'll examine the structure of a vertex/fragment shader. I'll point out a few of the nuances in the code and then show you how to create your own.
-
47Colouring by Vertices and FragmentsVídeo Aula
Both the vertex shader and fragment shader both deal with vertices and they can both produce colours. In this lecture we will examine the differences.
-
48Material UseVídeo Aula
V/F shaders, like surface shaders, are capable of processing materials to colour the surface of objects. In this lecture we will look at how UV values are processed in both the Vert and Frag functions. Towards the end I will show you how to take a screen grab of a scene and use that as a manipulatable material on a plane.
-
49LightingVídeo Aula
While lighting is best kept to surface shaders that handle them elegantly on your behalf, it is handy to know how they work in V/F shaders. This lecture examines how to add a lambert lighting model to create diffuse light.
-
50ShadowsVídeo Aula
There's no point in having light if you can't have shadows. So let's modify the lighting shader in this lecture to examine how shadows are cast and received.
-
51Challenge 1Texto
-
52Challenge 2Texto
-
53Vertex ExtrudingVídeo Aula
In this lecture we will examine the use of a vertex shader with a surface shader. The vertex shader will be used to extrude the surface of a mesh for a ballooning effect.
-
54OutliningVídeo Aula
Outline is a cool effect you can combine with toon shading to get a Borderlands rendered look. In this lecture we will examine two ways to achieve the look.
-
55GlassVídeo Aula
In this lecture we will create everyone's favourite glass. But this glass isn't simply a transparent pane. It includes bump mapping, a stained-glass pattern and light refraction.
-
56WavesVídeo Aula
Once you know how, modifying vertices with mathematical functions can create all sorts of interesting effects. In this lecture we will examine the sin function for producing waves on the surface of a plane.
-
57Scrolling TexturesVídeo Aula
In this lecture we will examine a simple way to change the UV values of a surface over time to create a texture that rolls over the surface.
-
58Challenge 1Texto
-
59PlasmaVídeo Aula
In this lecture we will use more sine functions and lots of them, plus a cosine, pow and squareroot to create some old school plasma to warp across the surface of objects.
-
60Challenge 2Texto
-
61Ray MarchingVídeo Aula
In this lecture we will learn about the basics of ray marching and use it to render a sphere inside a cube with shader code.
-
62More on Ray MarchingVídeo Aula
In this lecture we will explore further facets of the ray marching algorithm and also calculate per pixel lighting.
-
63Spherical FogVídeo Aula
In this lecture we will begin looking at another way to mathematically represent a sphere and depth test in two places.
-
64Rendering Fog Density P1Vídeo Aula
In this lecture we will create the function that calculates the fog density.
-
65Rendering Fog Density P2Vídeo Aula
In this lecture we will use the fog calculating function in the vertex shader to render a ball of volumetric fog.
-
66Volumetric Clouds Value NoiseVídeo Aula
In this lecture we will look at the Value Noise algorithm that will be used to create clouds as well as begin setting up the cloud environment.
-
67Programming Value Noise P1Vídeo Aula
In this lecture we will start writing the value noise algorithm.
-
68Programming Value Noise P2Vídeo Aula
In this lecture we begin with an overview of programming predictable random values and write some random functions for the shader.
-
69Programming Value Noise P3Vídeo Aula
In this lecture we complete the writing of the 3d value noise and test out some of its basic functionality.
-
70Integrating Colours and DepthVídeo Aula
In this lecture we will put the final function together that will combine lighting and cloud density into the shader for your first view of simple clouds.
-
71Enhanced NoiseVídeo Aula
In this lecture we will look at mixing and matching map functions and multiple marches to create better clouds.
-
72Clouds On Camera P1Vídeo Aula
In this lecture we will begin modifying the clouds shader to work on the camera.
-
73Clouds On Camera P2Vídeo Aula
In this lecture we will complete writing the Clouds.cs script that bypasses the normal Unity drawing to render the clouds on the camera.
-
74Clouds On Camera P3Vídeo Aula
In this lecture we will finished adjusting the existing clouds shader to work when attached to a camera.
-
75Clouds On Camera P4Vídeo Aula
In this lecture the camera direction is corrected for the cloud movement and a challenge involving plasma is presented.
-
76ReferencesTexto
This article presents some extra reading and content on volumetric shaders.