NVFX : A NEW SCENE AND MATERIAL EFFECT FRAMEWORK FOR OPENGL AND DIRECTX. TRISTAN LORACH Senior Devtech Engineer SIGGRAPH 2013



Similar documents
nvfx: A New Shader-Effect Framework for OpenGL, DirectX and Even Compute Tristan Lorach ( tlorach@nvidia.com )

Optimizing AAA Games for Mobile Platforms

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Vulkan on NVIDIA GPUs. Piers Daniell, Driver Software Engineer, OpenGL and Vulkan

BRINGING UNREAL ENGINE 4 TO OPENGL Nick Penwarden Epic Games Mathias Schott, Evan Hart NVIDIA

GPU Christmas Tree Rendering. Evan Hart

Introduction to GPGPU. Tiziano Diamanti

Midgard GPU Architecture. October 2014

Outline. srgb DX9, DX10, XBox 360. Tone Mapping. Motion Blur

OpenGL Insights. Edited by. Patrick Cozzi and Christophe Riccio

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Introduction GPU Hardware GPU Computing Today GPU Computing Example Outlook Summary. GPU Computing. Numerical Simulation - from Models to Software

Image Synthesis. Transparency. computer graphics & visualization

AMD GPU Architecture. OpenCL Tutorial, PPAM Dominik Behr September 13th, 2009

OpenGL Shading Language Course. Chapter 5 Appendix. By Jacobo Rodriguez Villar jacobo.rodriguez@typhoonlabs.com

Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

Writing Applications for the GPU Using the RapidMind Development Platform

Radeon HD 2900 and Geometry Generation. Michael Doggett

Parallel Web Programming

Developer Tools. Tim Purcell NVIDIA

Programming 3D Applications with HTML5 and WebGL

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

Dynamic Resolution Rendering

GPGPU Computing. Yong Cao

Flame On: Real-Time Fire Simulation for Video Games. Simon Green, NVIDIA Christopher Horvath, Pixar

Beyond 2D Monitor NVIDIA 3D Stereo

GPU Architecture. Michael Doggett ATI

3D Stereoscopic Game Development. How to Make Your Game Look

Performance Optimization and Debug Tools for mobile games with PlayCanvas

How To Teach Computer Graphics

iz3d Stereo Driver Description (DirectX Realization)

ATI Radeon 4800 series Graphics. Michael Doggett Graphics Architecture Group Graphics Product Group

Computer Graphics on Mobile Devices VL SS ECTS

Equalizer. Parallel OpenGL Application Framework. Stefan Eilemann, Eyescale Software GmbH

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

Getting Started with CodeXL

Programmable Graphics Hardware

A Hybrid Visualization System for Molecular Models

What is GPUOpen? Currently, we have divided console & PC development Black box libraries go against the philosophy of game development Game

ANDROID DEVELOPER TOOLS TRAINING GTC Sébastien Dominé, NVIDIA

Advanced Graphics and Animations for ios Apps

JavaFX Session Agenda

How To Write A Cg Toolkit Program

How To Understand The Power Of Unity 3D (Pro) And The Power Behind It (Pro/Pro)

How To Use An Amd Graphics Card In Greece And (Amd) With Greege (Greege) With An Amd Greeper 2.2.

AMD RenderMonkey IDE Version 1.71

Workshop on Android and Applications Development

Color correction in 3D environments Nicholas Blackhawk

3D Augmented Reality Mobile Application Prototype for Visual Planning Support

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

Real-Time Realistic Rendering. Michael Doggett Docent Department of Computer Science Lund university

Advanced Visual Effects with Direct3D

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

Radeon GPU Architecture and the Radeon 4800 series. Michael Doggett Graphics Architecture Group June 27, 2008

CLOUD GAMING WITH NVIDIA GRID TECHNOLOGIES Franck DIARD, Ph.D., SW Chief Software Architect GDC 2014

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

GPUs Under the Hood. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

Low power GPUs a view from the industry. Edvard Sørgård

The Future Of Animation Is Games

Press Briefing. GDC, March Neil Trevett Vice President Mobile Ecosystem, NVIDIA President Khronos. Copyright Khronos Group Page 1

