GL-Hijacking: Reconstructing from Streams for Stylized Rendering Alex Mohr Mike Gleicher Department of Computer Sciences University of Wisconsin-Madison.

Slides:



Advertisements
Similar presentations
Real-Time Rendering 靜宜大學資工研究所 蔡奇偉副教授 2010©.
Advertisements

OpenGL: Simple Use Open a window and attach OpenGL to it Set projection parameters (e.g., field of view) Setup lighting, if any Main rendering loop –Set.
Chapter 2: Graphics Programming
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
 Engineering Graphics & Introductory Design 3D Graphics and Rendering REU Modeling Course – June 13 th 2014.
CS 4363/6353 INTRODUCTION TO COMPUTER GRAPHICS. WHAT YOU’LL SEE Interactive 3D computer graphics Real-time 2D, but mostly 3D OpenGL C/C++ (if you don’t.
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
Lab 1: OpenGL Tutorial CS 282. What’s the plan for today? Go over our framework code. Learn some basic OpenGL! Reveal Lab 1 Answer questions.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Adv. Computer Graphics CS6500, Spring 2003.
Approximate Soft Shadows on Arbitrary Surfaces using Penumbra Wedges Tomas Akenine-Möller Ulf Assarsson Department of Computer Engineering, Chalmers University.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Week 14 - Wednesday.  What did we talk about last time?  Collision handling  Collision detection  Collision determination  Collision response  BSPs.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Programming in OpenGL Ryan Holmes CSE 570 February 12 th, 2003.
CS451 Computer Graphics JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY.
COMP 175: Computer Graphics March 24, 2015
COS 397 Computer Graphics Assoc. Prof. Svetla Boytcheva AUBG 2013 COS 397 Computer Graphics Practical Session №1 Introduction to OpenGL, GLFW and CG.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Polygon Lists & 3-D File Formats Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 18, 2002.
Image Synthesis Rabie A. Ramadan, PhD 3. 2 Our Problem.
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Advanced Computer Graphics March 06, Grading Programming assignments Paper study and reports (flipped classroom) Final project No written exams.
Week 2 - Wednesday CS361.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
1 Artificial Intelligence: Vision Stages of analysis Low level vision Surfaces and distance Object Matching.
Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.
11/16/04© University of Wisconsin, CS559 Fall 2004 Last Time Texture Anti-Aliasing Texture boundaries Modeling introduction.
OpenGL CS418 Computer Graphics John C. Hart. OpenGL Based on GL (graphics library) by Silicon Graphics Inc. (SGI) Advantages: Runs on everything, including.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
- Introduction - Graphics Pipeline
Week 14 - Wednesday CS361.
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Week 2 - Friday CS361.
POLYGON MESH Advance Computer Graphics
CS451Real-time Rendering Pipeline
© University of Wisconsin, CS559 Fall 2004
Frame Buffer Applications
Presentation transcript:

GL-Hijacking: Reconstructing from Streams for Stylized Rendering Alex Mohr Mike Gleicher Department of Computer Sciences University of Wisconsin-Madison

The Problem… Lots of applications Lots of features that we want to try O(n^2) things to try, O(1) labor Want to try stylized rendering (various types) in real applications Not just toy apps!

The solution Alex Mohr (he’s spending the summer at Pixar, so I get to give the talk) Not afraid of the low-level engineering Single-handedly responsible for all the engineering miracles Chris Hermann wrote the Toon and Colored pencil renderers

The project history Spring ’99 NPRQuake (CS838 project) Hack Quake sources for plug-in renderers Fall ’00 GlHijacker 1 Engineering proof of concept Simple stream transforms Fall ’01 GlHijacker 2 Geometry reconstruction Other people write renderers End of Project Alex loses interest Next step requires too much engineering

Synopsis Intercept all calls to the low-level graphics library (OpenGL) Needs common API to have apps to hijack! Build a useful intermediate representation Need what is needed for features/renderers Plug-in interesting features Yes! You can download it! go to the gallery page…

Pencil-Sketch Light Saber Fight?

“Here at Jedi-Outcast we’ve been having fun all night playing Jedi-Outcast with Cel Shaded Graphics. And let me tell you. It’s amazing.” “In addition to the “Pencil Sketch” mode it also includes Toon mode and Blueprint modes which are also fun to play with..”

Not too bad for real-time…

Note: We do not even have this program We only found out about it from our weblogs! “Real people” are trying something “Real application” - people really use Much richer than our virtual environments And they’re doing weird things with it…

There’s no accounting for taste… The Jedi-Outcast folks did this, not us!

Is this less painful in pencil sketch?

GL-Hijacking: the easy part… Intercept call stream (replace shared lib) Lots of engineering, others do this too OpenGL Display Application OpenGL Display Application BeforeAfter Hijacker

What can you do with this? Not too much (nothing interesting) Command stream transformations Mohr&Gleicher ‘01, Chromium ‘02 Simple techniques Perturb data, global state changes

The Problem: Stream tells you how to draw Procedural, imperative, performance tricks, … Ordered, and order dependent Care about what was drawn Declarative, geometrical Data structures describing objects Winged edges, object lists, … All we get is a trace of the program!

Example problem: How to draw a cube? 8 quads? 16 triangles? 24 triangles? 1 triangle strip? 1 vertex array? 1 plane that is transformed? 1 point that is transformed differently? 1 point in place, camera moves around it? And you want me to tell you what edge is a silhouette? Edges are never really represented in OpenGL

Drawing a cube Where is this point in the code? glNormal3f(0,1,0); glBegin(GL_TRIANGLE); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,1,1); glEnd(); glNormal3f(0,1,0); glBegin(GL_TRIANGLE); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,1,1); glEnd();

