fx composer - nvidiadownload.nvidia.com/.../presentations/2004/gpu_jackpot/fx_composer...what fx...

41
FX Composer A Programmer’s Intro Kevin Bjorke NVIDIA Developer Resources Group

Upload: tranthuan

Post on 27-May-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

FX ComposerA Programmer’s Intro

Kevin BjorkeNVIDIA

Developer Resources Group

Page 2: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Overview

What FX Composer Is

What Makes FX Composer Unique

How It Can Apply to Your Applications

Page 3: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Developing Shaders: Programmers

Shading tools are important for both Programmers and DesignersTo be complete for modern game engines, tools have to support ideas like:

Render-To-Texture (RTT)Multiple Render Targets (MRT)Render States like stencil, alpha blend, etc.Custom Texture Maps (e.g. Normalization cubes, noise)SHIrradiance and PRTManagement details to make sure complex ordering matches any specific game engine’s render loop

How to get results in and out of your game engine or application, at every stage of production?

Page 4: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Developing Shaders: Artists

Artists want to see what they design when they design it, not just guess at what it might look like laterNot just seeing the correct models, but also the correct lighting environment, so that the shaders viewed and/or developed can really be the ones used in-game.Implementations are typically different in each different DCC application (Maya versus Max versus XSI versus….)We want to accommodate console-game designers, too: “What might my model look like on Playstation?”

Page 5: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

HLSL FX Metaformat

A Tool Built for the TaskEasily swappable for artists and programmersAlready a part of DirectX and XNA – no external SDK requiredSome viewing support already in XSI, 3DStudio Max, and MayaAlready used in shipping, high-performance games

01

Page 6: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

NVIDIA FX ComposerFX Composer empowers developers to create high performance shaders in an integrated development environment with real-time preview & optimization features available only from NVIDIA.

CREATE your shaders in a high powered developer environment

DEBUG your shaders with basic shader debugging features

TUNE your shader performance with advanced analysis and optimization features

EverQuest® content courtesy Sony Online Entertainment Inc.

Page 7: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

FX Composer

The Gold Standard in FX editing tools, with more complete support than any otherCombine & customize shadersExtensibleUse any 3D modelPerformance tuningWorks with RTZen et alhttp://www.fxcomposer.com/

01

Eve

rque

st®

Con

tent

Cou

rtesy

Son

y O

nlin

e E

nter

tain

men

t Inc

.

Page 8: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

FX Composer - Screenshot

Page 9: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

User Interface Screenshot

Page 10: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Materials & Textures

Preview all the FX files in your scene at the same time

Apply them to the appropriate parts of your scene in the Scene panel

View source textures

Preview render targets

Save any texture to disk!

Page 11: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Editing and Debugging

Edit multiple .FX files

Intellisense (auto-complete)

Syntax highlighting

Jump-to-error helps you find & fix problems quickly

Page 12: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Previewing & Customizing

Conveniently edit your shader parameters

Automatic parsing of semantics & annotations

Update vector and matrix values using tear-off dialogs

Quickly select custom color values

Navigate to select scene elements and edit properties in the Scene Graph Panel

Page 13: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Tune Your Shader Performance

User the Shader Perf panel

Select the technique, pass and vertex or pixel shader to analyze

Simulate pixel shader performance on any recent NVIDIA GPU

Optimized DirectX Assembly

NVIDIA performance analysisGPU cycle countEfficiency / utilization ratingNumber of passesRegister usage

Page 14: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

NVIDIA FX Composer

Scene Panel

Preview your 3D scene in real-timeApply materials to scene elementsManipulate the scene elements or the entire sceneUse primitives or import .x/.obj/etc models and .nvb scenesSet your own key frames or play existing animationsPlace lights and customize lighting propertiesSelect user-defined cameras or default scene camera

Page 15: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

2D Shader Demo: Bloom and Gloom

Shows:FP16 processingLayering of post-process effects

20

Page 16: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Bloom and Gloom: Shading Stack

We can assign by hand in Material Editor, or edit in the ScriptExecuteSorter Window

Page 17: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

Render PipelinesIdentification and Feeding

Page 18: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Render Pipeline: The “A-B-C” Model

Many programs still use the simplest possible Z-culled double-buffered pipeline:

Clear to BG ColorRender Object ARender Object BRender Object CRender Object D…Display complete scene!

Examples include many older games and most all DCC and CAD applications.