QuickSpecs. NVIDIA Quadro K5200 8GB Graphics INTRODUCTION. NVIDIA Quadro K5200 8GB Graphics. Technical Specifications

NVIDIA workstation 3D graphics card upgrade options deliver productivity improvements and superior image quality

L20: GPU Architecture and Models

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

Beginning Android 4. Games Development. Mario Zechner. Robert Green

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

XBOX Performances XNA. Part of the slide set taken from: Understanding XNA Framework Performance Shawn Hargreaves GameFest 2007

QuickSpecs. NVIDIA Quadro K5200 8GB Graphics INTRODUCTION. NVIDIA Quadro K5200 8GB Graphics. Overview. NVIDIA Quadro K5200 8GB Graphics J3G90AA

Lecture 1 Introduction to Android

Image Processing & Video Algorithms with CUDA

NVIDIA IndeX Enabling Interactive and Scalable Visualization for Large Data Marc Nienhaus, NVIDIA IndeX Engineering Manager and Chief Architect

Lecture Notes, CEng 477

How to test OpenGL drivers with Free Software

Graphics Cards and Graphics Processing Units. Ben Johnstone Russ Martin November 15, 2011

OpenGL Performance Tuning

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

NVIDIA Corporation 2701 San Tomas Expressway Santa Clara, CA

NVIDIA GeForce GTX 580 GPU Datasheet

Certificate Courses in Animation

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

Visualization and Feature Extraction, FLOW Spring School 2016 Prof. Dr. Tino Weinkauf. Flow Visualization. Image-Based Methods (integration-based)

Far Cry and DirectX. Carsten Wenzel

The In and Out: Making Games Play Right with Stereoscopic 3D Technologies. Samuel Gateau

A Crash Course on Programmable Graphics Hardware

Course materials. In addition to these slides, C++ API header files, a set of exercises, and solutions, the following are useful:

Introduction to Computer Graphics

The Nile Programming Language: Declarative Stream Processing for Media Applications. Dan Amelang Viewpoints Research Institute UCSD PhD Student

The OpenGL R Graphics System: A Specification (Version 3.3 (Core Profile) - March 11, 2010)

The Most Popular UI/Apps Framework For IVI on Linux

CS 378: Computer Game Technology

Broken Shard. Alpha Report. Benjamin Schagerl, Dominik Dechamps, Eduard Reger, Markus Wesemann. TUM Computer Games Laboratory

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Touchstone -A Fresh Approach to Multimedia for the PC

Optimization for DirectX9 Graphics. Ashu Rege

Developer Tutorial Version 1. 0 February 2015

Deferred Shading & Screen Space Effects

Web Based 3D Visualization for COMSOL Multiphysics

GPU Profiling with AMD CodeXL

Transcription:

NVFX : A NEW SCENE AND MATERIAL EFFECT FRAMEWORK FOR OPENGL AND DIRECTX TRISTAN LORACH Senior Devtech Engineer SIGGRAPH 2013

nvfx : Plan What is an Effect New Approach and new ideas of nvfx Examples Walkthrough few Examples Few Details on Key features Conclusion