Drawing a cube glNormal3f(0,1,0); glBegin(GL_TRIANGLE); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,1,1); glEnd(); glBegin(GL_TRIANGLE); glVertex3f(1,1,1); glVertex3f(0,1,1); glVertex3f(0,1,0); glEnd(); glNormal3f(0,0,-1); glBegin(GL_TRIANGLE); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,0,0); glEnd(); glBegin(GL_TRIANGLE); glVertex3f(1,0,0); glVertex3f(0,1,0); glVertex3f(0,0,0); glEnd(); glNormal3f(-1,0, 0); glBegin(GL_TRIANGLE); glVertex3f(0,0,0); glVertex3f(0,1,1); glVertex3f(0,1,0); glEnd(); glBegin(GL_TRIANGLE); glVertex3f(0,1,1); glVertex3f(0,1,0); glVertex3f(0,0,1); glEnd(); glNormal3f(0,1,0); glBegin(GL_TRIANGLE); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,1,1); glEnd(); glBegin(GL_TRIANGLE); glVertex3f(1,1,1); glVertex3f(0,1,1); glVertex3f(0,1,0); glEnd(); glNormal3f(0,0,-1); glBegin(GL_TRIANGLE); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,0,0); glEnd(); glBegin(GL_TRIANGLE); glVertex3f(1,0,0); glVertex3f(0,1,0); glVertex3f(0,0,0); glEnd(); glNormal3f(-1,0, 0); glBegin(GL_TRIANGLE); glVertex3f(0,0,0); glVertex3f(0,1,1); glVertex3f(0,1,0); glEnd(); glBegin(GL_TRIANGLE); glVertex3f(0,1,1); glVertex3f(0,1,0); glVertex3f(0,0,1); glEnd();

Drawing a cube Where is this point in the code? drawFace() { glNormal3f(0,1,0); glBegin(GL_TRIANGLE); glVertex3f(0,0,0); glVertex3f(1,0,0); glVertex3f(1,0,1); glVertex3f(0,0,0); glVertex3f(1,0,1); glVertex3f(0,0,1); glEnd(); } drawFace() { glNormal3f(0,1,0); glBegin(GL_TRIANGLE); glVertex3f(0,0,0); glVertex3f(1,0,0); glVertex3f(1,0,1); glVertex3f(0,0,0); glVertex3f(1,0,1); glVertex3f(0,0,1); glEnd(); }

Goal: Construct from stream Want to end up with a “nice” object representation (points, edges, faces, …) Need this for most manipulations Original program may never have had it! Geometry is implicit in code Need to dig it out of execution stream!

Problem: We need the programmer’s intentions! We’re guessing what program does Are you really drawing that quad? Or is it a piece of text with a menu? Or are you playing a weird trick in the stencil buffer? Make some “reasonable” assumptions Could add heuristics

Build a geometric representation Note: GL doesn’t have a notion of a “point.” A vertex is a temporal element. Many GL vertices might be the same point.

How to do this Spatial hashing Find points that are the same in world-space Avoids transform issues Minor issue that GL doesn’t have “world” Creates geometry that would generate the same GL stream

Now what? We have a “standard” geometric data structure – just like any app Augment with some analysis Silhouette edge detection Fake normals and lighting Pass it to a plug-in “renderer”

Draw it your own way… Quake 3 Arena Before After (still approx 30fps!)

Plug-in Renderers are easy

Or write it to disk… Print Screen to Maya! Note view culling issues

The Limitations Engineering Things that just take time (e.g. we know how to do) Conceptual Things that take thought (e.g. we believe we could figure out) Fundamental Things that just aren’t going to happen

What we could do… Just more engineering Texture sampling Handle more of GL Display lists, more vertex arrays Complete state tracking Geometry replacement More renderers and applications Requires thought Identify multi-pass Higher-level geometry Object boundaries Object recognition Curve reconstruction Compression and transmission

What we can’t do Really know programmer’s intent Work 100% of the time Programmers do weird things Only get what is drawn Answer? “minor invasiveness” Application gives some hints

Summary Intercept calls to the graphics library Build a geometric representation Do something cool with it Lots of cool things can be done! The are drawbacks Yes! You can download it! go to the gallery page…

Thanks! UW Graphics group National Science Foundation Mike: CCR , IIS Industrial and University sponsors Microsoft, Intel, Autodesk, Alias/Wavefront, Wisconsin Alumni Research Foundation, IBM, Pixar Yes! You can download it! go to the gallery page…