Attack of the Clones Image source: https://en.wikipedia.org/wiki/File:Imperialmarch.jpg.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Further Programming for 3D applications CE Introduction to Further Programming for 3D application Bob Hobbs Faculty of Computing, Engineering and.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
3D Concepts Coordinate Systems Coordinates specify points in space 3D coords commonly use X, Y, & Z A vertex is a 'corner' of an object Different coordinate.
Hierarchy, Modeling, and Scene Graphs Angel: Chapter 10 OpenGL Programming and Reference Guides, other sources. ppt from Angel, AW, etc. CSCI 6360/4360.
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 with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
Chapter 10 Bresenham’s Algorithm Data Structures and Graphics or Working with Models.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Week 2 - Wednesday CS361.
Computer Graphics. Requirements Prerequisites Prerequisites CS 255 : Data Structures CS 255 : Data Structures Math 253 Math 253 Experience with C Programming.
Demetriou/Loizidou – ACSC330 – Chapter 9 Hierarchical and Object-Oriented Modeling Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
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 Angel and Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Introduction to Computer Graphics Ed Angel Professor Emeritus of Computer.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
CSE 581: Interactive Computer Graphics Spring 2012, UG 4 Tuesday, Thursday – 9:00AM – 10:18AM DL 0317 Raghu Machiraju Slides: Courtesy - Prof. Huamin Wang,
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
MAE 152 Computer Graphics for Scientists and Engineers Fall 2003 Dr. Prashant V. Mahajan Senior Research Scientist AValonRF, Inc., El Cajon, CA.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Control flow for interactive applications CSE 3541 Matt Boggus.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
1 Building Models Ed Angel Professor Emeritus of Computer Science University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley.
Modeling CSCI 440 Computer Graphics based on Chapter 9
Scene Graph & Game Engines. 2 Limitations of Immediate Mode Graphics  When we define a geometric object in an application, upon execution of the code.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Hierarchical Modeling. 2 Objectives Build a tree-structured model of a humanoid figure. Examine various traversal strategies. Build a generalized tree-model.
3D Objects in WebGL Loading 3D model files. Announcement Midterm exam on 12/2 –No Internet connection. –Example code and exam questions will be on USB.
Web Audio API Let your WebGL program dance. Announcement Final project proposal due in one week. Choice of demo date? Plan for the 12/23 class. 2.
Chapter 1 Graphics Systems and Models Models and Architectures.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Graphics Programming. Graphics Functions We can think of the graphics system as a black box whose inputs are function calls from an application program;
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Hierarchical Models Chapter 9.
- Introduction - Graphics Pipeline
Computer Graphics.
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Introduction to Computer Graphics with WebGL
Graphical Objects and Scene Graphs
Graphical Objects and Scene Graphs
Let your WebGL program dance
Using the basic-objects-IFS.js Utility
Modeling and Hierarchy
CS451Real-time Rendering Pipeline
Introduction to Computer Graphics with WebGL
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Modeling and Hierarchy
Hierarchical and Object-Oriented Graphics
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Hierarchical and Object-Oriented Graphics
Models and Architectures
Hierarchical Modeling I
Introduction to Computer Graphics with WebGL
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Presentation transcript:

Attack of the Clones Image source:

Announcement Grading of midterm exams is done. –Please see the TA if you need a copy of your files. –Grade distribution: 9 人 100 分 24 人 90~99 分 5 人 60~89 分 7 人 0~59 分 2

Final Projects It is about time to think about your final projects. Themes for this semester: Interactive Art in WebGL –Animating objects with changing colors, positions, shapes, …etc. –Interacts with mouse input or audio input (music). 3

Win Me 4

Inspiration three-js-webglhttp://srchea.com/experimenting-with-web-audio-api- three-js-webgl visualization-with-web-audio-canvas-and-the- soundcloud-apihttp:// visualization-with-web-audio-canvas-and-the- soundcloud-api audio-spectrum-visualizer/launchhttps://developer.mozilla.org/en-US/demos/detail/3d- audio-spectrum-visualizer/launch 5

For Further Reading Angel 7 th Ed: –Chaper 9 Web Audio API: – WebGL Programming Guide: –Chapter 10: OBJViewer.js –htt ps://github.com/machinezilla/webgl-programming-guidehtt ps://github.com/machinezilla/webgl-programming-guide 6

Clones of the Cube

