Survey

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Hold-And-Modify wikipedia, lookup

Free and open-source graphics device driver wikipedia, lookup

General-purpose computing on graphics processing units wikipedia, lookup

Waveform graphics wikipedia, lookup

BSAVE (bitmap format) wikipedia, lookup

Video card wikipedia, lookup

Tektronix 4010 wikipedia, lookup

Apple II graphics wikipedia, lookup

2.5D wikipedia, lookup

Comparison of OpenGL and Direct3D wikipedia, lookup

Molecular graphics wikipedia, lookup

Mesa (computer graphics) wikipedia, lookup

OpenGL wikipedia, lookup

Graphics processing unit wikipedia, lookup

Framebuffer wikipedia, lookup

Transcript
```Programming for Interactivity
Professor Bill Tomlinson
Tuesday & Wednesday
6:00-7:50pm
Fall 2005
Logistics
• Resources for Assignment 1
– Do you have everything you need?
Argument
argument, n.
Add: [2.] b. Math. and Computing. An independent variable of a function (e.g.
x and y in z = f(x, y)). 1865 BRANDE & COX Dict. Sci., Lit., & Art I. 768
Any trigonometrical function of phi is termed an elliptic function, having the
argument u and modulus k. 1879 Encycl. Brit. IX. 818/1 In each case u is
the independent variable or argument of the function. 1946 Nature 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. 1984
Computerworld 5 Mar. 54 Use of Boolean commands to connect a segment
search argument with the next argument list in the..search field list.
Didn’t use a book. It’s very similar to
OpenGL. They used online resources,
esp. those for OpenGL.
• 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
• 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.
More Intro to Java
Java API Specification
• How to use it.
• http://java.sun.com/j2se/1.5.0/docs/api/ind
ex.html
• Example: java.awt.Graphics.drawOval
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…
index.html
•
To change the size of the applet that appears in the browser, you may need
to change the index.html file.
<HTML>
<TITLE>
Simple Applet Example
</TITLE>
<BODY>
<APPLET code="BasicGraphicsSystem" width=501 height=511>
Your browser does not support Java, so nothing is displayed.
</APPLET>
</BODY>
</HTML>
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?
Testing
• Writing test cases to make sure something
works correctly before moving on.
Graphics
Vector vs. Pixel-Based
• Java does both
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.
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.)
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?
Animation
• Traditional animation principles still apply
to real-time computer animation (if you
want them to):
– Anticipation
– Squash & Stretch
(with conservation
of mass)
Interactive animation
• Responsiveness vs. expressiveness
• Role of the participant
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/
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)
Color
• RGBA – Red, Green, Blue, Alpha
Bill’s Mobile Device Sim…
3D Graphics
• OpenGL (and JOGL)
• DirectX
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.
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.”
JOGL Demos
• Run one or two…
Virtual Worlds
•
•
•
•
•
Autonomous characters
World characteristics
Virtual cinematography
Participant interaction
Sound system
3D Animation Programs
• Maya
• 3D Studio Max (site license)
• Useful for making source material for realtime 3D graphics.
Meshes
Texture Mapping
• Technique for mapping an image onto an
object in a scene.
Rendering Styles
• Photorealistic
• Non-photorealistic
Photorealistic
• Seeks to recreate real life
Stanford - Hanrahan
Debevec - Fiat Lux
• Video
Skin, ATI, SIGGRAPH 04
Non-Photorealistic
• Meier, 96
Rutgers
AlphaWolf
• Angle between normal and camera
provides index for sampling data from
texture map.
• Transparency
Good NPR Site
• Craig Reynolds
• http://www.red3d.com/cwr/npr
Techniques for maintaining frame
rate
•
•
•
•
Low-polygon modeling
Level of detail
Culling
Procedural
generation
• Game levels/rooms
• Game design
Collision Detection Methods
•
•
•
•
Sphere/Sphere Overlap
Axis Aligned Bounding Boxes (x, y)
Object Bounding Boxes Pixel Based CD
Polygon/Hierarchical Subtrees
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
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)
camPos & lookAt
• Where the camera is and where it is
looking
• Requires linear algebra (vectors, dot
products, etc.)
• Camera updates like a character
The Two Character Shot
• Draw it…
World coordinates vs. Character
coordinates
• Which is better? (Draw example)
Transitions
• Continuous
• Cuts
• Whip-pans
Lighting
Real-time Lighting
• Few lights
• Limited capabilities
Interdevice Animation
•
•
•
•
•
•
Position
Direction
Size
Rendering style
Frame rate
Resolution
Evolving Graphics
• Karl Sims Movie