Page 19: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Programmable Shading in A-B-C

The method used by 3DStudio Max DirectX9 Materials and in the CgFX plugins for Maya etc

Clear to BG ColorRender Object A (potentially in multiple passes)Render Object B (potentially in multiple passes)Render Object C (potentially in multiple passes)Render Object D…Display complete scene!

A great improvement in appearance, but still no render-to-texture effects etc. – so shaders may or may not be the “real” final shaders

Page 20: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Going Beyond A-B-C

More complex rendering, like that in the Maya Hardware Render Device, or modern game engines, uses a rich mixture of 3D and 2D operations

Textures created on the flySpecial masks for compositingStencilGlints and glowsEtc…

Page 21: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

A Simple Complex Pipeline….

(this is a simplified example):Deep clear (floating point image)Render object D & B into one shadow mapDeep clear (floating point image)Render object C into another shadow mapClear to bg textureRender MRTs – object A and depth using previous shadow passesRender objects D&B using shadow passesSave to textureBlur verticallyBlur again, horizontallyRestore unaltered BG imageAdd part of blurred image to create bloom in brightest areasRender object C using blurred bg texture as refractionAdd textured fog based on MRT depth samplesDisplay complete scene

Page 22: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Complex Pipelines

Game pipelines are becoming as complex as film-production pipelines, which may have dozens or hundreds of composited elements, each broken into multiple passes for shadowing, glows, diffuse/specular separation and balancing, live-action BG plates, etc.

Page 23: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Complex Pipelines for Games

While film pipelines use multiple rendering and compositing tools, interactive applications have to do rendering and compositing operations in the same app – and fastGame appearances may require different handling depending on the hardware – high end, low end, or console (potentially multiples)

Page 24: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Managing Complexity

Programmability lets us bundle ideas together and control them flexiblyProgrammability up and down the entire chain:

GPU shading unitsGraphics API stateTracking of basics like mouse, object transforms, etcHigh-level scene building, control, data import and export

Page 25: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Layers of HLSL Programmability

HLSL Pixel and Vertex shadersHLSL VM functions for the CPUHLSL VM Texture functions (“texture shaders”)HLSL DXSAS scripting for render-loop controlHLSL DXSAS scripting for layeringHLSL technique validation for varying GPUsIn FX Composer:

Windows Common Language Runtime (CLR)C#VB.NET

FX Composer SDK

Page 26: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Only in DirectX FX:

HLSL Pixel and Vertex shadersHLSL VM functions for the CPUHLSL VM Texture functions (“texture shaders”)HLSL DXSAS scripting for render-loop controlHLSL DXSAS scripting for layeringHLSL technique validation for varying GPUsIn FX Composer:

Windows Common Language Runtime (CLR)C#VB.NET

FX Composer SDK

Page 27: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Only in FX Composer so far:

HLSL Pixel and Vertex shadersHLSL VM functions for the CPUHLSL VM Texture functions (“texture shaders”)HLSL DXSAS scripting for render-loop controlHLSL DXSAS scripting for layeringHLSL technique validation for varying GPUsIn FX Composer:

Windows Common Language Runtime (CLR)C#VB.NET

FX Composer SDK

Page 28: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

DXSAS Renderloop Scripting

Scripts are stored in string annotationsScripts can be part of passes, techniques, and the global FX scopeTechnique scripts can call pass scriptsGlobal scripts can call technique or pass scriptsDXSAS Script is our window to:

Render to Texture (RTT)Multiple Render Targets (MRT)Conditional RenderingLayer of FX effects

Page 29: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

“DXSAS” Sample Implementation

C# app w/ complete source codeUses Managed Direct XSupport for DXSAS including scriptingLess overhead for display, so draws faster than FX Composer

Page 30: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

FX Composer CLR Scripting

FX Composer is built as a .NET applicationMost controls are .COM assembliesScriptable from within FX Composer – no additional program needed

Edit with Intellisense etcC# and VB.NET supported via Common Language Runtime (CLR)Other CLR languages, such as Managed C++ or Jscript, could be made available if someone really needed themFast!

“Nv_sys” library can be browsed in the OLE ViewerMost operations can be done using this APICan talk to external DCC apps, SQL DBs, etc

Page 31: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Script Demo: Shader Donuts

Shows:C# Integration and highlightingOLE Browser for “nv_sys”Reading files from C#Creating NodesCreating KeyframesReading Annotations

