shaders glsl
play

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


  1. SHADERS/GLSL CS 4363/6353

  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

  3. OPENGL PIPELINE

  4. HOW TO LEARN? • Understanding the pipeline? • How about Unity? • Please keep trying! Experiment  Fail  Learn  Repeat

  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

  6. SHADERS IN THE GRAPHICS PIPELINE Vertex Shader Fragment Shader OpenGL (application software) 6

  7. SHADERS IN THE GRAPHICS PIPELINE

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

  9. FRAGMENT SHADER APPLICATIONS Per fragment lighting calculations per vertex lighting per fragment lighting 9

  10. FRAGMENT SHADER APPLICATIONS Texture mapping smooth shading environment bump mapping mapping 10

  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

  12. SHADER LANGUAAGES GLSL CG • HLSL • • • OpenGL Shading • C for Graphics • High Level Shading Language Language Nvidia • • OpenGL ARB (Architecture • Microsoft • DirectX & OpengGL Review Board) • DirectX Deprecated but… • • OpenGL • Windows, XBox • Thanks to Unity, covers all • Windows, Mac, Linux, iSO, platforms Android and more

  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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend