Modern Graphics Hardware 2002 Vertex Programs Joe Michael Kniss.

Slides:



Advertisements
Similar presentations
Fragment level programmability in OpenGL Evan Hart
Advertisements

Perspective aperture ygyg yryr n zgzg y s = y g (n/z g ) ysys y s = y r (n/z r ) zrzr.
DirectX 8 and GeForce3 Christian Schär & Sacha Saxer.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Patrick Cozzi University of Pennsylvania CIS Fall 2013
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Graphics Hardware CMSC 435/634. Transform Shade Clip Project Rasterize Texture Z-buffer Interpolate Vertex Fragment Triangle A Graphics Pipeline.
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.
9/25/2001CS 638, Fall 2001 Today Shadow Volume Algorithms Vertex and Pixel Shaders.
Informationsteknologi Wednesday, December 12, 2007Computer Graphics - Class 171 Today’s class OpenGL Shading Language.
The Programmable Graphics Hardware Pipeline Doug James Asst. Professor CS & Robotics.
Shading Languages GeForce3, DirectX 8 Michael Oswald.
A Crash Course on Programmable Graphics Hardware Li-Yi Wei 2005 at Tsinghua University, Beijing.
Status – Week 243 Victor Moya. Summary Current status. Current status. Tests. Tests. XBox documentation. XBox documentation. Post Vertex Shader geometry.
Status – Week 242 Victor Moya. Summary Current status. Current status. Tests. Tests. XBox documentation. XBox documentation. Post Vertex Shader geometry.
Status – Week 277 Victor Moya.
GPU Simulator Victor Moya. Summary Rendering pipeline for 3D graphics. Rendering pipeline for 3D graphics. Graphic Processors. Graphic Processors. GPU.
Status – Week 276 Victor Moya. Hardware Pipeline Command Processor. Command Processor. Vertex Shader. Vertex Shader. Rasterization. Rasterization. Pixel.
ARB Fragment Program in GPULib. Summary Fragment program arquitecture New instructions.  Emulating instructions not supported directly New Required GL.
Status – Week 279 Victor Moya. Rasterization Setup triangles (calculate slope values). Setup triangles (calculate slope values). Fill triangle: Interpolate.
Status – Week 283 Victor Moya. 3D Graphics Pipeline Akeley & Hanrahan course. Akeley & Hanrahan course. Fixed vs Programmable. Fixed vs Programmable.
The programmable pipeline Lecture 10 Slide Courtesy to Dr. Suresh Venkatasubramanian.
Status – Week 281 Victor Moya. Objectives Research in future GPUs for 3D graphics. Research in future GPUs for 3D graphics. Simulate current and future.
Status – Week 260 Victor Moya. Summary shSim. shSim. GPU design. GPU design. Future Work. Future Work. Rumors and News. Rumors and News. Imagine. Imagine.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Shader generation and compilation for a programmable GPU Student: Jordi Roca Monfort Advisor: Agustín Fernández Jiménez Co-advisor: Carlos González Rodríguez.
Computer Graphics 3 Lecture 4: GPU Programming Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Using Vertex Shader in DirectX 8.1 강 신 진
GPU Shading and Rendering Shading Technology 8:30 Introduction (:30–Olano) 9:00 Direct3D 10 (:45–Blythe) Languages, Systems and Demos 10:30 RapidMind.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Cg Programming Mapping Computational Concepts to GPUs.
General-Purpose Computation on Graphics Hardware Adapted from: David Luebke (University of Virginia) and NVIDIA.
1 Dr. Scott Schaefer Programmable Shaders. 2/30 Graphics Cards Performance Nvidia Geforce 6800 GTX 1  6.4 billion pixels/sec Nvidia Geforce 7900 GTX.
The programmable pipeline Lecture 3.
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
Shading Languages & HW Giovanni Civati Dept. of Information Tecnology University of Milan, Italy Milan, 26 th May 2004.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Review of OpenGL Basics
A User-Programmable Vertex Engine Erik Lindholm Mark Kilgard Henry Moreton NVIDIA Corporation Presented by Han-Wei Shen.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Fateme Hajikarami Spring  What is GPGPU ? ◦ General-Purpose computing on a Graphics Processing Unit ◦ Using graphic hardware for non-graphic computations.
David Luebke 1 1/25/2016 Programmable Graphics Hardware.
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.
Mesh Skinning Sébastien Dominé. Agenda Introduction to Mesh Skinning 2 matrix skinning 4 matrix skinning with lighting Complex skinning for character.
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Programmable Shaders Dr. Scott Schaefer.
Programmable Pipelines
A Crash Course on Programmable Graphics Hardware
Graphics Processing Unit
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Real-time Computer Graphics Overview
Day 05 Shader Basics.
Introduction to Programmable Hardware
Graphics Processing Unit
Lecture 13 Clipping & Scan Conversion
Where does the Vertex Engine fit?
Computer Graphics Practical Lesson 10
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
CS 480/680 Computer Graphics GLSL Overview.
Presentation transcript:

