SHADERS/GLSL CS 4363/6353 SHADERS Scary! Weird terminology - - PowerPoint PPT Presentation

shaders glsl
SMART_READER_LITE
LIVE PREVIEW

SHADERS/GLSL CS 4363/6353 SHADERS Scary! Weird terminology - - PowerPoint PPT Presentation

SHADERS/GLSL CS 4363/6353 SHADERS Scary! Weird terminology Primitive assembly Rasterization Zwrite Cull Stencil Math and Data Vertices, Fragments Vectors, Matrices, Textures Cross


slide-1
SLIDE 1

CS 4363/6353

SHADERS/GLSL

slide-2
SLIDE 2

SHADERS

  • Scary!
  • Weird terminology
  • Primitive assembly
  • Rasterization
  • Zwrite
  • Cull
  • Stencil
  • Math and Data
  • Vertices, Fragments
  • Vectors, Matrices, Textures
  • Cross and Dot product
  • Matrix multiplication

2

slide-3
SLIDE 3

OPENGL PIPELINE

slide-4
SLIDE 4

HOW TO LEARN?

  • Understanding the pipeline?
  • How about Unity?
  • Please keep trying!

Experiment  Fail  Learn  Repeat

slide-5
SLIDE 5

SHADERS

  • What is a shader?
  • It is a small program that runs on the GPU
  • Usually written in a high level shader language (e.g. GLSL)
  • Produce images
  • Input: Mesh, Material Data, Lighting Data, and etc.
  • common shaders:
  • Vertex Shader: executes once for every vertex
  • Fragment Shader: executes one for every fragment (potential pixel)

5

slide-6
SLIDE 6

SHADERS IN THE GRAPHICS PIPELINE

6 OpenGL (application software) Fragment Shader Vertex Shader

slide-7
SLIDE 7

SHADERS IN THE GRAPHICS PIPELINE

slide-8
SLIDE 8

VERTEX SHADER APPLICATIONS

  • Moving vertices
  • Transformations
  • Morphing
  • Wave motion (e.g., water)
  • Fractals
  • Lighting
  • More realistic models
  • Cartoon shaders

8

slide-9
SLIDE 9

FRAGMENT SHADER APPLICATIONS

Per fragment lighting calculations

9

per vertex lighting per fragment lighting

slide-10
SLIDE 10

FRAGMENT SHADER APPLICATIONS

Texture mapping

10

smooth shading environment mapping bump mapping

slide-11
SLIDE 11

LAST OF THE BUILT-INS

  • isnan(x) – true is x is not a number (NAN)
  • isinf(x) – returns true is x is +∞ or -∞
  • floatBitsToInt(x) – converts floating point values to ints
  • intBitstoFloat(x) – converts integers to floating points
slide-12
SLIDE 12

SHADER LANGUAAGES

  • HLSL
  • High Level Shading

Language

  • Microsoft
  • DirectX
  • Windows, XBox
  • GLSL
  • OpenGL Shading

Language

  • OpenGL ARB (Architecture

Review Board)

  • OpenGL
  • Windows, Mac, Linux, iSO,

Android and more

  • CG
  • C for Graphics
  • Nvidia
  • DirectX & OpengGL
  • Deprecated but…
  • Thanks to Unity, covers all

platforms

slide-13
SLIDE 13

UNITY!

  • ShaderLab
  • Unity specific shading and material language
  • All shaders written in Unity must be wrapped with ShaderLab
  • May seem like extra work but it’s actually saving you from a lot more work