5x5x5 Array of Cubes (JS code)JS code) function render() {... gl.uniformMatrix4fv( viewingLoc, 0, flatten(viewing) ); gl.uniformMatrix4fv( projectionLoc, 0, flatten(projection) ); gl.uniformMatrix4fv( lightMatrixLoc,0, flatten(moonRotationMatrix) ); for (i=-2; i<=2; i++) { for (j=-2; j<=2; j++) { for (k=-2; k<=2; k++) { var cloned = mult(modeling, mult( translate(0.2*i, 0.2*j, 0.2*k), scale(0.12, 0.12, 0.12))); gl.uniformMatrix4fv( modelingLoc, 0, flatten(cloned) ); gl.drawArrays( gl.TRIANGLES, 0, numVertices ); }

MV.Js bug Two versions of scale() in MV.js –function Scale( x, y, z ) –function Scale( s, u ) The solution is rename scale(s, u). 9

Lab Time! Uncomment the line that sets “var cloned” and see what happens. Create more cube! How about 10x10x10? 100x100x100? Can your PC handle them? Can you display 5x5x5 cows using the OBJViewer example of last week? How about using different colors for the cubes? –Passing different color attributes to the shaders? –How about changing the colors directly within the shaders? 10

WEB AUDIO 11

Web Audio API (link) 1/2link request.onload = function() { context.decodeAudioData( request.response, function(buffer) { if(!buffer) { // Error decoding file data return; } sourceJs = context.createJavaScriptNode(2048); sourceJs.buffer = buffer; sourceJs.connect(context.destination); analyser = context.createAnalyser(); analyser.smoothingTimeConstant = 0.6; analyser.fftSize = 512;

Web Audio API (link) 2/2link source = context.createBufferSource(); source.buffer = buffer; source.connect(analyser); analyser.connect(sourceJs); source.connect(context.destination); sourceJs.onaudioprocess = function(e) { array = new Uint8Array(analyser.frequencyBinCount); analyser.getByteFrequencyData(array); }; source.start(0); }... ); };

Visualization var k = 0; for(var i = 0; i < cubes.length; i++) { for(var j = 0; j < cubes[i].length; j++) { var scale = array[k] / 30; cubes[i][j].scale.z = (scale < 1 ? 1 : scale); k += (k < array.length ? 1 : 0); }

Scene Graph & Game Engines

16 Limitations of Immediate Mode Graphics  When we define a geometric object in an application, upon execution of the code the object is passed through the pipeline  It then disappears from the graphical system  To redraw the object, either changed or the same, we must reexecute the code  Display lists provide only a partial solution to this problem

17 OpenGL and Objects  OpenGL lacks an object orientation  Consider, for example, a green sphere We can model the sphere with polygons or use OpenGL quadrics Its color is determined by the OpenGL state and is not a property of the object  Defies our notion of a physical object  We can try to build better objects in code using object-oriented languages/techniques

18 Imperative Programming Model  Example: rotate a cube  The rotation function must know how the cube is represented Vertex list Edge list Application Rotate cube data results

19 Object-Oriented Programming Model ApplicationCube Object  In this model, the representation is stored with the object  The application sends a message to the object  The object contains functions (methods) which allow it to transform itself message

20 Cube Object  Suppose that we want to create a simple cube object that we can scale, orient, position and set its color directly through code such as cube mycube; mycube.color[0]=1.0; mycube.color[1]= mycube.color[2]=0.0; mycube.matrix[0][0]=………

21 Cube Object Functions  We would also like to have functions that act on the cube such as mycube.translate(1.0, 0.0,0.0); mycube.rotate(theta, 1.0, 0.0, 0.0); setcolor(mycube, 1.0, 0.0, 0.0);  We also need a way of displaying the cube mycube.render();

22 Building the Cube Object class cube { public: float color[3]; float matrix[4][4]; // public methods private: // implementation }

23 The Implementation  Can use any implementation in the private part such as a vertex list  The private part has access to public members and the implementation of class methods can use any implementation without making it visible  Render method is tricky but it will invoke the standard OpenGL drawing functions

24 Other Objects  Other objects have geometric aspects Cameras Light sources  But we should be able to have nongeometric objects too Materials Colors Transformations (matrices)

25 Application Code cube mycube; material plastic; mycube.setMaterial(plastic); camera frontView; frontView.position(x,y, z);

26 Light Object class light { // match Phong model public: boolean type; //ortho or perspective boolean near; float position[3]; float orientation[3]; float specular[3]; float diffuse[3]; float ambient[3]; }

27 Scene Descriptions  If we recall figure model, we saw that We could describe model either by tree or by equivalent code We could write a generic traversal to display  If we can represent all the elements of a scene (cameras, lights,materials, geometry) as C++ objects, we should be able to show them in a tree Render scene by traversing this tree

28 Scene Graph

29 Preorder Traversal PushAttrib PushMatrix Color Translate Rotate Object1 Translate Object2 PopMatrix PopAttrib …

30 Group Nodes  Necessary to isolate state chages Equivalent to Push/Pop  Note that as with the figure model We can write a universal traversal algorithm The order of traversal can matter  If we do not use the group node, state changes can persist

Open Scene Graph  Inventor  VRML  OpenSG ( A scene graph metaphor on top of OpenGL

Game Engines  Unity 3D:  Unreal Engine:  Unigene Heaven:  CryEngine: oads oads  Ogre 3D: