CS324e - Elements of Graphics and Visualization Checkerboard World.

Slides:



Advertisements
Similar presentations
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Advertisements

2 COEN Computer Graphics I Evening’s Goals n Discuss the fundamentals of lighting in computer graphics n Analyze OpenGL’s lighting model n Show.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider.
SE 313 – Computer Graphics Lecture 13: Lighting and Materials Practice Lecturer: Gazihan Alankuş 1.
SE 313 – Computer Graphics Lecture 14: Armatures Lecturer: Gazihan Alankuş 1.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
UFCEKT-20-33D Modelling and Animation 3D Modelling & Animation Lighting.
IMGD 1001: Illumination by Mark Claypool
Lighting and Shading Wen-Chieh (Steve) Lin
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Course Website: Computer Graphics 16: Illumination.
Scenes, Cameras & Lighting. Outline  Constructing a scene  Using hierarchy  Camera models  Light models.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
CS324e - Elements of Graphics and Visualization Java2D Graphics.
SET09115 Intro Graphics Programming
Illumination.
CS 445 / 645: Introductory Computer Graphics
Lecture 5: 3D Rendering Pipeline (II) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
Modelling and Simulation Types of Texture Mapping.
Shapes Properties Binding Chung Ji Hye.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
1 Virtual Reality Modeling Language (VRML97) ©Anthony Steed
Lecture 9: Lighting and Shading 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
CSE 381 – Advanced Game Programming GLSL Lighting.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
CS324e - Elements of Graphics and Visualization Java 3D Intro.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
11/04/04© University of Wisconsin, CS559 Fall 2004 Last Time Visibility –Z-Buffer and transparency –A-buffer –Area subdivision –BSP Trees –Exact Cell-Portal.
Illumination and Shading
Course Introduction to virtual engineering Óbuda University John von Neumann Faculty of Informatics Institute of Applied Mathematics Lecture and laboratory.
CS324e - Elements of Graphics and Visualization Timing Framework.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Lighting a 3D Scene Guilford County Sci Vis V part 1.
1 9 Lighting a Scene v There are four types of lighting: –ambient light –directional light –point light –spotlight v Any number of these can be added to.
Local Illumination and Shading
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
 Advancing from moving premade primitives to making our own models  Two different approaches: ◦ Direct mesh editing: A more traditional approach commonly.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
UNIT 11: 3D AutoCAD Objectives: How to print or plot a drawing How to setup a layout using title blocks and viewports Create and manage new layouts Be.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Light and Optics Part Three: Optics and Reflection.
Computer Graphics: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
© University of Wisconsin, CS559 Spring 2004
Shading To determine the correct shades of color on the surface of graphical objects.
EEC-693/793 Applied Computer Vision with Depth Cameras
Rendering, Cameras & Lighting
Game Development Unity3D.
Lighting.
CSE 470 Introduction to Computer Graphics Arizona State University
Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm
Game Programming Algorithms and Techniques
Computer Graphics Material Colours and Lighting
CS 480/680 Computer Graphics Shading.
Lighting Calculations
Presentation transcript:

CS324e - Elements of Graphics and Visualization Checkerboard World

Larger Example - From KGPJ 2

Classes (Not All) 3 Checkers3D extends JFrame WrapCheckers3D extends JPanel CheckerFloor coloredTiles Extends Shape3D Sphere

Checkers3D Extends JFrame Similar to frame from HelloUniverse Contains the panel that contains the canvas3D Could add other GUI components – controls or menu items to affect the 3d scene 4

WrapCheckers3D extends JPanel Contains the Canvas3D Canvas3D a GUI component Canvas3D show up on top of other swing components if you try and mix them – doesn't play well – keep separate – don't try to put buttons or scroll bars in canvas No animation loop – Canvas3D and Scene graph self monitor and if something changes redraw automatically 5

WrapCheckers3D Most of the code to set up the 3D world Instance variables and class constants Where is USERPOSN located? 6

Creating the World 7

Creating the Scene Graph 8

Lighting the Scene four kinds of lights can be placed in a Java3D world – ambient light – directional lights – point lights – spot lights Scene can have multiple lights Lights have color, position (possibly), direction (possibly), attenuation (possibly) attributes 9

Lights Ambient lights – Uniform in all directions and locations – create AmbientLight object, give it a color, and add as a node to scene graph – Color3f each channel (red, green, blue defined with value between 0 and 1 10

Spheres and Ambient Light 11

Directional Lights fixed direction no specific location (think of it as being at an infinite distance away from scene) light rays are parallel 12

13 Directional Light

14 Directional Light

Point Light Has a location in the scene emits in all directions has a color has an attenuation, intensity decreases as distance from light increases 15

Point Light Attenuation of Point Light has three factors: – constant attenuation, ac – linear attenuation, la – quadratic attenuation, qa light intensity at a given point distance d away from the light = 1.0 / (ac + la * d + qa * d * d) 16

Point Light 17

Point Light Change y coordinate of location from 10 to 20 We see the things the light interacts with 18

Spotlight Similar to Point Light has location and direction, but does not emit light in all directions emits light in a cone shape region attenuation like Point Light, but add attenuation for light rays away from central direction 19

Spotlight 20

Spotlight Effects attenuation changed to PI / 2 21

Spotlight Effects Concentration changed from 100 to 10, spread angle still set at PI / 2 22

Background can add a background image or color draw at the back of a scene and is not altered by camera movement in the scene 23

Background Code 24

Background Effect - Color ambient and directional lights 25

Background Effect - Image 26

Adding Shapes Documentation for Java3D package at avadoc/1.5.1/index.html avadoc/1.5.1/index.html Add visible objects to a scene requires adding Primitives or creating a class that extends Shape3D built in subclasses of primitive include: – box, cone, cylinder, sphere 27

Adding Spheres Multiple Sphere constructors but all have some variation of these parameters – radius, size of sphere – primFlags, A number of constants that affect how the sphere is created (for example should the appearance be allowed to be changed) – divisions, affects the number of polygons used to construct the sphere (divisions != total number) – appearance, how the sphere should look 28

Sphere Constructor 29 primflags - refer to Sphere class for options, GENERATE_NORMALS in our caseSphere radius = 2.0f vary divisions from 4 to 31 Appearance, show wireframe and blue materials

Appearances Program includes two hard coded appearances for the spheres First, just show the polygons 30

Wireframes By default inside faces are culled, not visible notice difference in divisions – why not just crank divisions up to 100s? 31

Wireframes CULL_NONE Notice difference in smaller divisions we see lines the "backs" of lines 32

Wireframes Using POLYGON_POINT instead of POLYGON_LINE 33

Polygon Attributes Using POLYGON_FILL 34

Changing Color Color attribute of an appearance can be changed, default is white 35

Materials More realistic appearances created using materials Material class specify four colors and a value for shininess (1 to 128) four colors for ambient, emissive, diffuse, and specular properties of the material Define how light interacts with the material and the light it gives off. 36

Material Properties Ambient Color: how much (and what color) ambient light is reflected by the material Recall when only ambient light in the world 37

Material Properties Emissive Light – the color of light the material gives off itself – material glows, but does not illuminate other materials – to create a flashlight pair a spotlight and a shape with a material that gives off light – examples so far emissive light for spheres was black (none) – dim the lights and let the spheres give off a bright yellow light 38

Emissive Light No other lights 39

Diffuse and Specular Properties Ambient color is response to ambient light which appears to come from all directions diffuse color reflects light coming from one direction (directional, point, and spot lights) – angle in != angle out – various angles of reflection specular color, follows law of reflection – angle in = angle out 40

Materials Billiard Ball like material ambient emissive diffuse specular shininess (red, black, red, white, 70) notice glinting off edges 41

Materials Specular set to black 42

Materials ambient emissive diffuse specular shininess (red, black, white, white, 25) 43

Positioning Spheres To position spheres each has its own Transform Group change x, y, and z for each transform group can't just update one TG, otherwise position changes Branch Group Simple Universe Transform Group Sphere Transform Group Sphere Transform Group Sphere

Positioning Spheres 45

Adding the Checker Floor 46

CheckerFloor Not a standard Java3D class creates its own branch group consists of – 2 sets of colored tiles, blue and green – a red colored tile at the center – labels which are Text2D objects 47

Colored Tiles ColoredTiles class extends built in Shjape3D class Uses a QuadArray to represent the tiles QuadArray a built in Java3D class – stores sets of 4 points that define individual quadrilaterals – In this case a flat surface, but quads do not have to be co-planar – quads don't have to be connected to each other 48

Morph and Lathe Build shapes by defining an outline and rotating outline 360 degrees 49

Exploding a Shape3D can alter coordinates of quads to create an explosion affect 50

Colored Tiles Quad specified with 4 Point3f objects – four corners of the quad – order significant – "front" of the shape is counterclockwise loop formed by the points Individual quads do not have to be adjacent to other quads 51

CheckerFloor Constructor 52

CheckerFloor Constructor continued 53

Creating Points Called by constructor to create 4 points for one time based on anchor point 54

colored Tiles ArrayList contains 4x Point3f to build QuadArray Each tile given a color instead of a material – does not react with light – must calculate normals if wish to base Appearance on a material 55

colored Tiles Constructor 56

Checker Floor 57

Checker floor - Only Green Tiles 58

Adding Labels Back in CheckerFloor class – two methods 59

Adding Labels 60

Effects of Culling demo program when culling performed on colored Tiles and text 61

Creating and Positioning Camera Back in WrapCheckers3D class 62

Initial Position SimpleUniverse create viewing platform for us lookAt method to set position 63

lookAt method the lookAt method makes the object being translated face towards the ViewPlatform, which actually makes the ViewPlatform face exactly away from our scene, so we invert it at that point. 64

Orbit Controls Simple way to allow mouse to move the viewing platform 65