1 / 54

Programming for Interactivity

Programming for Interactivity. Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005. Logistics. Logins Resources for Assignment 1 Do you have everything you need?. Answers to Last Week’s Questions. Argument ADDITIONS SERIES 1997 argument , n.

nita
Télécharger la présentation

Programming for Interactivity

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming for Interactivity Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005

  2. Logistics • Logins • Resources for Assignment 1 • Do you have everything you need?

  3. Answers to Last Week’s Questions Argument ADDITIONS SERIES 1997 argument, n. Add:    [2.] b.Math. and Computing. An independent variable of a function (e.g. x and y in z = f(x, y)). 1865BRANDE & COXDict. Sci., Lit., & Art I. 768 Any trigonometrical function of phi is termed an elliptic function, having the argument u and modulus k. 1879Encycl. Brit. IX. 818/1 In each case u is the independent variable or argument of the function. 1946Nature 12 Oct. 503/2 The ENIAC has three function tables.., each of which comprises an array of switches on which 6-figure values of two functions, with signs, or a 12-figure value of one function, can be set up for each of 104 values of an argument. 1974 A. V. AHO et al. Design & Anal. Computer Algorithms i. 37 After a function procedure has been defined, it can be invoked in an expression by using its name with the desired arguments. 1984Computerworld 5 Mar. 54 Use of Boolean commands to connect a segment search argument with the next argument list in the..search field list.

  4. Answers to Last Week’s Questions • JOGL book – Asked my students. Answer: Didn’t use a book. It’s very similar to OpenGL. They used online resources, esp. those for OpenGL.

  5. Answers to Last Week’s Questions • System.err.println - Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored. • http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#err

  6. Reading • Lynn Stein • The rest of her online book is recommended if you’re just getting up to speed with Java and/or object-oriented programming.

  7. More Intro to Java

  8. Java API Specification • How to use it. • http://java.sun.com/j2se/1.5.0/docs/api/index.html • Example: java.awt.Graphics.drawOval

  9. Exceptions • Null Pointer Exception • Objects and pointers • Happen when code tries to act on the object that a pointer is pointing to, but the pointer is not pointing to an object. • ArrayOutOfBoundsException • Happens when code asks for data from an array that is at a higher index than the size of the array. • And many more…

  10. index.html • To change the size of the applet that appears in the browser, you may need to change the index.html file. <HTML> <HEAD> <TITLE> Simple Applet Example </TITLE> </HEAD> <BODY> <APPLET code="BasicGraphicsSystem" width=501 height=511> Your browser does not support Java, so nothing is displayed. </APPLET> </BODY> </HTML>

  11. Writing Robust and Extensible Code • I may ask you to change something subtly and recompile it tomorrow. Will your code respond well and “do the right thing,” or is it brittle?

  12. Testing • Writing test cases to make sure something works correctly before moving on.

  13. Graphics

  14. Vector vs. Pixel-Based • Java does both

  15. Framebuffers • “The framebuffer is a part of RAM in a computer allocated to hold the graphics information for one frame or picture. This information typically consists of color values for every pixel (point that can be displayed) on the screen.” • Wikipedia • Assignment 1 is a simple simulated framebuffer.

  16. Update loops • To move from static graphics to animated graphics, it is necessary for the code to take action repeatedly. • Assignment 1 introduces you to a simple update loop. • (Also called the main loop or main event loop.)

  17. Time Keeping • 2 models • Real world time – based on world time such as System.currentTimeMillis(); • Virtual world time – based on virtual time such as timeCounter++; • Which model does the Assignment 1 code use?

  18. Animation • Traditional animation principles still apply to real-time computer animation (if you want them to): • Anticipation • Follow Through • Squash & Stretch (with conservation of mass)

  19. Interactive animation • Responsiveness vs. expressiveness • Role of the participant

  20. 2D graphics – GUIs, etc. • AWT vs. Swing • “"Swing" refers to the new library of GUI controls (buttons, sliders, checkboxes, etc.) that replaces the somewhat weak and inflexible AWT controls.” • From http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/

  21. Java2D • “In Java 1.2, the paintComponent method is supplied with a Graphics2D object (a subclass of Graphics), which contains a much richer set of drawing operations. It includes pen widths, dashed lines, image and gradient color fill patterns, the use of arbitrary local fonts, a floating point coordinate system, and a number of coordinate transformation operations.” • From (http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html)

  22. Color • RGBA – Red, Green, Blue, Alpha

  23. Bill’s Mobile Device Sim…

  24. 3D Graphics • OpenGL (and JOGL) • DirectX

  25. OpenGL (or JOGL) vs. DirectX • Both vertex based graphics APIs • A range of different capabilities. • My group uses JOGL because it works on multiple operating systems.

  26. JOGL • https://jogl.dev.java.net/ • “The JOGL Project hosts a reference implementation of the Java bindings for OpenGL API, and is designed to provide hardware-supported 3D graphics to applications written in Java. It is part of a suite of open-source technologies initiated by the Game Technology Group at Sun Microsystems.”

  27. JOGL Demos • Run one or two…

  28. Virtual Worlds • Autonomous characters • World characteristics • Virtual cinematography • Participant interaction • Sound system

  29. 3D Animation Programs • Maya • 3D Studio Max (site license) • Useful for making source material for real-time 3D graphics.

  30. Meshes

  31. Texture Mapping • Technique for mapping an image onto an object in a scene.

  32. Rendering Styles • Photorealistic • Non-photorealistic

  33. Photorealistic • Seeks to recreate real life

  34. Stanford - Hanrahan

  35. Debevec - Fiat Lux • Video

  36. Skin, ATI, SIGGRAPH 04

  37. Non-Photorealistic • Meier, 96

  38. Rutgers

  39. AlphaWolf

  40. Cartoon Shader • Angle between normal and camera provides index for sampling data from texture map. • Transparency

  41. Good NPR Site • Craig Reynolds • http://www.red3d.com/cwr/npr

  42. Techniques for maintaining frame rate • Low-polygon modeling • Level of detail • Culling • Procedural generation • Game levels/rooms • Game design

  43. Collision Detection Methods • Sphere/Sphere Overlap • Axis Aligned Bounding Boxes (x, y) • Object Bounding Boxes Pixel Based CD • Polygon/Hierarchical Subtrees

  44. Static vs. Dynamic Intersection • Collision checks can be performed at discrete time steps, simple & efficient but can cause problems if steps are not much smaller than velocities (penetration, innacurate collision directions, and completely missing collisons, etc.) • Dynamic checks take into current trajectory of objects. More complex to check but can solve above problems

  45. Autonomous Cinematography • In a virtual world, who decides where the camera goes? • Some of the same problems as film cinematography – expressiveness, appearance of continuity, etc. • Some additional problems – interactivity, continuity of time (esp. when networked)

  46. camPos & lookAt • Where the camera is and where it is looking • Requires linear algebra (vectors, dot products, etc.) • Camera updates like a character

  47. The Two Character Shot • Draw it…

  48. World coordinates vs. Character coordinates • Which is better? (Draw example)

  49. Transitions • Continuous • Cuts • Whip-pans

  50. Lighting

More Related