Page 32: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

FXComposer Plugin SDK

Plugins are written externally in an environment like Visual StudioCompiled and then installed in the Plugin directoryFX Composer’s SDK is mainly designed for object import and material export (the CLR API is also good at export)

Page 33: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

C# Animation

C# Scripts are subclass of “INVUtility”The entry point is alwayspublic int Run(interop.nv_sys.NVSystem Sys)

Use OLE browser to explore nv_sys namespaceWe can access almost every part of the FX Composer data structure, create objects, save images……as well as communicate with other processes, files, etc.Samples supplied for both C# and VisualBasic.NET

Page 34: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

SDK Demo: Import/Export

Not a Demo per se –Plugins are created in Visual Studio etcSome functionality overlaps C#Can be used for Import of custom geometry formats, material export (mtl exporter shown)Pix courtesy Mike Chow at Rainbow Studios

Page 35: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

Frequently Asked Questions

Support Cg or GLSL?

Integration with my engine?

Integration with DCC applications?

Compared to Effect Edit, Ginza, & others?

Support for other platforms?

The latest version of FX Composer and the full FAQ athttp://developer.nvidia.com/fxcomposer

Page 36: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

For More Info...

Download presentations, SDK, Tools, etc: http://developer.nvidia.com

Questions, requests, and comments for Tools and SDK: [email protected]

About this presentation: [email protected]

Page 37: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

The Source forGPU Programmingdeveloper.nvidia.com

Latest NewsDeveloper Events CalendarTechnical DocumentationConference PresentationsGPU Programming GuidePowerful Tools, SDKs, and more...

Join our FREE registered developer program for early access to NVIDIA drivers, cutting edge tools, online support forums, and more!

Page 38: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

developer.nvidia.comdeveloper.nvidia.comThe Source for GPU Programming

Latest documentationSDKsCutting-edge tools

Performance analysis toolsContent creation tools

Hundreds of effectsVideo presentations and tutorialsLibraries and utilitiesNews and newsletter archives

EverQuest® content courtesy Sony Online Entertainment Inc.

Page 39: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

NVIDIA SDK

Hundreds of code samples and effects that help you take advantage of the latest in graphics technology.

Tons of updated and all-new DirectX and OpenGL code samples with full source code and helpful whitepapers:

Geometry Instancing, Rainbow Fogbow, Blood Shader, Perspective Shadow Maps, Texture Atlas Utility, ...

Hundreds of effects, complete with custom geometry, animation and more:

Skin, Plastics, Flame/Fire, Glow, Gooch, Image Filters, HLSL Debugging Techniques,Texture BRDFs, Texture Displacements, Tonemapping, and even a simple Ray Tracer!

The source for real-time developers

Page 40: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

GPU Gems: Programming Techniques, GPU Gems: Programming Techniques, Tips, and Tricks for RealTips, and Tricks for Real--Time GraphicsTime Graphics

Practical real-time graphics techniques from experts at leading corporations and universities

Great value:Contributions from industry expertsFull color (300+ diagrams and screenshots)Hard cover816 pages

“GPU Gems is a cool toolbox of advanced graphics techniques. Novice programmers and graphics gurus alike will find the gems practical, intriguing, and useful.”Tim SweeneyLead programmer of Unreal at Epic Games

“This collection of articles is particularly impressive for its depth and breadth. The book includes product-oriented case studies, previously unpublished state-of-the-art research, comprehensive tutorials, and extensive code samples and demos throughout.”Eric HainesAuthor of Real-Time Rendering

For more, visit:For more, visit:http://developer.nvidia.com/http://developer.nvidia.com/GPUGemsGPUGems

Page 41: FX Composer - Nvidiadownload.nvidia.com/.../presentations/2004/GPU_Jackpot/FX_Composer...What FX Composer Is ... on any recent NVIDIA GPU ... Join our FREE registered developer program

©2004 NVIDIA Corporation. All rights reserved.

The Cg Toolkit

NVIDIA Cg CompilerVertex (DirectX 9, OpenGL 1.4)

Pixel (DirectX 9)

Cg Standard Library

Cg Runtime Libraries forDirectX and OpenGL

NVIDIA Cg Browser

Cg Language Specification

Cg User’s Manual

Cg Shaders (assorted pre-written programs)

The Cg Tutorial (developer.nvidia.com/CgTutorial)