Modern Graphics Hardware 2002 Vertex Programs Joe Michael Kniss

Overview Pipeline overview VP/FP overview Vertex Programs – Me Fragment Programs – Aaron Discussion

Modern Graphics Hardware Anti-AliasingPrimitive construction Tessellation Transform & Lighting Transform to homogeneous eye space, light, texgen, deform… Triangle setup View volume clip, view surface coordinates Rasterization Generate fragments, interpolate color & texcoords Fragment processing Access textures, & compute final color Tests Stencil, alpha, scissor, depth …. Blending Add, mult, interpolate, max…

Modern Graphics Hardware Primitive construction Transform & Lighting Triangle setupRasterizationFragment processing TestsBlendingAnti-Aliasing Pre Vertex Programs 01 Combiners Fragment Programs Vertex Programs Primitive Programs? 03? Vertex Programs Fragment Programs

Higher order surfaces Higher order surface Transform & Lighting Triangle setupRasterizationFragment processing TestsBlendingAnti-AliasingVertex Programs Fragment Programs PN Triangles (ATI) Bezier patches (NVIDIA)

Vertex Programs Higher order surface Transform & Lighting Triangle setupRasterizationFragment processing TestsBlendingAnti-AliasingVertex Programs Fragment Programs 16 input vectors 256 static vectors 12 temp vectors 22 output vectors Post T&L cache Loops

Vertex Programs 3-5 flavors –nv vertex programs 1.0 & 2.0 –ati vertex program (EXT) –ARB vertex program 1.0 ( & 2.0 ???) nv ati ext  ARB 1.0 Next gen == ARB 2.0 ???? Closely matches Direct3D

Vertex Programs First generation (nv1.0, ati ext, ARB1.0) –128 instructions –96 constants –12 temps –No loops 16 input vectors 96 static vectors 12 temp vectors 15 output vectors Post T&L cache

Vertex Programs First gen. inputs Generic Attribute Conventional Attribute Conventional Attribute Command vertex position Vertex 1 vertex weights 0-3 WeightARB, VertexWeightEXT 2 normal Normal 3 primary color Color 4 secondary color SecondaryColorEXT 5 fog coordinate FogCoordEXT texture coordinate set 0 MultiTexCoord(TEXTURE0,...) 9 texture coordinate set 1 MultiTexCoord(TEXTURE1,...) 10 texture coordinate set 2 MultiTexCoord(TEXTURE2,...) 11 texture coordinate set 3 MultiTexCoord(TEXTURE3,...) 12 texture coordinate set 4 MultiTexCoord(TEXTURE4,...) 13 texture coordinate set 5 MultiTexCoord(TEXTURE5,...) 14 texture coordinate set 6 MultiTexCoord(TEXTURE6,...) 15 texture coordinate set 7 MultiTexCoord(TEXTURE7,...) 8+n texture coordinate set n MultiTexCoord(TEXTURE0+n,...)

Vertex Programs First gen. inputs Conventional Attribute Binding Generic Attribute Binding vertex.position vertex.attrib[0] vertex.weight vertex.attrib[1] vertex.weight[0] vertex.attrib[1] vertex.normal vertex.attrib[2] vertex.color vertex.attrib[3] vertex.color.primary vertex.attrib[3] vertex.color.secondary vertex.attrib[4] vertex.fogcoord vertex.attrib[5] vertex.texcoord vertex.attrib[8] vertex.texcoord[0] vertex.attrib[8] vertex.texcoord[1] vertex.attrib[9] vertex.texcoord[2] vertex.attrib[10] vertex.texcoord[3] vertex.attrib[11] vertex.texcoord[4] vertex.attrib[12] vertex.texcoord[5] vertex.attrib[13] vertex.texcoord[6] vertex.attrib[14] vertex.texcoord[7] vertex.attrib[15] vertex.texcoord[n] vertex.attrib[8+n] ARB 1.0 notation (inputs == Read only)

