UnityShader Development Starting from Zero Chapter 1 :What is a Shader?

Today is the Unity Shader Topic.

Last year , The shader study session held in my company.

The reason for the event was that one of our interns asked me for advice on Shader, and more and more engineers in our company are interested in Shader, so I decided to take the time to share my knowledge with them.

Here, I will introduce Shader, recalling some of the stumbling blocks in learning Shader as a self-taught student for about two years.

Shader Study Session Objectives

This workshop is intended for the following people.

・Those who have heard of Shader in Unity but do not know what it is.

・Want to try writing Shaders but don’t know how to do it.

The goal of this article is to

・To understand what Shader is doing.

・Understanding Shaders in Unity.

・To be able to write basic Shader in Unity.

What is Shader?

Shader generally refers to the drawing program language in a computer or the program itself being executed.

Generally, a PC outputs some kind of display on a display as an output device.
 Shader generally refers to the program that performs the drawing in the 3DCG space in real-time or pre-render.

3DCG space refers to a space where positions are represented by XYZ axes.

What does Shader output?

Shaders generally output the display color (RGB) for each pixel of the display.

To understand this, we need to have the pixels = pixels of the display under control.

The screen of a computer or smartphone consists of a collection of pixels made up of three lights: Red (Red), Green (Green), and Blue (Blue).

Shader controls the emission of these lights and determines the colors displayed on the screen.

For example, in the case of a 4k monitor, this screen is composed of 8 million pixels, and 8 million pixels are controlled in a single frame.

For this purpose, Shader is executed on a GPU that excels at parallel computing.

Shader And GPU

As mentioned above, in general programming languages, processing is performed on the CPU, but Shader is unique in that processing is performed on the GPU.

CPUs and GPUs are often described as one genius on a CPU” versus “10,000 ordinary people** on a GPU”. GPUs have less computing power than CPUs, but they have far more cores and can perform significantly more calculations simultaneously. GPUs have a much larger number of cores than CPUs.
 In recent years, GPUs have been increasingly used in calculation fields that require a huge number of parameters, such as AI and physical simulation, by applying their parallel computing power. As GPU = GraphicsProcessingUnit, it was originally designed specifically for drawing (graphics) calculations using parallel computing power and its drawing output.

As mentioned above, the Shader is executed on the GPU to produce tens of thousands of outputs in a single frame.

Chapter 1 Summary

In Chapter 1, we touched on Shader.

Shaders are generally programs that return final colors and are executed on GPUs, which excel at parallel computing, in order to draw a screen consisting of tens of thousands of pixels in a single frame.

In Chapter 2, we will show how the process is executed on a GPU.


Popular posts from this blog

Tokyo HoloLens Meetup vol.32 Event Report