Shader Program in Gamebryo. Introduction Shader?  A complete Rendering Effect to apply to an object  Shader Program – Vertex/Pixel Shader Shader Programs.

Slides:



Advertisements
Similar presentations
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Advertisements

CS-378: Game Technology Lecture #9: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
The Programmable Graphics Hardware Pipeline Doug James Asst. Professor CS & Robotics.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
(conventional Cartesian reference system)
Further Programming for 3D applications CE Introduction to Further Programming for 3D application Bob Hobbs Faculty of Computing, Engineering and.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Introduction to Computer Graphics Ed Angel Professor of Computer Science, Electrical and.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Beyond Uber-Shaders EXPERIMENTATIONS ON IMPROVING SHADER & EFFECT WORKFLOW.
Shading Languages By Markus Kummerer. Markus Kummerer 2 / 19 State of the Art Shading.
Computer Science – Game DesignUC Santa Cruz Adapted from Jim Whitehead’s slides Shaders Feb 18, 2011 Creative Commons Attribution 3.0 (Except copyrighted.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
What is ? Open Graphics Library A cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is used to interact with a Graphics.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
May 8, 2007Farid Harhad and Alaa Shams CS7080 Over View of the GPU Architecture CS7080 Class Project Supervised by: Dr. Elias Khalaf By: Farid Harhad &
Zhonghua Qu and Ovidiu Daescu December 24, 2009 University of Texas at Dallas.
Real-time Graphical Shader Programming with Cg (HLSL)
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Overview [See Video file] Architecture Overview.
A Crash Course in HLSL Matt Christian.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Computer Graphics I, Fall 2008 Introduction to Computer Graphics.
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Introduction to OpenGL Programming Jian-Liang Lin 2002.
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
NVIDIA CONFIDENTIAL Hardware Shading for Artists.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Shader Study 이동현. Vision engine   Games Helldorado The Show Warlord.
Hardware-accelerated Rendering of Antialiased Shadows With Shadow Maps Stefan Brabec and Hans-Peter Seidel Max-Planck-Institut für Informatik Saarbrücken,
The Cg Runtime Cyril Zeller. Cg Pipeline Graphics programs are written in Cg and compiled to low-level assembly code... Cg Runtime API...
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
09/25/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Shadows Stage 2 outline.
Ray Tracing using Programmable Graphics Hardware
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Gamebryo Shaders.
CgFX Sébastien Dominé, NVIDIA. Overview What is CgFX? CgFX runtime Production pipeline with CgFX CgFX Tools set Demo.
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture Rendering pipeline, shaders and effects 1Elias Holmlid.
Reflective Shadow Mapping By: Mitchell Allen.
Programmable Pipelines
Graphics Processing Unit
Introduction to OpenGL
Chapter 6 GPU, Shaders, and Shading Languages
TerraForm3D Plasma Works 3D Engine & USGS Terrain Modeler
Graphics Processing Unit
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics
Introduction to Computer Graphics
Unity’s Standard Shader Physically Based Shading
ICG 2018 Fall Homework1 Guidance
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
03 | Creating, Texturing and Moving Objects
Introduction to OpenGL
Presentation transcript:

Shader Program in Gamebryo

Introduction Shader?  A complete Rendering Effect to apply to an object  Shader Program – Vertex/Pixel Shader Shader Programs  Assembly code -.vsh/.psh  Compiled assembly code -.vso  Microsoft HLSL -.hlsl  nVidiaCG -.cg

Introduction (cont.) Shader Libraries  NSB/NSF  FX  CG Software Vertex Processing  DEVDESC_HAL_SWVERTEX / DEVDESC_HAL_MIXEDVERTEX  Switching Process Mode  NiD3DRenderState::SetSoftwareVertexProcessing

How to use shader program Write a Shader  NSB/NSF, FX, CG  Derivation from NiShader  Win32 – NiD3DShaderInterface, NiD3DShader, NiD3DDefaultShader  Derive NiShaderLibrary Create a Shader Library  a bunch of shaders put into the shader library Register Shader Library to a Shader Factory  NiShaderFactory::LoadAndRegisterShaderLibrary Use shaders through the shader factory

Shader Library A collection of shaders available to the application at run-time Provide Method  Retrieve shader  Retreive shader description To Use Shader Library Register to Shader Factory  NiShaderFactory::LoadAndRegisterShaderLibrary

Shader System Class Interaction Diagram

Class Detail NiShader  A Common interface for NiShader-NiRenderer interaction  NiShader-NiRenderer interaction  Obtaining a shader from the active material  PreProcessPipeline  Update Render-State : UsesNIRenderState Flag  UpdatePipeline  For all passes  SetupRenderingPass  SetupTransformations  PrepareGeometryForRendering – Packing streams  SetStreamSource, SetIndices  SetupShaderPrograms  PostProcessPipeline

Class Detail (cont.) NiShaderLibrary  A collection of shaders available to the application at run-time  Provide Method  Retrieve shader  Retreive shader description  To Use Shader Library Register to Shader Factory  NiShaderFactory::LoadAndRegisterShaderLibrary

Class Detail (cont.) NiShaderFactory  Handling shaders through shader-libraries  Provide Callback Method  NISHADERFACTORY_CLASSCREATIONCALLBACK  NISHADERFACTORY_RUNPARSERCALLBACK  NISHADERFACTORY_ERRORCALLBACK  Interface for Global Constants of shaders NiGPUProgram  Vertex, pixel shader program

Class Detail (cont.) NiShaderConstantMap  NiShaderConstantMapEntry  Constant  Defined  common transformations, material colors  Attribute  per-object settings of constant values  Global  Operator  result of some mathematical operation on other constant map entries  Object  represents an object in the scene – light, projected effects  Data Driven  NiExtraData

Class Detail (cont.) Decription classes  NiShaderDescBase NiShaderDescBase  NiShaderRequirementDesc NiShaderRequirementDesc  NiShaderAttributeDesc NiShaderAttributeDesc  NiShaderDesc NiShaderDesc  NiShaderLibraryDesc NiShaderLibraryDesc

NSF/NSB Shaders Provide a data-driven method for generating and using Gamebryo's shader system Write NSF  Text based file  Fast Prototyping Generate NSB from NSF  Binary type file  NiBinaryShaderLib Reference external shader file

NiMaterial System Determine proper shader in given circumstance  Generate vertex and pixel shader program code on the fly NiMaterial  NiSingleShaderMaterial NiSingleShaderMaterial  NiFragmentMaterial NiFragmentMaterial  NiStandardMaterial NiStandardMaterial

NiMaterial NiSingleShaderMaterial NiFragmentMaterial  Connected graph  Shade tree ( Shade tree  NiMaterialDescriptor  128-bit bitfield  GenerateDescriptor Is the object skinned? What per-vertex data exists on the object? Is the object lit? How many lights are affecting it? What types of lights are affecting it? What textures are applied to the object? What UV sets do they use? Are there tangent-space bases per-vertex? Is the object affected by specularity?

NiMaterial (cont.) NiFragmentMaterial (cont.)  Create shade tree  NiMaterialConfigurator – shade tree  NiGPUProgramDescriptor  NiMaterialNode – tree node  NiMaterialResource – uniform constants  NiMaterialResourceBinding – connections  Fallbacks  Breaking into several pass or eliminate certain lights or textures

NiMaterial (cont.) NiStandardMaterial  implements the default Gamebryo rendering pipeline

NiMaterial (cont.)

NiStandardMaterial (cont.)  Fallback method  SplitPerPixelLights  SplitPerVertexLights  SplitTextureMaps  DropParallaxMaps  DropParallaxMapThenSplitLights