Vertex Programs First gen instruction set Instruction Inputs Output Description ABS v v absolute value ADD v,v v add ARL v a address register load DP3 v,v ssss 3-component dot product DP4 v,v ssss 4-component dot product DPH v,v ssss homogeneous dot product DST v,v v distance vector EX2 s ssss exponential base 2 EXP s v exponential base 2 (approximate) FLR v v floor FRC v v fraction LG2 s ssss logarithm base 2 LIT v v compute light coefficients LOG s v logarithm base 2 (approximate) MAD v,v,v v multiply and add MAX v,v v maximum MIN v,v v minimum MOV v v move MUL v,v v multiply POW s,s ssss exponentiate RCP s ssss reciprocal RSQ s ssss reciprocal square root SGE v,v v set on greater than or equal SLT v,v v set on less than SUB v,v v subtract SWZ v v extended swizzle XPD v,v v cross product

Vertex Programs First gen instruction set –Wow! That’s a lot of instructions –Why: SIMD processor –Single clock execution –Taken from ARB spec, not all instructions available on all platforms

Vertex Programs First gen. outputs Binding Components Description result.position (x,y,z,w) position in clip coordinates result.color (r,g,b,a) front-facing primary color result.color.primary (r,g,b,a) front-facing primary color result.color.secondary (r,g,b,a) front-facing secondary color result.color.front (r,g,b,a) front-facing primary color result.color.front.primary (r,g,b,a) front-facing primary color result.color.front.secondary (r,g,b,a) front-facing secondary color result.color.back (r,g,b,a) back-facing primary color result.color.back.primary (r,g,b,a) back-facing primary color result.color.back.secondary (r,g,b,a) back-facing secondary color result.fogcoord (f,*,*,*) fog coordinate result.pointsize (s,*,*,*) point size result.texcoord (s,t,r,q) texture coordinate, unit 0 result.texcoord[n] (s,t,r,q) texture coordinate, unit n ARB 1.0 notation (outputs == Write only??)

Vertex Programs What’s special about the ARB 1.0 spec? –Unifies coding for multiple platforms (That’s their job!) –Access to “tracked” OGL state (Materials, Matrices,…) –Unifies vertex programs and next gen fragment programs

Vertex Programs ARB 1.0 continued –Position invariant vertex programs Use the fixed function pipe to transform vertices You still do the lighting Same transformation even if vertex program enabled Option set in VP text file KEY for multi-pass algorithms!!!

Vertex Programs ARB 1.0 continued… –Vender specific “enhancements” –Access special functionality of chip –Use “OPTION BLAH” at top of program text

Vertex Programs Other ARB 1.0 features –Constant scoping, env, state, local Determines life time & update behavior –Temporary aliasing (tmp1 = tmp2) – Automatic constant management, let driver deal with constant numbering!

Vertex Programs ARB 1.0 example !!ARBvp1.0 # comment here ;) ATTRIB pos = vertex.position; #alias long names ATTRIB norm = vertex.normal; PARAM mv[4] = { state.matrix.modelview }; #alias PARAM mvit[4] = { state.matrix.modelview.invtrans }; TEMP tnorm; # temp for the transformed normal DP4 result.position.x mv[0] pos; # vertex to clip space DP4 result.position.y mv[1] pos; DP4 result.position.z mv[2] pos; DP4 result.position.w mv[3] pos; DP3 tnorm.x mvit[0] norm; # tranform the normal DP3 tnorm.y mvit[1] norm; # for lighting (later) DP3 tnorm.z mvit[2] norm; …

Vertex Programs Same example in Cg: struct appin : application2vertex { float4 pos : POSITION; float4 Norm : NORMAL; }; struct vertout : vertex2fragment { float4 HPos : POSITION; float4 PCol : COLOR0; }; vertout main(appin IN) { vertout out; out.Hpos = mul(glstate.matrix.mvp, IN.pos); // note cast to float3 for the normal!!!! float3 tnorm = mul(glstate.matrix.invtrans.modelview[0],(float3)IN.norm); … return out; }

Vertex Programs Next generation (nv2.0, ati ?, ARB2.0?) –256 instructions –256 constants –12 temps ? –Loops –Subroutines –Conditional branching –4 address registers –6 clips & 8 textures 16 input vectors 256 static vectors 12 temp vectors 22 output vectors Post T&L cache Loops

Vertex Programs Next gen vertex programs –True conditional branching, looping and subroutine calls –Conditional write masks –Enhanced instruction set (frac, floor, sin, cos, ex2, lg2, pow, lerp) –More everything vs. NV2X instructions (from 128 to 256) constants (from 96 to 256) address registers (from 1 to 4) texture coordinate sets (from 4 to 8) clip planes (from 0 to 6)

Vertex Programs ARB vp2.0 not ratified yet –Have to use vendor specifics till then –Who knows when??? –Still follows Direct3D, no problem?? –Need uniformity for programmers sake

Questions? … now on to Fragment Programs