What Is An Effect (CgFx, HLSLFx) Uniforms / Parameters somefunction(args ) { Shader code Samplers / Textures Technique mytechname { Pass mypassname { Render / Shader States someotherfunction(args ) { Shader code Pass mypassname2 { Uniforms / Parameters Technique mytechname2 {

Standard Effect design Parameters Shader func s Texture Samplers Textures (D3D) Sampler-states Techniques Passes Render-states Effect file Application Effect runtime Render states Shaders Set params (1 by 1 ) Validate passes (builds shaders) Bind textures/samplers Activate a Pass GPU

Issues with Existing Effect Systems Cg CgFX part of Cg toolkit; written in Cg Source code of CgFX not available Specs never evolved since 2002 Microsoft DirectX HLSL Shaders Only Features never evolved Nobody using it, nowdays Khronos Groups s GLSL Nothing available

nvfx Main Features Host many Shading languages (GLSL, GLSLCompute, HLSL, CUDA, OptiX ) Effect == container of Shader snippets Effect as self-sufficient as possible Lower amount C++ specialized code for the effect Intermediate resources (Render-Targets) can be defined Many new Pass-states to help driving effect behavior Flexibility in Shader code linkage through pass-states & API Nesting of Effects Example: Scene-Effects influences Material-Effects (picking; light-models ) Take advantage of new Graphic/Compute API features & extensions Open-Source

Inside An nvfx Effect Uniform Parameters Constant Buffers Render state-groups Shader Code Modules GLSL D3D GLSL-Compute DXCompute Open-CL CUDA Resources description Sampler-states Texture Bind point Resources (render targets) Frame buffers Techniques Passes New Pass-states CUDA/OptiX/Compute [shared] Memory nvfx file

Simple nvfx Example #extension GL_ARB_separate_shader_objects : enable GLSLShader { #version 410 compatibility uniform vec4 scalebias : SCBIAS = {1,0,0,0; Namespace Object { GLSLShader VS { layout(location=0) in vec4 Position; void main() { GLSLShader PS < myannot= bar ; > { layout(location=0) in vec3 v2fworldnormal; uniform sampler2d diffsampler; Main() { rasterization_state myrstates < annot= foo ; > { POLYGON_MODE = FILL; sampler_state defaultsamplerstate { TEXTURE_MIN_FILTER = LINEAR_MIPMAP_LINEAR; TEXTURE_MAG_FILTER = LINEAR; Resource2D difftex < defaultfile = "DiffuseTexture.dds"; > { samplerstate = defaultsamplerstate; Technique BasicTechnique { Pass p1 < annot1= Foo ; annot2=3; > { rasterization_state = myrstates; samplerresource(diffsampler) = { difftex, 0 ; VertexProgram = Object::VS; FragmentProgram = Object::PS; FragmentProgram< light > = LightingImpl; Uniform(scaleBias) = {.5, 1.0,1.0,1.0 ; CurrentTarget = backbuffer; Technique mysubtechnique1 Off Technique mysubtechnique2 On

nvfx Effect Integration Application nvfx files Shader code code Techs/passes Techs/passes nvfx runtime nvfx files Techs/passes Application nvfx files Techs/passes Techs/passes Application Shader code Shader code C++ nvfx Effects Shader Shader code code nvfx runtime Precompiled shaders nvfx runtime Precompiled shaders

Front-End : parser (Bison) Parses the effect API Design Does not parse the shader/compute code that is inside! Back-End : the library to build the effect data Used by the Front-End to create parsed data Used by the application to drive the effects Works on PC, Unix (OSX/Linux), Android even ios Application API Your Front-End Parser Front-End (nvfx parser) Custom Grammar & Token C++ Back-End (nvfx runtime) OpenGL DX CUDA Your Gfx API layer

Demos

1 2 Example : HDR Rendering With Glow Scene Effect Render Skybox in HDR Render The Scene in HDR RGBA32F Texture (HDR) Scene Graph 1 2 3 775 6 4 3 4 Down-scale the texture 2x, 4x RGBA 32F Texture Material Effect 1 5 6 7 Blur texture Horizontal Then Vertical Compositing: tone-mapping And radial Blur + Backbuffer Metal Pass Material Effect 2 Plastic pass Other Effects

Example : Compute Post-Processing Scene Effect passes 1 Render Skybox Scene Graph 2 Render The Scene Material Effect 1 Metal Pass Material Effect 2 Plastic pass RGBA Texture 3 Triggers CUDA (or GLSL/DX- Compute) Kernel Other Effects Backbuffer 4 Display result As a fullscreen Quad

Results with CUDA / GLSLCompute filtering Bokeh Filter Convolution

Technique 1 Simulation passes Advect Color Advect Velocity Vorticity Confinement Emit (Gaussian ball) Fire (Navier-Stokes equations) 2 Volume depth Volume bound 1 Volume bound 2 3 Volume depth Smoke Ray-cast Water Ray-cast Fire Ray-cast 4 Rasterize Rasterize result Fire Up-force Vel. divergence Comp. pressure Proj. Velocity Proj. Vel. edges Techniques passes

Shader Code We rely on existing compilers Declared within a section : GLSLShader myshader { layout(location=0) in vec4 Position; void main(void) { CUDAKernel Blur(unsigned int* data, int imgw, ) { Conpute code D3D10Shader myd3dshader { HLSL code NOT Parsed

Techniques & Passes A technique hosts passes Clear mode (glclear mode ) Clear color Rendering Mode Render Group Id Blit action of a resource to a target Current Target for rendering Viewport Size Swap of 2 resources Loop count (to repeat passes) GLSL sub-routine Active Pass On/Off each pass can setup a set of default uniform values CUDA Module; Shared Mem. Grid/Block GLSL Compute Groups And can host other Techniques A Pass carries render-pipeline setup and actions References to State-Groups Or direct References to render-states (old style as CgFX) References to many Shaders (Vertex, Fragment etc.) Value assignment to uniform parameters Connection of images/samplers/textures with resources & Sampler-states Lots of other special Pass-states to drive the runtime behavior

Resources in nvfx Visual Effects resources : often inter-dependent Example : deferred shading G-Buffer really depends on how the effect does deferred shading Compute Graphics : need interaction through resources Compute reading from a rendered image and writing into a Textures Compute kernels sometimes need temporary storage Idea of creation of resources within an effect nvfx creates them in a Resource-Repository

Resource Creation And Use Create resources : RenderTexture myrtex1 { MSAA = {0,0; Size = ApplicationDefined;// or {800,600; Format = RGBA8; RenderTexture myrtex2 { RenderBuffer mydst { MSAA = {0,0; Size = ApplicationDefined;// or {800,600; Format = DEPTH24STENCIL8; Create Frame Buffer Object FBO myfbo { Color = { myrtex1, myrtex2 ; DST = mydst; Use this in Passes CurrentTarget = myfbo;//(can be backbuffer) BlitFBOToActiveTarget = myfbosrc; swapresources( mfbo1, myfbo2 ); samplerresource(mysampler) = myrtex1; You can query all from your Application, too

Linkage of Shader Modules Literally allows you to link Shader Objects to a program Object A Pass hosts a program VertexShader = {ShaderMain, ShaderHelpers, ShaderA, ShaderB, ; We can group shaders by name : VertexShader = myvtxshadermain; VertexShader< Lighting > = {VtxLight0, VtxLight1, VertexShader< TanBinorm > = {computetanbinorm, Named Groups allow to Change some behavior at runtime From the Application thanks to the API From a Parent-Pass : overriding Lighting with another Shader-code

Scene-Level / Multi-Level Effects pre/post-processing are Effects, too : at scene level Scene-level Effects and material Effects must be consistent Deferred shading : Material RT s must match the G-Buffer Shadowing of the scene : must tell materials how to use Shadowing Special scene lighting : need to tell material Shaders how to do lighting nvfx Allows Effect (Scene-level) to override the final linkage of lower levels effects lower level Effect shaders compiled for the needs of the higher one instances of shader programs matching the scene-level requirements

Example of Scene-level override Scene-level Effect Pass renderscene { ClearMode = all; FragmentProgramOverride["out"] = forgbuff; FragmentProgramOverride[ light"] = nolight; CurrentTarget = mygbuffer; rendermode = render_scenegraph_shaded; Pass deferredlighting { VertexProgram = deferredlightingvs; FragmentProgram = deferredlightingps; rendermode = render_fullscreen_quad; CurrentTarget = backbuffer; Material Effect in the scene Pass mymatpass1 { VertexProgram = myvtxprog; FragmentProgram = {helpers, mainentry; FragmentProgram[out] = simpleoutput; FragmentProgram[light] = defaultlighting; New instance of mymatpass1 Pass mymatpass1 { VertexProgram = myvtxprog; FragmentProgram = {helpers, mainentry; FragmentProgram[out] = forgbuff; FragmentProgram[light] = nolight;

Conclusion Less specialized code in Application More flexibility Consistency of Effects : Helps for maintenance and creativity Updated use of modern APIs : Good for performance Open-Source approach Easily debug it Improve it Customize it make it yours or get inspiration from it First drop now available on https://github.com/tlorach/nvfx Feedback : tlorach@nvidia.com