Shaders Flashcards

1
Q

3 Shader Categories

A

Graphics pipeline Shaders
Compute Shaders
Ray tracing Shaders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the Graphics pipeline Shader?

A

Most common shader.
Performs calculations that determine the color of the pixels on the screen.
Uses shader objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are Compute Shaders?

A

They perform calculations on the GPU outside of the regular graphics pipeline.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are Ray tracing Shaders?

A

Perform calculations related to ray tracing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are shader objects?

A

An instance of the shader class. A wrapper for shader programs and other information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Shader Lab?

A

A unity-specific language for writing Shaders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a Shader graph?

A

A tool for creating Shaders without writing code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a Shader Asset?

A

A file in your project that defines a Shader object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are Shaders?

A
Shaders are part of the Graphics pipeline.
An instance of the shader class is called a Shader object.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Shader Object?

A

Shader objects is a way of working with shader programs; it is a wrapper for shader programs and other information.
It let’s you define multiple shader programs in the same file and tell unity how to use them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What do shader objects contain?

A

A Shader object contains shader programs, instructions for changing settings on the GPU (collectively called render states), and information that tells unity how to use them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What do you use shader objects for/with?

A

You can use shader objects with materials to determine the appearance of your scene

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you create shader objects? (2 ways)

A

1) You can write code to create a Shader asset, which is a text file with the (.Shader) extension.
2) You can use a Shader graph to create a Shader graph asset.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

An instance of the shader is called?

A

A Shader object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Inside a Shader object…

A

A Shader object has a nested structure.
It organizes information into structures called Subshaders and Passes.
It organizes shader programs into shader varients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does a Shader object contain?

A

1) Information about its self such as it’s name.
2) An optional fallback shader object, which unity uses if it can’t use the current one.
3) One or more Subshaders

17
Q

What else can you do with shader objects?

A

You can also define additional information such as shared shader code, or whether to use a custom editor.

18
Q

What is a SubShader?

A

Subshaders let you separate your shader object into parts that are compatible with different hardware, render pipelines, and runtime settings.

19
Q

What does a SubShader contain?

A

1) Information about which hardware, render pipelines, and runtime settings this shader is compatible with
2) Subshader tags, which are key-value pairs that provide information about the Subshader
3) One or more passes

20
Q

What else can you do with Subshaders?

A

You can also define information, such as render state that is common to all of its passes

21
Q

Passes in Subshaders… What do they contain?

A

A Pass contains…

1) Pass tags. Which are key-value pairs that provide information about the pass.
2) Instructions for updating the render state before running its shader programs.
3) Shader programs, organized into one or more shader varients.

22
Q

What are Shader Varients?

A

The Shader programs that a Pass contains are organized into shader varients.
Shader varients share common code, but have different functionality when a given keyword is enabled or disabled.
The number of shader variant in a Pass depends on how many keywords you define in your shader code, and the target platform
Each pass contains at least one variant.

23
Q

Before unity uses a Shader object..

A

Unity creates a list of Subshaders for the shader object.
It adds all of the Subshaders defined in the shader object, and then adds all of the Subshaders in any fallback shader objects, in order.

24
Q

When Unity first renders geometry using the Shader object, or when the shader LOD value or active render pipeline changes…

A

1) Unity iterates over the list of all the Subshaders and examines them to determine if they are: Compatible with the device hardware at all or below the current shader LOD value, and compatable with the active render pipeline.
2) If the list contains one or more Subshaders that meet these requirements, it selects the first one. This is the active Subshader.

3) If the list does not contain any Subshaders that meet all the requirements:
If the list contains one or more Subshaders that meet the hardware requirements (but do not meet the LOD or render pipeline requirements) Unity selects the first one to be the active Subshader.
If the list does not contain a u Subshaders that meet the hardware requirements, Unity displays the error Shader.

25
Q

Can Unity identify geometry?

A

Unity identifies geometry that uses the same shader variant and organize it into batches for more efficient rendering.
Once per frame, for every batch of geometry.

26
Q

Once every frame, for every batch of geometry…

A

1) Unity determines which of the Passes in the active Subshader it should render, and at which point in the frame. This behavior varies by the render pipeline.

2) For Every Pass that it renders :
- If the current render state does not match the render state defined in the Pass, Unity sets the render state as defined in the pass.
- The GPU renders the geometry using the relevant shader variant.

27
Q

Error shader and error loading Shaders…

A

Unity sometimes can’t render objects with regular Shaders, when this happens Unity renders the objects with special shaders

28
Q

Special error shaders

A

The default error shader
The loading shader
The streaming virtual texturing error material

The special Shader Unity uses depends on the reason that Unity can’t load the original Shader.

29
Q

The Default error shader..

A

The default error shader is Magenta(bright pink)
Unity uses the default error shader in the editor, and in builds.
Used when there’s a problem with that objects material or shader, I. E, if no material is assigned, if the shader doesn’t compile or if the shader isn’t supported.

30
Q

With the BatchRendererGroup API

A

Unity doesn’t display the default error shader

Unity doesn’t display the loading shader

31
Q

The Loader Shader…

A

Used to indicate that Unity is compiling the shader variant needed to display that object

32
Q

When does the Loading shader showed?

A

When the Asynchronous shader compilation is enabled, or in a development build when the Shader Live Link Support is enabled
The Loading Shader is Cyan (Bright blue)

33
Q

Virtual Texturing Error Material

A

If your project uses Streaming Virtual Texturing (STV), Unity uses a special material to indicate problems in your STV setup.